Add read fan values and associated tests

Change-Id: I89322e93d5f3110adace15e5a576f00d4934be79
此提交包含在:
Chris Freehill committed 2020-08-17 14:07:25 -05:00
1 父節點 02c6d3fb4d
當前提交 4729c47866
12 file changed
+379 -11

No files matched your search

+3 -2
查看文件
@@ -44,10 +44,11 @@ endif()
# Required Defines first:
set(RDC_INC_DIR ${ROCM_DIR}/rdc/include)
set(RDC_LIB_DIR ${ROCM_DIR}/rdc/lib)
set(RDC_INC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../client/include)
set(RDC_LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../rdc/lib)
set(RSMI_INC_DIR ${ROCM_DIR}/rocm_smi/include)
#
# Determine RDC Header files are present
# (no external source dependencies)
+108
查看文件
@@ -0,0 +1,108 @@
/*
Copyright (c) 2020 - Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include <stdint.h>
#include <stddef.h>
#include <iostream>
#include "gtest/gtest.h"
#include "rdc/rdc_client.h"
#include "rdc_tests/functional/fan_read.h"
#include "rdc_tests/test_common.h"
TestFanRead::TestFanRead() : TestBase() {
set_title("RDC Fan Read Test");
set_description("The Fan Read tests verifies that the fan monitors can be "
"read properly.");
}
TestFanRead::~TestFanRead(void) {
}
void TestFanRead::SetUp(void) {
TestBase::SetUp();
return;
}
void TestFanRead::DisplayTestInfo(void) {
TestBase::DisplayTestInfo();
}
void TestFanRead::DisplayResults(void) const {
TestBase::DisplayResults();
return;
}
void TestFanRead::Close() {
TestBase::Close();
}
void TestFanRead::Run(void) {
uint64_t val_ui64;
rdc_status_t err;
int64_t val_i64;
TestBase::Run();
err = AllocateRDCChannel();
ASSERT_EQ(err, RDC_STATUS_SUCCESS);
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
PrintDeviceHeader(i);
IF_VERB(STANDARD) {
std::cout << "\t**Current Fan Speed: ";
}
err = rdc_dev_fan_speed_get(rdc_channel(), i, 0, &val_i64);
CHK_ERR_ASRT(err)
// Verify api support checking functionality is working
err = rdc_dev_fan_speed_get(rdc_channel(), i, 0, nullptr);
ASSERT_EQ(err, RDC_RSMI_STATUS_INVALID_ARGS);
err = rdc_dev_fan_speed_max_get(rdc_channel(), i, 0, &val_ui64);
CHK_ERR_ASRT(err)
IF_VERB(STANDARD) {
std::cout << val_i64/static_cast<float>(val_ui64)*100;
std::cout << "% ("<< val_i64 << "/" << val_ui64 << ")" << std::endl;
}
// Verify api support checking functionality is working
err = rdc_dev_fan_speed_max_get(rdc_channel(), i, 0, nullptr);
ASSERT_EQ(err, RDC_RSMI_STATUS_INVALID_ARGS);
IF_VERB(STANDARD) {
std::cout << "\t**Current fan RPMs: ";
}
err = rdc_dev_fan_rpms_get(rdc_channel(), i, 0, &val_i64);
CHK_ERR_ASRT(err)
IF_VERB(STANDARD) {
std::cout << val_i64 << std::endl;
}
// Verify api support checking functionality is working
err = rdc_dev_fan_rpms_get(rdc_channel(), i, 0, nullptr);
ASSERT_EQ(err, RDC_RSMI_STATUS_INVALID_ARGS);
}
}
+50
查看文件
@@ -0,0 +1,50 @@
/*
Copyright (c) 2020 - Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef TESTS_RDC_TESTS_FUNCTIONAL_FAN_READ_H_
#define TESTS_RDC_TESTS_FUNCTIONAL_FAN_READ_H_
#include "rdc_tests/test_base.h"
class TestFanRead : public TestBase {
public:
TestFanRead();
// @Brief: Destructor for test case of TestFanRead
virtual ~TestFanRead();
// @Brief: Setup the environment for measurement
virtual void SetUp();
// @Brief: Core measurement execution
virtual void Run();
// @Brief: Clean up and retrive the resource
virtual void Close();
// @Brief: Display results
virtual void DisplayResults() const;
// @Brief: Display information about what this test does
virtual void DisplayTestInfo(void);
};
#endif // TESTS_RDC_TESTS_FUNCTIONAL_FAN_READ_H_
+1 -3
查看文件
@@ -37,7 +37,7 @@ static const std::map<uint32_t, std::string> kTempSensorNameMap = {
{RSMI_TEMP_TYPE_EDGE, "Edge"},
};
TestTempRead::TestTempRead() : TestBase() {
set_title("RSMI Temp Read Test");
set_title("RDC Temp Read Test");
set_description("The Temperature Read tests verifies that the temperature "
"monitors can be read properly.");
}
@@ -61,8 +61,6 @@ void TestTempRead::DisplayResults(void) const {
}
void TestTempRead::Close() {
// This will close handles opened within rsmitst utility calls and call
// rsmi_shut_down(), so it should be done after other hsa cleanup
TestBase::Close();
}
+3 -3
查看文件
@@ -19,8 +19,8 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_TEMP_READ_H_
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_TEMP_READ_H_
#ifndef TESTS_RDC_TESTS_FUNCTIONAL_TEMP_READ_H_
#define TESTS_RDC_TESTS_FUNCTIONAL_TEMP_READ_H_
#include "rdc_tests/test_base.h"
@@ -47,4 +47,4 @@ class TestTempRead : public TestBase {
virtual void DisplayTestInfo(void);
};
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_TEMP_READ_H_
#endif // TESTS_RDC_TESTS_FUNCTIONAL_TEMP_READ_H_
+6
查看文件
@@ -36,6 +36,7 @@ THE SOFTWARE.
#include "functional/id_info_read.h"
#include "functional/temp_read.h"
#include "functional/fan_read.h"
static RDCTstGlobals *sRDCGlvalues = nullptr;
@@ -91,6 +92,11 @@ TEST(rdctstReadOnly, TestTempRead) {
TestTempRead tst;
RunGenericTest(&tst);
}
TEST(rdctstReadOnly, FanRead) {
TestFanRead tst;
RunGenericTest(&tst);
}
static int getPIDFromName(std::string name) {
int pid = -1;