Skip to content

Commit

Permalink
change compare
Browse files Browse the repository at this point in the history
  • Loading branch information
osalyk committed Jul 31, 2024
1 parent 21103d4 commit 1dd97e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
9 changes: 4 additions & 5 deletions src/tests/ras/utils/inject_manager/inject_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ const std::vector<Dimm> InjectManager::GetDimmsToInject(
}

bool InjectManager::CheckUSCDiff(
const std::vector<DimmNamespace> &dimm_namespaces,
std::function<bool(int, int)> compare) const {
const std::vector<DimmNamespace> &dimm_namespaces) const {
bool ret = true;
for (const auto &dn : dimm_namespaces) {
for (const auto &d : GetDimmsToInject(dn)) {
Expand All @@ -123,7 +122,7 @@ bool InjectManager::CheckUSCDiff(
ret = false;
}

if (!compare(recorded_usc, d.GetShutdownCount())) {
if (recorded_usc == d.GetShutdownCount()) {
std::cerr << "NVDIMM: " << d.GetUid()
<< " (test dir: " << dn.GetTestDir()
<< "). Current USC: " << d.GetShutdownCount()
Expand Down Expand Up @@ -159,7 +158,7 @@ bool InjectManager::IsLastShutdownUnsafe(
return cur > rec;
};

if (!CheckUSCDiff(dimm_namespaces, compare)) {
if (!CheckUSCDiff(dimm_namespaces)) {
std::cerr << "Unexpected safe shutdown of NVDIMM" << std::endl;
return false;
}
Expand All @@ -172,7 +171,7 @@ bool InjectManager::IsLastShutdownSafe(
return cur == rec;
};

if (!CheckUSCDiff(dimm_namespaces, compare)) {
if (!CheckUSCDiff(dimm_namespaces)) {
std::cerr << "Unexpected unsafe shutdown of NVDIMM" << std::endl;
return false;
}
Expand Down
3 changes: 1 addition & 2 deletions src/tests/ras/utils/inject_manager/inject_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ class InjectManager {
private:
std::string test_dir_;
InjectPolicy policy_;
bool CheckUSCDiff(const std::vector<DimmNamespace> &dimm_namespaces,
std::function<bool(int, int)> compare) const;
bool CheckUSCDiff(const std::vector<DimmNamespace> &dimm_namespaces) const;

int ReadRecordedUSC(const std::string &usc_file_path) const;

Expand Down

0 comments on commit 1dd97e6

Please sign in to comment.