EXSWCPHIPT-125 - Add tests for hipGetDeviceCount and restructure some SpawnProc tests (#2765)
This commit is contained in:
@@ -23,6 +23,7 @@ THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <hip_test_common.hh>
|
||||
#include <hip_test_process.hh>
|
||||
|
||||
/**
|
||||
* hipGetDeviceCount tests
|
||||
@@ -32,3 +33,25 @@ TEST_CASE("Unit_hipGetDeviceCount_NegTst") {
|
||||
// Scenario1
|
||||
REQUIRE_FALSE(hipGetDeviceCount(nullptr) == hipSuccess);
|
||||
}
|
||||
|
||||
TEST_CASE("Unit_hipGetDeviceCount_HideDevices") {
|
||||
int deviceCount = HipTest::getDeviceCount();
|
||||
if (deviceCount < 2) {
|
||||
HipTest::HIP_SKIP_TEST("This test requires more than 2 GPUs. Skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = deviceCount; i >= 1; i--) {
|
||||
std::string visibleStr;
|
||||
for (int j = 0; j < i; j++) { // Generate a string which has first i devices
|
||||
visibleStr += std::to_string(j);
|
||||
if (j != (i - 1)) {
|
||||
visibleStr += ",";
|
||||
}
|
||||
}
|
||||
|
||||
hip::SpawnProc proc("getDeviceCount", true);
|
||||
INFO("Output from process : " << proc.getOutput());
|
||||
REQUIRE(proc.run(visibleStr) == i);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user