Fixing profiler API test

Change-Id: Ie9b473f5e20b41a73c16d2d7218395fee116ad1d
This commit is contained in:
gobhardw
2023-05-30 21:13:35 +05:30
committed by Ammar ELWazir
parent 08fc21ac31
commit 54222bb4ae
+16 -6
View File
@@ -27,6 +27,7 @@ THE SOFTWARE.
#include <hip/hip_runtime.h>
#include "rocprofiler.h"
#include <cstdlib>
#include <string>
#include <thread>
#include <array>
@@ -815,8 +816,23 @@ TEST_F(ATTCollection, WhenRunningATTItCollectsTraceData) {
// empty kernel
__global__ void kernel() {}
void __attribute__((constructor)) globalsetting() {
init_test_path();
std::string app_path = GetRunningPath(running_path);
std::stringstream gfx_path;
gfx_path << app_path << metrics_path;
std::cout << gfx_path.str() << std::endl;
setenv("ROCPROFILER_METRICS_PATH", gfx_path.str().c_str(), true);
}
class ProfilerAPITest : public ::testing::Test {
protected:
void SetUp() {
std::string app_path = GetRunningPath(running_path);
std::stringstream gfx_path;
gfx_path << app_path << metrics_path;
setenv("ROCPROFILER_METRICS_PATH", gfx_path.str().c_str(), true);
}
// function to check profiler API status
static void CheckApi(rocprofiler_status_t status) {
ASSERT_EQ(status, ROCPROFILER_STATUS_SUCCESS);
@@ -863,12 +879,6 @@ TEST_F(ProfilerAPITest, WhenRunningMultipleThreadsProfilerAPIsWorkFine) {
// set global path
init_test_path();
std::string app_path = GetRunningPath(running_path);
std::stringstream gfx_path;
gfx_path << app_path << metrics_path;
setenv("ROCPROFILER_METRICS_PATH", gfx_path.str().c_str(), true);
// Get the system cores
int num_cpu_cores = GetNumberOfCores();