From 1c9ef4439848faa9d14a998a216f526e613f5f34 Mon Sep 17 00:00:00 2001 From: Chris Freehill Date: Thu, 9 Apr 2020 15:55:02 -0500 Subject: [PATCH] Add checking for no-longer-existing process in test When getting process information for a process, it's possible that between the time the process ID was discovered and when we attempt to collect data for that process, that the process ended. This change is meant to handle that in the test case. * Also, fix compile warning by removing unused variable. Change-Id: I62f9a84a63548c856f0661fef15b7d248a330c05 --- tests/rocm_smi_test/functional/process_info_read.cc | 11 ++++++++--- tests/rocm_smi_test/main.cc | 1 - 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/rocm_smi_test/functional/process_info_read.cc b/tests/rocm_smi_test/functional/process_info_read.cc index 31afae910a..8fc5582ee6 100755 --- a/tests/rocm_smi_test/functional/process_info_read.cc +++ b/tests/rocm_smi_test/functional/process_info_read.cc @@ -166,9 +166,14 @@ void TestProcInfoRead::Run(void) { for (uint32_t j = 0; j < num_proc_found; j++) { err = rsmi_compute_process_gpus_get(procs[j].process_id, dev_inds, &amt_allocd); - CHK_ERR_ASRT(err) - ASSERT_LE(amt_allocd, num_devices); - + if (err == RSMI_STATUS_NOT_FOUND) { + std::cout << "\t**Process " << procs[j].process_id << + " is no longer present."; + continue; + } else { + CHK_ERR_ASRT(err); + ASSERT_LE(amt_allocd, num_devices); + } std::cout << "\t**Process " << procs[j].process_id << " is using devices with indices: "; uint32_t i; diff --git a/tests/rocm_smi_test/main.cc b/tests/rocm_smi_test/main.cc index ed1891da05..c8ca0171bb 100755 --- a/tests/rocm_smi_test/main.cc +++ b/tests/rocm_smi_test/main.cc @@ -249,7 +249,6 @@ int main(int argc, char** argv) { return 1; } - int ret = 0; sRSMIGlvalues = &settings; return RUN_ALL_TESTS(); }