From ffe3f9cf81216a482dc295a685ab0132f988171b Mon Sep 17 00:00:00 2001 From: agunashe <86270081+agunashe@users.noreply.github.com> Date: Wed, 9 Feb 2022 08:17:45 -0800 Subject: [PATCH] SWDEV-273235 - hip change to build catch tests on Windows (#2472) * SWDEV-273235 - hip change to build catch tests on Windows Change-Id: I96de305694609c669cb81480f3572d987ce87d98 * SWDEV-1 - skip failing hipStreamPerThread_DeviceReset_1 test on Linux --- bin/hipcc.bat | 2 +- bin/hipconfig.bat | 2 +- tests/catch/CMakeLists.txt | 10 ++++++++-- tests/catch/hipTestMain/config/config_amd_linux.json | 7 +++++++ tests/catch/multiproc/CMakeLists.txt | 12 +++++------- tests/catch/unit/CMakeLists.txt | 6 ++---- tests/catch/unit/streamperthread/CMakeLists.txt | 8 +++----- 7 files changed, 27 insertions(+), 20 deletions(-) create mode 100644 tests/catch/hipTestMain/config/config_amd_linux.json diff --git a/bin/hipcc.bat b/bin/hipcc.bat index 104e78622d..a19ce9d80f 100644 --- a/bin/hipcc.bat +++ b/bin/hipcc.bat @@ -1,2 +1,2 @@ -@IF DEFINED HIP_PATH (set HIPCC="%HIP_PATH%/bin/hipcc") ELSE (set HIPCC="%CD%/hipcc") +@IF DEFINED HIP_PATH (set HIPCC="%HIP_PATH%/bin/hipcc") ELSE (set HIPCC="%~dp0/hipcc") @perl %HIPCC% %* diff --git a/bin/hipconfig.bat b/bin/hipconfig.bat index 64db66aece..9ba2d4205c 100644 --- a/bin/hipconfig.bat +++ b/bin/hipconfig.bat @@ -1,2 +1,2 @@ -@IF DEFINED HIP_PATH (set HIPCONFIG="%HIP_PATH%/bin/hipconfig") ELSE (set HIPCONFIG="%CD%/hipconfig") +@IF DEFINED HIP_PATH (set HIPCONFIG="%HIP_PATH%/bin/hipconfig") ELSE (set HIPCONFIG="%~dp0/hipconfig") @perl %HIPCONFIG% %* diff --git a/tests/catch/CMakeLists.txt b/tests/catch/CMakeLists.txt index 67f5673d30..db9c0552ce 100644 --- a/tests/catch/CMakeLists.txt +++ b/tests/catch/CMakeLists.txt @@ -1,4 +1,9 @@ cmake_minimum_required(VERSION 3.16.8) + +# to skip the simple compiler test +set(CMAKE_C_COMPILER_WORKS 1) +set(CMAKE_CXX_COMPILER_WORKS 1) + project(hiptests) # Check if platform and compiler are set @@ -32,8 +37,10 @@ else() # Set both compilers else windows cmake complains of mismatch cmake_path(SET CMAKE_CXX_COMPILER "${HIP_PATH}/bin/hipcc.bat") cmake_path(SET CMAKE_C_COMPILER "${HIP_PATH}/bin/hipcc.bat") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --rocm-path=${ROCM_PATH}") endif() + if(NOT DEFINED CATCH2_PATH) if(DEFINED ENV{CATCH2_PATH}) set(CATCH2_PATH $ENV{CATCH2_PATH} CACHE STRING "Catch2 Path") @@ -128,10 +135,9 @@ add_subdirectory(unit) add_subdirectory(ABM) add_subdirectory(hipTestMain) add_subdirectory(stress) - +add_subdirectory(TypeQualifiers) if(UNIX) add_subdirectory(multiproc) - add_subdirectory(TypeQualifiers) endif() cmake_policy(POP) diff --git a/tests/catch/hipTestMain/config/config_amd_linux.json b/tests/catch/hipTestMain/config/config_amd_linux.json new file mode 100644 index 0000000000..c11a1b823e --- /dev/null +++ b/tests/catch/hipTestMain/config/config_amd_linux.json @@ -0,0 +1,7 @@ +{ + "DisabledTests": + [ + "Unit_hipStreamPerThread_DeviceReset_1" + ] + +} diff --git a/tests/catch/multiproc/CMakeLists.txt b/tests/catch/multiproc/CMakeLists.txt index 78de21f674..8d690c6734 100644 --- a/tests/catch/multiproc/CMakeLists.txt +++ b/tests/catch/multiproc/CMakeLists.txt @@ -14,10 +14,8 @@ set(LINUX_TEST_SRC hipMemCoherencyTstMProc.cc ) -if(UNIX) - # the last argument linker libraries is required for this test but optional to the function - hip_add_exe_to_target(NAME MultiProc - TEST_SRC ${LINUX_TEST_SRC} - TEST_TARGET_NAME build_tests - LINKER_LIBS ${CMAKE_DL_LIBS}) -endif() +# the last argument linker libraries is required for this test but optional to the function +hip_add_exe_to_target(NAME MultiProc + TEST_SRC ${LINUX_TEST_SRC} + TEST_TARGET_NAME build_tests + LINKER_LIBS ${CMAKE_DL_LIBS}) diff --git a/tests/catch/unit/CMakeLists.txt b/tests/catch/unit/CMakeLists.txt index 0e8b37c993..ff8a0f95fe 100644 --- a/tests/catch/unit/CMakeLists.txt +++ b/tests/catch/unit/CMakeLists.txt @@ -21,7 +21,6 @@ add_subdirectory(memory) add_subdirectory(deviceLib) add_subdirectory(stream) -add_subdirectory(streamperthread) add_subdirectory(event) add_subdirectory(occupancy) add_subdirectory(device) @@ -29,6 +28,5 @@ add_subdirectory(rtc) add_subdirectory(printf) add_subdirectory(printfExe) add_subdirectory(texture) -if(UNIX) - add_subdirectory(graph) -endif() +add_subdirectory(streamperthread) +add_subdirectory(graph) diff --git a/tests/catch/unit/streamperthread/CMakeLists.txt b/tests/catch/unit/streamperthread/CMakeLists.txt index 51a789d426..a47e1e8c69 100644 --- a/tests/catch/unit/streamperthread/CMakeLists.txt +++ b/tests/catch/unit/streamperthread/CMakeLists.txt @@ -6,8 +6,6 @@ set(TEST_SRC hipStreamPerThread_DeviceReset.cc ) -# Create shared lib of all tests -add_library(StreamPerThreadTest SHARED EXCLUDE_FROM_ALL ${TEST_SRC}) - -# Add dependency on build_tests to build it on this custom target -add_dependencies(build_tests StreamPerThreadTest) +hip_add_exe_to_target(NAME StreamPerThreadTest + TEST_SRC ${TEST_SRC} + TEST_TARGET_NAME build_tests)