Adding Integration tests for later building option (#126)

* Adding Integeration tests for later building option

* Update CMakeLists.txt

---------

Co-authored-by: Ammar ELWazir <aelwazir@amd.com>
This commit is contained in:
Elwazir, Ammar
2025-06-23 16:53:17 -05:00
committed by GitHub
parent af750616db
commit e4bb0df9d5
17 changed files with 44 additions and 25 deletions
+17 -6
View File
@@ -12,9 +12,9 @@ include(GNUInstallDirs)
## Adding default path cmake modules
list ( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules" )
## Include common cmake modules
include ( utils )
include (utils)
## Set build environment
include ( env )
include (env)
set(CMAKE_INSTALL_LIBDIR "lib" CACHE STRING "Library install directory")
@@ -65,6 +65,13 @@ set ( TEST_BINARY_DIR ${PROJECT_BINARY_DIR}/test )
add_subdirectory ( ${TEST_DIR} ${TEST_BINARY_DIR} )
endif()
if(AQLPROFILE_INSTALL_TESTS)
# Install Integration Tests
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test/integration/
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/tests/integration
COMPONENT tests)
endif()
## Add the install directives for the runtime library.
set ( DEST_NAME ${AQLPROFILE_NAME} )
install ( TARGETS ${AQLPROFILE_TARGET} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT runtime )
@@ -72,12 +79,16 @@ install ( TARGETS ${AQLPROFILE_TARGET} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDI
## Add the packaging directives for the runtime library.
if ( ENABLE_ASAN_PACKAGING )
set ( CPACK_PACKAGE_NAME ${AQLPROFILE_NAME}-asan )
set (CPACK_PACKAGE_NAME ${AQLPROFILE_NAME}-asan)
# ASAN Package requires only asan component with libraries and license file
set ( CPACK_COMPONENTS_ALL asan )
set (CPACK_COMPONENTS_ALL asan )
else()
set ( CPACK_PACKAGE_NAME ${AQLPROFILE_NAME} )
set ( CPACK_COMPONENTS_ALL runtime tests )
set (CPACK_PACKAGE_NAME ${AQLPROFILE_NAME})
set (CPACK_COMPONENTS_ALL runtime)
# Add tests component if INSTALL_TESTS is enabled
if(AQLPROFILE_INSTALL_TESTS)
list(APPEND CPACK_COMPONENTS_ALL tests)
endif()
endif()
set ( CPACK_PACKAGE_VENDOR "Advanced Micro Devices, Inc." )
set ( CPACK_PACKAGE_VERSION_MAJOR ${BUILD_VERSION_MAJOR} )
+1 -1
View File
@@ -25,7 +25,7 @@ set ( LIB_SRC
)
add_library ( ${TARGET_LIB} SHARED ${LIB_SRC} )
target_include_directories ( ${TARGET_LIB} PRIVATE ${LIB_DIR} ${API_PATH})
target_include_directories ( ${TARGET_LIB} PRIVATE ${LIB_DIR} ${API_PATH} ${LIB_DIR}/core/include)
target_link_libraries( ${TARGET_LIB} PRIVATE pthread hsa-runtime64::hsa-runtime64 )
## Generating definitions
+1 -1
View File
@@ -21,7 +21,7 @@
// THE SOFTWARE.
#include "core/aql_profile.hpp"
#include "core/include/aql_profile_v2.h"
#include "aqlprofile-sdk/aql_profile_v2.h"
#include <cstdint>
#include <future>
+1 -1
View File
@@ -27,7 +27,7 @@
#include <iostream>
#include <string>
#include "include/aql_profile_v2.h"
#include "aqlprofile-sdk/aql_profile_v2.h"
#include "core/aql_profile_exception.h"
+1 -1
View File
@@ -21,7 +21,7 @@
// THE SOFTWARE.
#include "core/aql_profile.hpp"
#include "core/include/aql_profile_v2.h"
#include "aqlprofile-sdk/aql_profile_v2.h"
#include <array>
#include <cstddef>
+1 -1
View File
@@ -1,5 +1,5 @@
set(AQLPROFILE_HEADER_FILES
aql_profile_v2.h
aqlprofile-sdk/aql_profile_v2.h
)
install(
+1 -1
View File
@@ -26,7 +26,7 @@
#include <mutex>
#include <unordered_map>
#include <memory>
#include "include/aql_profile_v2.h"
#include "aqlprofile-sdk/aql_profile_v2.h"
#include <stdexcept>
#include "pm4/trace_config.h"
+1 -1
View File
@@ -34,7 +34,7 @@
#include <sstream>
#include <string>
#include "core/include/aql_profile_v2.h"
#include "aqlprofile-sdk/aql_profile_v2.h"
#include "core/aql_profile.hpp"
#include "core/aql_profile_exception.h"
#include "def/gpu_block_info.h"
+3
View File
@@ -1,3 +1,6 @@
cmake_minimum_required(VERSION 3.16.0)
project(aqlprofile-sdk-tests)
# write a CMakeLists.txt file for the gfx9_factory_test
# that includes the necessary libraries and sets the properties for the test
include(GoogleTest)
+5 -5
View File
@@ -23,7 +23,7 @@
#include <gtest/gtest.h>
#include <gmock/gmock.h>
#include <hsa/hsa.h>
#include "core/include/aql_profile_v2.h"
#include "aqlprofile-sdk/aql_profile_v2.h"
// Mocks and helpers
namespace {
@@ -94,7 +94,7 @@ TEST(CountersTest, DeletePackets) {
hsa_status_t status = aqlprofile_pmc_create_packets(
&handle, &packets, profile, mock_alloc, mock_dealloc, mock_memcpy, &mem);
// Only proceed if creation succeeded
if (status == HSA_STATUS_SUCCESS) {
// This should not crash or throw
@@ -106,13 +106,13 @@ TEST(CountersTest, DeletePackets) {
TEST(CountersTest, ValidateEvent) {
aqlprofile_agent_handle_t agent = {};
agent.handle = 0;
aqlprofile_pmc_event_t event = {};
event.block_name = HSA_VEN_AMD_AQLPROFILE_BLOCK_NAME_GRBM;
bool result = true;
hsa_status_t status = aqlprofile_validate_pmc_event(agent, &event, &result);
// In a mock environment, we can't guarantee validation, but we can check that it runs
EXPECT_TRUE(status == HSA_STATUS_SUCCESS || status == HSA_STATUS_ERROR);
}
+1 -1
View File
@@ -21,7 +21,7 @@
// THE SOFTWARE.
#include "core/aql_profile.hpp"
#include "core/include/aql_profile_v2.h"
#include "aqlprofile-sdk/aql_profile_v2.h"
#include <cstdint>
#include <future>
+6 -2
View File
@@ -7,8 +7,11 @@ if ( NOT DEFINED TEST_DIR )
set ( TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR} )
set ( TEST_BINARY_DIR ${CMAKE_BINARY_DIR} )
project ( ${EXE_NAME} )
list ( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmake_modules" )
## Set build environment
include ( env )
enable_testing()
include(CTest)
endif ()
## Util sources
@@ -83,7 +86,8 @@ install(FILES ${TEST_DIR}/run_install.sh RENAME run_tests.sh
add_test(NAME legacy-tests COMMAND "${TEST_BINARY_DIR}/run.sh")
if(AQLPROFILE_BUILD_TESTS)
option(AQLPROFILE_BUILD_INTEGERATION_TESTS "Build integration tests" ON)
if(AQLPROFILE_BUILD_INTEGERATION_TESTS)
add_subdirectory(integration)
enable_testing()
endif()
+1 -1
View File
@@ -22,7 +22,7 @@
#include "hsa/hsa_ext_amd.h"
#include "aql_profile_v2.h"
#include "aqlprofile-sdk/aql_profile_v2.h"
#include <stdlib.h>
#include <string>
+2
View File
@@ -11,6 +11,8 @@ if(NOT DEFINED AQLPROFILE_TARGET)
HINTS /opt/rocm ${CMAKE_INSTALL_PREFIX}
PATHS /opt/rocm
PATH_SUFFIXES lib)
enable_testing()
include(CTest)
endif()
find_package(
+1 -2
View File
@@ -38,8 +38,7 @@
#include <hsa/hsa.h>
#include <hsa/hsa_ext_amd.h>
#include <hsa/hsa_ven_amd_aqlprofile.h>
//#include "/opt/rocm/include/aqlprofile-sdk/aql_profile_v2.h"
#include "aql_profile_v2.h"
#include "aqlprofile-sdk/aql_profile_v2.h"
#define CHECK_HSA(x) if ((x) != HSA_STATUS_SUCCESS) { std::cerr << __FILE__ << " error at " << __LINE__ << std::endl; exit(-1); }
+1 -1
View File
@@ -26,7 +26,7 @@
#include <hsa/hsa.h>
#include <hsa/hsa_ext_amd.h>
#include <hsa/hsa_ven_amd_aqlprofile.h>
#include "aql_profile_v2.h"
#include "aqlprofile-sdk/aql_profile_v2.h"
#include <stdlib.h>
#include <unistd.h>
#include <atomic>