Skip to content

Commit

Permalink
guess test case
Browse files Browse the repository at this point in the history
  • Loading branch information
osalyk committed Jul 19, 2024
1 parent 5be3af9 commit b82cd1d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/tests/ras/us_remote_agent/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ int main(int argc, char **argv) {
} else if (std::string{"check-safe"}.compare(action) == 0) {
return inject_mgmt.IsLastShutdownSafe(dimm_colls) ? 0 : 1;

} else if (std::string{"check-unsafe"}.compare(action) == 0) {
return inject_mgmt.IsLastShutdownUnsafe(dimm_colls) ? 0 : 1;
// } else if (std::string{"check-unsafe"}.compare(action) == 0) {
// return inject_mgmt.IsLastShutdownUnsafe(dimm_colls) ? 0 : 1;

} else if (std::string{"cleanup"}.compare(action) == 0) {
return CleanUp(test_dir, mountpoint_args);
Expand Down
24 changes: 12 additions & 12 deletions src/tests/ras/utils/inject_manager/inject_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -145,18 +145,18 @@ InjectManager::InjectManager(std::string test_dir, std::string policy) {
test_dir_ = test_dir;
}

bool InjectManager::IsLastShutdownUnsafe(
const std::vector<DimmNamespace> &dimm_namespaces) const {
std::function<bool(int, int)> compare = [](int rec, int cur) -> bool {
return cur > rec;
};

if (!CheckUSCDiff(dimm_namespaces, compare)) {
std::cerr << "Unexpected safe shutdown of NVDIMM" << std::endl;
return false;
}
return true;
}
// bool InjectManager::IsLastShutdownUnsafe(
// const std::vector<DimmNamespace> &dimm_namespaces) const {
// std::function<bool(int, int)> compare = [](int rec, int cur) -> bool {
// return cur > rec;
// };

// if (!CheckUSCDiff(dimm_namespaces, compare)) {
// std::cerr << "Unexpected safe shutdown of NVDIMM" << std::endl;
// return false;
// }
// return true;
// }

bool InjectManager::IsLastShutdownSafe(
const std::vector<DimmNamespace> &dimm_namespaces) const {
Expand Down
4 changes: 2 additions & 2 deletions src/tests/ras/utils/inject_manager/inject_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ class InjectManager {

InjectManager(std::string test_dir, std::string policy);

bool IsLastShutdownUnsafe(
const std::vector<DimmNamespace> &dimm_namespaces) const;
// bool IsLastShutdownUnsafe(
// const std::vector<DimmNamespace> &dimm_namespaces) const;
bool IsLastShutdownSafe(
const std::vector<DimmNamespace> &dimm_namespaces) const;
int RecordUSC(const std::vector<DimmNamespace> &dimm_namespaces) const;
Expand Down
3 changes: 1 addition & 2 deletions src/tests/ras/utils/test_phase/local_test_phase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ int LocalTestPhase::Inject() const {

int LocalTestPhase::CheckUSC() const {
InjectManager inject_mgmt{config_.GetTestDir(), policy_};
if (inject_mgmt.IsLastShutdownSafe(safe_namespaces) &&
inject_mgmt.IsLastShutdownUnsafe(unsafe_namespaces)) {
if (inject_mgmt.IsLastShutdownSafe(safe_namespaces)) {
return 0;
}
return -1;
Expand Down

0 comments on commit b82cd1d

Please sign in to comment.