Revert "[SWDEV-514998/SWDEV-511662] Fix tests for Guest and BM with static CPX config" (#25)

* Revert - this reverts commit a73e47591c7ea0ed5a7fc217211872d74be64206.

* Revert "[SWDEV-514998/SWDEV-511662] Fix tests for Guest and BM with static CPX config"

This reverts commit 5a71fd9d75d4d6a9bdd7fa3e652eeb12336a1d6a.
This commit is contained in:
Poag, Charis
2025-03-09 13:46:51 -05:00
committad av Charis Poag
förälder d953b2ce66
incheckning 08fee73075
@@ -204,9 +204,9 @@ static void checkPartitionIdChanges(
std::cout << "\t** Checking Partition ID | Device: " << std::to_string(i) std::cout << "\t** Checking Partition ID | Device: " << std::to_string(i)
<< "; Current Partition: " << current_partition << "; Current Partition: " << current_partition
<< " ; Max partition IDs to check: " << max_loop << "\n"; << " ; Max partition IDs to check: " << max_loop << "\n";
EXPECT_EQ(ret, RSMI_STATUS_SUCCESS); ASSERT_EQ(ret, RSMI_STATUS_SUCCESS);
if (ret == RSMI_STATUS_SUCCESS && current_partition == "SPX") { if (ret == RSMI_STATUS_SUCCESS && current_partition == "SPX") {
EXPECT_LT(partition_id, max_loop); ASSERT_LT(partition_id, max_loop);
if (isVerbose) { if (isVerbose) {
std::cout << "\n\t**Confirmed partition_id < " << max_loop std::cout << "\n\t**Confirmed partition_id < " << max_loop
<< " for SPX" << " for SPX"
@@ -215,7 +215,7 @@ static void checkPartitionIdChanges(
<< static_cast<uint32_t>(partition_id) << std::endl; << static_cast<uint32_t>(partition_id) << std::endl;
} }
} else if (ret == RSMI_STATUS_SUCCESS && current_partition == "DPX") { } else if (ret == RSMI_STATUS_SUCCESS && current_partition == "DPX") {
EXPECT_LT(partition_id, max_loop); ASSERT_LT(partition_id, max_loop);
if (isVerbose) { if (isVerbose) {
std::cout << "\n\t**Confirmed partition_id < " << max_loop std::cout << "\n\t**Confirmed partition_id < " << max_loop
<< " for DPX" << " for DPX"
@@ -224,7 +224,7 @@ static void checkPartitionIdChanges(
<< static_cast<uint32_t>(partition_id) << std::endl; << static_cast<uint32_t>(partition_id) << std::endl;
} }
} else if (ret == RSMI_STATUS_SUCCESS && current_partition == "TPX") { } else if (ret == RSMI_STATUS_SUCCESS && current_partition == "TPX") {
EXPECT_LT(partition_id, max_loop); ASSERT_LT(partition_id, max_loop);
if (isVerbose) { if (isVerbose) {
std::cout << "\n\t**Confirmed partition_id < " std::cout << "\n\t**Confirmed partition_id < "
<< max_loop << " for TPX" << max_loop << " for TPX"
@@ -233,7 +233,7 @@ static void checkPartitionIdChanges(
<< static_cast<uint32_t>(partition_id) << std::endl; << static_cast<uint32_t>(partition_id) << std::endl;
} }
} else if (ret == RSMI_STATUS_SUCCESS && current_partition == "QPX") { } else if (ret == RSMI_STATUS_SUCCESS && current_partition == "QPX") {
EXPECT_LT(partition_id, max_loop); ASSERT_LT(partition_id, max_loop);
if (isVerbose) { if (isVerbose) {
std::cout << "\n\t**Confirmed partition_id < " std::cout << "\n\t**Confirmed partition_id < "
<< max_loop << " for QPX" << max_loop << " for QPX"
@@ -242,7 +242,7 @@ static void checkPartitionIdChanges(
<< static_cast<uint32_t>(partition_id) << std::endl; << static_cast<uint32_t>(partition_id) << std::endl;
} }
} else if (ret == RSMI_STATUS_SUCCESS && current_partition == "CPX") { } else if (ret == RSMI_STATUS_SUCCESS && current_partition == "CPX") {
EXPECT_LT(partition_id, max_loop); ASSERT_LT(partition_id, max_loop);
if (isVerbose) { if (isVerbose) {
std::cout << "\n\t**Confirmed partition_id < " std::cout << "\n\t**Confirmed partition_id < "
<< max_loop << " for CPX" << max_loop << " for CPX"
@@ -251,7 +251,7 @@ static void checkPartitionIdChanges(
<< static_cast<uint32_t>(partition_id) << std::endl; << static_cast<uint32_t>(partition_id) << std::endl;
} }
} else if (ret == RSMI_STATUS_SUCCESS && current_partition == "UNKNOWN") { } else if (ret == RSMI_STATUS_SUCCESS && current_partition == "UNKNOWN") {
EXPECT_EQ(partition_id, max_loop - 1); ASSERT_EQ(partition_id, max_loop - 1);
if (isVerbose) { if (isVerbose) {
std::cout << "\n\t**Confirmed partition_id = " std::cout << "\n\t**Confirmed partition_id = "
<< (max_loop - 1) << (max_loop - 1)
@@ -303,7 +303,7 @@ void TestComputePartitionReadWrite::Run(void) {
bool devicePartitionUpdated = false; bool devicePartitionUpdated = false;
ret = rsmi_dev_partition_id_get(dv_ind, nullptr); ret = rsmi_dev_partition_id_get(dv_ind, nullptr);
EXPECT_EQ(ret, RSMI_STATUS_INVALID_ARGS); ASSERT_EQ(ret, RSMI_STATUS_INVALID_ARGS);
IF_VERB(STANDARD) { IF_VERB(STANDARD) {
if (ret == RSMI_STATUS_INVALID_ARGS) { if (ret == RSMI_STATUS_INVALID_ARGS) {
std::cout << "\t**" << "Confirmed rsmi_dev_partition_id_get(..,nullptr): " std::cout << "\t**" << "Confirmed rsmi_dev_partition_id_get(..,nullptr): "
@@ -351,15 +351,15 @@ void TestComputePartitionReadWrite::Run(void) {
"Skip compute partition test." << std::endl; "Skip compute partition test." << std::endl;
continue; continue;
} }
EXPECT_EQ(RSMI_STATUS_SUCCESS, ret); ASSERT_EQ(RSMI_STATUS_SUCCESS, ret);
// Verify api support checking functionality is working // Verify api support checking functionality is working
uint32_t kLength = 2; uint32_t kLength = 2;
char smallBuffer[kLength]; char smallBuffer[kLength];
err = rsmi_dev_compute_partition_get(dv_ind, smallBuffer, kLength); err = rsmi_dev_compute_partition_get(dv_ind, smallBuffer, kLength);
size_t size = sizeof(smallBuffer)/sizeof(*smallBuffer); size_t size = sizeof(smallBuffer)/sizeof(*smallBuffer);
EXPECT_EQ(err, RSMI_STATUS_INSUFFICIENT_SIZE); ASSERT_EQ(err, RSMI_STATUS_INSUFFICIENT_SIZE);
EXPECT_EQ((size_t)kLength, size); ASSERT_EQ((size_t)kLength, size);
IF_VERB(STANDARD) { IF_VERB(STANDARD) {
if (err == RSMI_STATUS_INSUFFICIENT_SIZE) { if (err == RSMI_STATUS_INSUFFICIENT_SIZE) {
std::cout << "\t**" std::cout << "\t**"
@@ -370,7 +370,7 @@ void TestComputePartitionReadWrite::Run(void) {
// Verify api support checking functionality is working // Verify api support checking functionality is working
err = rsmi_dev_compute_partition_get(dv_ind, nullptr, 255); err = rsmi_dev_compute_partition_get(dv_ind, nullptr, 255);
EXPECT_EQ(err, RSMI_STATUS_INVALID_ARGS); ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
IF_VERB(STANDARD) { IF_VERB(STANDARD) {
if (err == RSMI_STATUS_INVALID_ARGS) { if (err == RSMI_STATUS_INVALID_ARGS) {
std::cout << "\t**" std::cout << "\t**"
@@ -381,7 +381,7 @@ void TestComputePartitionReadWrite::Run(void) {
// Verify api support checking functionality is working // Verify api support checking functionality is working
err = rsmi_dev_compute_partition_get(dv_ind, orig_char_computePartition, 0); err = rsmi_dev_compute_partition_get(dv_ind, orig_char_computePartition, 0);
EXPECT_TRUE((err == RSMI_STATUS_INVALID_ARGS) || ASSERT_TRUE((err == RSMI_STATUS_INVALID_ARGS) ||
(err == RSMI_STATUS_NOT_SUPPORTED)); (err == RSMI_STATUS_NOT_SUPPORTED));
IF_VERB(STANDARD) { IF_VERB(STANDARD) {
if (err == RSMI_STATUS_INVALID_ARGS) { if (err == RSMI_STATUS_INVALID_ARGS) {
@@ -394,7 +394,7 @@ void TestComputePartitionReadWrite::Run(void) {
// Re-run original get, so we can reset to later // Re-run original get, so we can reset to later
ret = rsmi_dev_compute_partition_get(dv_ind, orig_char_computePartition, ret = rsmi_dev_compute_partition_get(dv_ind, orig_char_computePartition,
255); 255);
EXPECT_EQ(RSMI_STATUS_SUCCESS, ret); ASSERT_EQ(RSMI_STATUS_SUCCESS, ret);
std::cout << "\t**rsmi_dev_compute_partition_get(" << dv_ind std::cout << "\t**rsmi_dev_compute_partition_get(" << dv_ind
<< ", " << orig_char_computePartition << ")\n"; << ", " << orig_char_computePartition << ")\n";
@@ -460,21 +460,10 @@ void TestComputePartitionReadWrite::Run(void) {
<< "\t**New Partition (set): " << "\t**New Partition (set): "
<< computePartitionString(updatePartition) << "\n"; << computePartitionString(updatePartition) << "\n";
} }
EXPECT_TRUE(ret == RSMI_STATUS_SETTING_UNAVAILABLE ASSERT_TRUE((ret == RSMI_STATUS_SETTING_UNAVAILABLE)
|| ret== RSMI_STATUS_PERMISSION || (ret== RSMI_STATUS_PERMISSION)
|| ret == RSMI_STATUS_SUCCESS || (ret == RSMI_STATUS_SUCCESS)
|| ret == RSMI_STATUS_BUSY || ret == RSMI_STATUS_BUSY);
|| ret == RSMI_STATUS_NOT_SUPPORTED
|| ret == RSMI_STATUS_INVALID_ARGS);
if (ret == RSMI_STATUS_INVALID_ARGS) {
std::cout << "\t**"
<< "1st Test: Due to invalid args, skipping rest of test for this device."
<< "\n\t Device might be in a static partition mode. "
<< "With inability to change partition modes."
<< std::endl;
break;
}
} }
for (int partition = static_cast<int>(mapStringToRSMIComputePartitionTypes.at( for (int partition = static_cast<int>(mapStringToRSMIComputePartitionTypes.at(
@@ -499,12 +488,10 @@ void TestComputePartitionReadWrite::Run(void) {
<< "\t**New Partition (set): " << "\t**New Partition (set): "
<< computePartitionString(updatePartition) << "\n"; << computePartitionString(updatePartition) << "\n";
} }
EXPECT_TRUE(ret == RSMI_STATUS_SETTING_UNAVAILABLE ASSERT_TRUE((ret == RSMI_STATUS_SETTING_UNAVAILABLE)
|| ret== RSMI_STATUS_PERMISSION || (ret== RSMI_STATUS_PERMISSION)
|| ret == RSMI_STATUS_SUCCESS || (ret == RSMI_STATUS_SUCCESS)
|| ret == RSMI_STATUS_BUSY || ret == RSMI_STATUS_BUSY);
|| ret == RSMI_STATUS_NOT_SUPPORTED
|| ret == RSMI_STATUS_INVALID_ARGS);
if (ret == RSMI_STATUS_BUSY) { if (ret == RSMI_STATUS_BUSY) {
IF_VERB(STANDARD) { IF_VERB(STANDARD) {
@@ -514,17 +501,8 @@ void TestComputePartitionReadWrite::Run(void) {
continue; continue;
} }
if (ret == RSMI_STATUS_INVALID_ARGS) {
std::cout << "\t**"
<< "2nd test: Due to invalid args, skipping rest of test for this device."
<< "\n\t Device might be in a static partition mode. "
<< "With inability to change partition modes."
<< std::endl;
break;
}
bool isSettingUnavailable = false; bool isSettingUnavailable = false;
if (ret == RSMI_STATUS_SETTING_UNAVAILABLE || ret == RSMI_STATUS_INVALID_ARGS) { if (ret == RSMI_STATUS_SETTING_UNAVAILABLE) {
isSettingUnavailable = true; isSettingUnavailable = true;
} }
rsmi_status_t retGet = rsmi_status_t retGet =
@@ -538,20 +516,19 @@ void TestComputePartitionReadWrite::Run(void) {
<< std::endl; << std::endl;
} }
if (isSettingUnavailable) { if (isSettingUnavailable) {
EXPECT_TRUE(ret ==RSMI_STATUS_SETTING_UNAVAILABLE || ret == RSMI_STATUS_INVALID_ARGS); ASSERT_EQ(RSMI_STATUS_SETTING_UNAVAILABLE, ret);
EXPECT_STRNE(computePartitionString(updatePartition).c_str(), ASSERT_STRNE(computePartitionString(updatePartition).c_str(),
current_char_computePartition); current_char_computePartition);
IF_VERB(STANDARD) { IF_VERB(STANDARD) {
std::cout << "\t**" std::cout << "\t**"
<< "Confirmed after receiving " << "Confirmed after receiving "
<< amd::smi::getRSMIStatusString(ret, false) << "RSMI_STATUS_SETTING_UNAVAILABLE,\n\t current compute "
<< ",\n\t current compute "
<< "partition (" << current_char_computePartition << "partition (" << current_char_computePartition
<< ") did not update to (" << ") did not update to ("
<< computePartitionString(updatePartition) << ")" << computePartitionString(updatePartition) << ")"
<< std::endl; << std::endl;
} }
} else if (ret == RSMI_STATUS_SUCCESS) { } else {
if (strcmp(orig_char_computePartition, current_char_computePartition) != if (strcmp(orig_char_computePartition, current_char_computePartition) !=
0) { 0) {
devicePartitionUpdated = true; devicePartitionUpdated = true;
@@ -560,8 +537,8 @@ void TestComputePartitionReadWrite::Run(void) {
devicePartitionUpdated = false; devicePartitionUpdated = false;
} }
EXPECT_EQ(RSMI_STATUS_SUCCESS, ret); ASSERT_EQ(RSMI_STATUS_SUCCESS, ret);
EXPECT_STREQ(computePartitionString(updatePartition).c_str(), ASSERT_STREQ(computePartitionString(updatePartition).c_str(),
current_char_computePartition); current_char_computePartition);
IF_VERB(STANDARD) { IF_VERB(STANDARD) {
std::cout << "\t**" std::cout << "\t**"
@@ -574,28 +551,6 @@ void TestComputePartitionReadWrite::Run(void) {
checkPartitionIdChanges(dv_ind, computePartitionString(updatePartition), checkPartitionIdChanges(dv_ind, computePartitionString(updatePartition),
isVerbose, true); isVerbose, true);
} else {
EXPECT_EQ(RSMI_STATUS_NOT_SUPPORTED, ret);
IF_VERB(STANDARD) {
std::cout << "\t**rsmi_dev_compute_partition_set(" << dv_ind
<< ", " << computePartitionString(updatePartition) << "): "
<< amd::smi::getRSMIStatusString(ret, false)
<< "\n\t**Confirmed after receiving "
<< "RSMI_STATUS_NOT_SUPPORTED, current compute "
<< "partition (" << current_char_computePartition
<< ")\n\tcannot not update to ("
<< computePartitionString(updatePartition) << ")"
<< "; if not already the current partition." << std::endl;
}
checkPartitionIdChanges(dv_ind, std::string(current_char_computePartition),
isVerbose, false);
// on guest this means we can't change partitions
// some partitions will match the original partition
if (amd::smi::is_vm_guest()) {
continue;
}
EXPECT_STRNE(computePartitionString(updatePartition).c_str(),
current_char_computePartition);
} }
} // END looping through partition changes } // END looping through partition changes
std::cout << "\t**=========== END PARTITION LOOP (dev = " std::cout << "\t**=========== END PARTITION LOOP (dev = "
@@ -636,7 +591,7 @@ void TestComputePartitionReadWrite::Run(void) {
<< (devicePartitionUpdated ? "TRUE" : "FALSE") << "\n"; << (devicePartitionUpdated ? "TRUE" : "FALSE") << "\n";
} }
if (devicePartitionUpdated) { if (final_partition_state != std::string(current_char_computePartition)) {
checkPartitionIdChanges(dv_ind, std::string(current_char_computePartition), checkPartitionIdChanges(dv_ind, std::string(current_char_computePartition),
isVerbose, true); isVerbose, true);
} else { } else {
@@ -644,7 +599,7 @@ void TestComputePartitionReadWrite::Run(void) {
isVerbose, false); isVerbose, false);
} }
if (devicePartitionUpdated) { if (devicePartitionUpdated) {
EXPECT_STRNE(oldPartition.c_str(), current_char_computePartition); ASSERT_STRNE(oldPartition.c_str(), current_char_computePartition);
IF_VERB(STANDARD) { IF_VERB(STANDARD) {
std::cout << "\t**" std::cout << "\t**"
<< "Confirmed prior partition (" << oldPartition << ") is not " << "Confirmed prior partition (" << oldPartition << ") is not "
@@ -653,7 +608,7 @@ void TestComputePartitionReadWrite::Run(void) {
} }
final_partition_state = std::string(current_char_computePartition); final_partition_state = std::string(current_char_computePartition);
} else { } else {
EXPECT_STREQ(oldPartition.c_str(), current_char_computePartition); ASSERT_STREQ(oldPartition.c_str(), current_char_computePartition);
IF_VERB(STANDARD) { IF_VERB(STANDARD) {
std::cout << "\t**" std::cout << "\t**"
<< "Confirmed prior partition (" << oldPartition << ") is equal" << "Confirmed prior partition (" << oldPartition << ") is equal"
@@ -673,19 +628,14 @@ void TestComputePartitionReadWrite::Run(void) {
= mapStringToRSMIComputePartitionTypes.at( = mapStringToRSMIComputePartitionTypes.at(
std::string(orig_char_computePartition)); std::string(orig_char_computePartition));
ret = rsmi_dev_compute_partition_set(dv_ind, newPartition); ret = rsmi_dev_compute_partition_set(dv_ind, newPartition);
EXPECT_TRUE(ret == RSMI_STATUS_SETTING_UNAVAILABLE CHK_ERR_ASRT(ret)
|| ret== RSMI_STATUS_PERMISSION
|| ret == RSMI_STATUS_SUCCESS
|| ret == RSMI_STATUS_BUSY
|| ret == RSMI_STATUS_NOT_SUPPORTED
|| ret == RSMI_STATUS_INVALID_ARGS);
IF_VERB(STANDARD) { IF_VERB(STANDARD) {
std::cout << "\t**" std::cout << "\t**"
<< "rsmi_dev_compute_partition_set(" << "rsmi_dev_compute_partition_set("
<< std::to_string(dv_ind) << ", " << std::to_string(dv_ind) << ", "
<< std::string(orig_char_computePartition) << ")" << std::endl; << std::string(orig_char_computePartition) << ")" << std::endl;
std::cout << "\t**" std::cout << "\t**"
<< "Attempting to returning compute partition to: " << "Returning compute partition to: "
<< computePartitionString(newPartition) << std::endl; << computePartitionString(newPartition) << std::endl;
} }
ret = rsmi_dev_compute_partition_get(dv_ind, current_char_computePartition, ret = rsmi_dev_compute_partition_get(dv_ind, current_char_computePartition,
@@ -698,13 +648,13 @@ void TestComputePartitionReadWrite::Run(void) {
<< current_char_computePartition << current_char_computePartition
<< std::endl; << std::endl;
} }
EXPECT_EQ(RSMI_STATUS_SUCCESS, ret); ASSERT_EQ(RSMI_STATUS_SUCCESS, ret);
EXPECT_STREQ(computePartitionString(newPartition).c_str(), ASSERT_STREQ(computePartitionString(newPartition).c_str(),
current_char_computePartition); current_char_computePartition);
// only refresh (rsmi_shut_down() -> rsmi_init(0)) device list // only refresh (rsmi_shut_down() -> rsmi_init(0)) device list
// if there was a partition change // if there was a partition change
if (devicePartitionUpdated) { if (final_partition_state != std::string(current_char_computePartition)) {
checkPartitionIdChanges(dv_ind, computePartitionString(newPartition), checkPartitionIdChanges(dv_ind, computePartitionString(newPartition),
isVerbose, true); isVerbose, true);
} else { } else {