Skip to content

Commit

Permalink
check USCDiff
Browse files Browse the repository at this point in the history
  • Loading branch information
osalyk committed Jul 25, 2024
1 parent b636a12 commit 94e0ae0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/tests/ras/utils/inject_manager/inject_manager.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2018-2023, Intel Corporation
* Copyright 2018-2024, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -108,26 +108,30 @@ const std::vector<Dimm> InjectManager::GetDimmsToInject(
bool InjectManager::CheckUSCDiff(
const std::vector<DimmNamespace> &dimm_namespaces,
std::function<bool(int, int)> compare) const {
bool ret = true;
for (const auto &dn : dimm_namespaces) {
for (const auto &d : GetDimmsToInject(dn)) {
int recorded_usc = ReadRecordedUSC(test_dir_ + d.GetUid());

if (recorded_usc == -1) {
std::cerr << "Could not read USC in DIMM: " << d.GetUid()
<< " with test dir: " << dn.GetTestDir() << std::endl;
return false;
ret = false;
}

if (!compare(recorded_usc, d.GetShutdownCount())) {
std::cerr << "NVDIMM: " << d.GetUid()
<< " (test dir: " << dn.GetTestDir()
<< "). Current USC: " << d.GetShutdownCount()
<< " Last recorded USC: " << recorded_usc << std::endl;
return false;
ret = false;
}
else {
std::cout << " Last recorded USC: " << recorded_usc << std::endl;
}
}
}
return true;
return ret;
}

InjectManager::InjectManager(std::string test_dir, std::string policy) {
Expand Down

0 comments on commit 94e0ae0

Please sign in to comment.