Cleanup rocm_smi.cc

Change-Id: Ia676c237222b0dd5d9e8a054a93776f3b11e2225
Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>
This commit is contained in:
Galantsev, Dmitrii
2023-08-31 11:34:58 -05:00
کامیت شده توسط Dmitrii Galantsev
والد fab0542ab1
کامیت 4aef767596
19فایلهای تغییر یافته به همراه483 افزوده شده و 622 حذف شده
@@ -108,14 +108,12 @@ static void RunCustomTestProlog(TestBase *test) {
}
test->SetUp();
test->Run();
return;
}
static void RunCustomTestEpilog(TestBase *tst) {
if (sRSMIGlvalues->verbosity >= TestBase::VERBOSE_STANDARD) {
tst->DisplayResults();
}
tst->Close();
return;
}
// If the test case one big test, you should use RunGenericTest()
@@ -127,7 +125,6 @@ static void RunCustomTestEpilog(TestBase *tst) {
static void RunGenericTest(TestBase *test) {
RunCustomTestProlog(test);
RunCustomTestEpilog(test);
return;
}
// TEST ENTRY TEMPLATE:
@@ -43,7 +43,7 @@
*
*/
#include <assert.h>
#include <cassert>
#include "rocm_smi/rocm_smi.h"
#include "rocm_smi_test/test_base.h"
@@ -61,10 +61,9 @@ static const char kResultsLabel[] = "TEST RESULTS";
// This one is used outside this file
const char kSetupLabel[] = "TEST SETUP";
TestBase::TestBase() : setup_failed_(false), description_("") {
}
TestBase::~TestBase() {
TestBase::TestBase() : setup_failed_(false) {
}
TestBase::~TestBase() = default;
void TestBase::MakeHeaderStr(const char *inStr,
std::string *outStr) const {
@@ -116,8 +115,6 @@ void TestBase::SetUp(uint64_t init_flags) {
std::cout << "No ROCm SMI tests can be run." << std::endl;
}
}
return;
}
void TestBase::PrintDeviceHeader(uint32_t dv_ind) {
@@ -213,7 +210,7 @@ void TestBase::set_description(std::string d) {
size_t endlptr;
for (size_t i = le; i < description_.size(); i += le) {
endlptr = description_.find_last_of(" ", i);
endlptr = description_.find_last_of(' ', i);
description_.replace(endlptr, 1, "\n");
i = endlptr;
}
@@ -45,6 +45,7 @@
#ifndef TESTS_ROCM_SMI_TEST_TEST_BASE_H_
#define TESTS_ROCM_SMI_TEST_TEST_BASE_H_
#include <cstdint>
#include <string>
class TestBase {
@@ -142,9 +143,8 @@ class TestBase {
"\t===> Abort is over-ridden due to dont_fail command line option." \
<< std::endl; \
return; \
} else { \
ASSERT_EQ(RSMI_STATUS_SUCCESS, (RET)); \
} \
ASSERT_EQ(RSMI_STATUS_SUCCESS, (RET)); \
}
void MakeHeaderStr(const char *inStr, std::string *outStr);
@@ -43,13 +43,13 @@
*
*/
#include <assert.h>
#include <stdint.h>
#include <getopt.h>
#include <cassert>
#include <cstdint>
#include <iostream>
#include <string>
#include <map>
#include <string>
#include "rocm_smi_test/test_base.h"
#include "rocm_smi_test/test_common.h"
@@ -74,7 +74,7 @@ void DumpMonitorInfo(const TestBase *test);
#endif
#define DISPLAY_RSMI_ERR(RET) { \
if (RET != RSMI_STATUS_SUCCESS) { \
if ((RET) != RSMI_STATUS_SUCCESS) { \
const char *err_str; \
std::cout << "\t===> ERROR: RSMI call returned " << (RET) << std::endl; \
rsmi_status_string((RET), &err_str); \
@@ -91,7 +91,7 @@ void DumpMonitorInfo(const TestBase *test);
} \
}
#define CHK_RSMI_PERM_ERR(RET) { \
if (RET == RSMI_STATUS_PERMISSION) { \
if ((RET) == RSMI_STATUS_PERMISSION) { \
std::cout << "This command requires root access." << std::endl; \
} else { \
DISPLAY_RSMI_ERR(RET) \