DEEPSOLVER_BEGIN_NAMESPACE bool OsIntegrity::verify(const PkgVector& pkgs) const { for(PkgVector::size_type i = 0;i < pkgs.size();++i) { const Pkg& p = pkgs[i]; for(NamedPkgRelVector::size_type k = 0;k < p.requires.size();++k) if (!checkRequire(p.requires[k], pkgs)) { logMsg(LOG_ERR, "integrity:the package \'%s\' has broken require \'%s\'", m_backend.getDesignation(p, AbstractPkgBackEnd::EpochIfNonZero).c_str(), m_backend.getDesignation(p.requires[k]).c_str()); return 0; } for(NamedPkgRelVector::size_type k = 0;k < p.conflicts.size();++k) if (!checkConflict(p, p.conflicts[k], pkgs)) { logMsg(LOG_ERR, "integrity:the package \'%s\' has violated conflict \'%s\'", m_backend.getDesignation(p, AbstractPkgBackEnd::EpochIfNonZero).c_str(), m_backend.getDesignation(p.conflicts[k]).c_str()); return 0; } } logMsg(LOG_INFO, "integrity:ok:%zu packages verified", pkgs.size()); return 1; }
bool Solution::check(bool shouldPrint) { return checkCapacity (shouldPrint) && checkConflict (shouldPrint) && checkSpread (shouldPrint) && checkDependency(shouldPrint) ; }
static int checkConflict( Tcl_Interp * interp, char *path, char **modulelist, unsigned int nummodules ) { uvec *new_modulelist; int new_nummodules, k; is_Result fstate; char *buffer; memset(error_module, '\0', MOD_BUFSIZE); /** ** Check all modules passed to me as parameter ** At first clarify if they really do exist ... **/ for (k = 0; k < nummodules; k++) { if (!(buffer = stringer(NULL,0,path,psep,modulelist[k],NULL))) if (OK != ErrorLogger(ERR_STRING, LOC, NULL)) goto unwind0; if (!(fstate = is_("what", buffer))) { if (OK != ErrorLogger(ERR_FILEINDIR, LOC, modulelist[k], path, NULL)) if (!stringer(error_module, MOD_BUFSIZE, modulelist[k], NULL)) if (OK != ErrorLogger(ERR_STRING, LOC, NULL)) goto unwind1; goto unwind1; } /** ** Is it a directory what has been passed? If it is, list the ** according directory and call myself recursively in order to **/ if (fstate == IS_DIR) { if (!(new_modulelist = SortedDirList(path, modulelist[k], &new_nummodules))) continue; if (TCL_ERROR == checkConflict(interp, path, uvec_vector(new_modulelist), new_nummodules)) { FreeList(&new_modulelist); goto unwind1; } FreeList(&new_modulelist); /** ** If it isn't a directory, check the current one for to be the ** required module file **/ } else { if (IsLoaded_ExactMatch (interp,modulelist[k],NULL,NULL) && strcmp(g_current_module, modulelist[k])) { /** ** Save the name of the offending module in a buffer ** for reporting purposes when we get back to the top. **/ if (!stringer(error_module, MOD_BUFSIZE, modulelist[k], NULL)) if (OK != ErrorLogger(ERR_STRING, LOC, NULL)) goto unwind1; goto unwind1; } } /** if( directory) **/ } /** for **/ /** ** free resources **/ null_free((void *)&buffer); return (TCL_OK); /** -------- EXIT (SUCCESS) -------> **/ unwind1: null_free((void *)&buffer); unwind0: return (TCL_ERROR); /** -------- EXIT (FAILURE) -------> **/ } /** End of 'checkConflict' **/
TEST(LockManager, ValidateConflictMatrix) { checkConflict(MODE_IS, MODE_IS, false); checkConflict(MODE_IS, MODE_IX, false); checkConflict(MODE_IS, MODE_S, false); checkConflict(MODE_IS, MODE_X, true); checkConflict(MODE_IX, MODE_IS, false); checkConflict(MODE_IX, MODE_IX, false); checkConflict(MODE_IX, MODE_S, true); checkConflict(MODE_IX, MODE_X, true); checkConflict(MODE_S, MODE_IS, false); checkConflict(MODE_S, MODE_IX, true); checkConflict(MODE_S, MODE_S, false); checkConflict(MODE_S, MODE_X, true); checkConflict(MODE_X, MODE_IS, true); checkConflict(MODE_X, MODE_IX, true); checkConflict(MODE_X, MODE_S, true); checkConflict(MODE_X, MODE_X, true); }