diff --git a/projects/amdsmi/example/amd_smi_drm_example.cc b/projects/amdsmi/example/amd_smi_drm_example.cc index 173d09576a..430651768d 100644 --- a/projects/amdsmi/example/amd_smi_drm_example.cc +++ b/projects/amdsmi/example/amd_smi_drm_example.cc @@ -369,9 +369,9 @@ int main() { if (!num_pages) { printf("\tNo bad pages found.\n"); } else { - amdsmi_retired_page_record_t bad_page_info[num_pages] = {}; + std::vector bad_page_info(num_pages); ret = amdsmi_get_bad_page_info(device_handles[j], &num_pages, - bad_page_info); + bad_page_info.data()); CHK_AMDSMI_RET(ret) for (uint32_t page_it = 0; page_it < num_pages; page_it += 1) { printf(" Page[%d]\n", page_it); diff --git a/projects/amdsmi/example/amd_smi_nodrm_example.cc b/projects/amdsmi/example/amd_smi_nodrm_example.cc index 35059ece90..77690b3ae0 100644 --- a/projects/amdsmi/example/amd_smi_nodrm_example.cc +++ b/projects/amdsmi/example/amd_smi_nodrm_example.cc @@ -252,9 +252,9 @@ int main() { if (!num_pages) { printf("\tNo bad pages found.\n"); } else { - amdsmi_retired_page_record_t bad_page_info[num_pages] = {}; + std::vector bad_page_info(num_pages); ret = amdsmi_get_bad_page_info(device_handles[j], &num_pages, - bad_page_info); + bad_page_info.data()); CHK_AMDSMI_RET(ret) for (uint32_t page_it = 0; page_it < num_pages; page_it += 1) { printf(" Page[%d]\n", page_it); diff --git a/projects/amdsmi/tests/amd_smi_test/CMakeLists.txt b/projects/amdsmi/tests/amd_smi_test/CMakeLists.txt index 87766c521a..c5be99ae21 100644 --- a/projects/amdsmi/tests/amd_smi_test/CMakeLists.txt +++ b/projects/amdsmi/tests/amd_smi_test/CMakeLists.txt @@ -1,6 +1,12 @@ # Required Defines first: option(INSTALL_GTEST "Install GTest (only useful if GTest is not already installed)" OFF) +# Help tests find libraries at runtime +set(CMAKE_EXE_LINKER_FLAGS "-Wl,--enable-new-dtags") +set(CMAKE_INSTALL_RPATH + "\$ORIGIN:\$ORIGIN/../../../lib" + CACHE STRING "RUNPATH for tests. Helps find libgtest.so and libamd_smi.so") + # Try to find googletest find_package(GTest 1.11.0) @@ -58,7 +64,9 @@ add_executable(${TEST} ${tstSources} ${functionalSources}) target_link_libraries(${TEST} amd_smi c stdc++ pthread GTest::gtest_main) +# Install tests and gtest +# TODO: Remove GTest from here in the future and rely on INSTALL_GTEST? install( - TARGETS ${TEST} + TARGETS ${TEST} gtest gtest_main DESTINATION ${SHARE_INSTALL_PREFIX}/tests/amd_smi COMPONENT tests)