diff --git a/projects/hip/tests/catch/CMakeLists.txt b/projects/hip/tests/catch/CMakeLists.txt index 8de7c5539e..d3b3f028e0 100644 --- a/projects/hip/tests/catch/CMakeLists.txt +++ b/projects/hip/tests/catch/CMakeLists.txt @@ -64,8 +64,13 @@ set(CMAKE_CXX_EXTENSIONS OFF) add_custom_target(build_tests) +# Tests folder add_subdirectory(unit) add_subdirectory(hipTestMain) add_subdirectory(stress) -add_subdirectory(multiproc) + +if(UNIX AND HIP_PLATFORM MATCHES "amd") + add_subdirectory(multiproc) +endif() + cmake_policy(POP) diff --git a/projects/hip/tests/catch/hipTestMain/CMakeLists.txt b/projects/hip/tests/catch/hipTestMain/CMakeLists.txt index 3895a296f7..3bb07cb1ea 100644 --- a/projects/hip/tests/catch/hipTestMain/CMakeLists.txt +++ b/projects/hip/tests/catch/hipTestMain/CMakeLists.txt @@ -3,7 +3,11 @@ if(CMAKE_BUILD_TYPE MATCHES "^Debug$") endif() add_executable(UnitTests EXCLUDE_FROM_ALL main.cc hip_test_context.cc) -set_property(TARGET UnitTests PROPERTY CXX_STANDARD 17) +if(HIP_PLATFORM MATCHES "amd") + set_property(TARGET UnitTests PROPERTY CXX_STANDARD 17) +else() + target_compile_options(UnitTests PUBLIC -std=c++17) +endif() target_link_libraries(UnitTests PRIVATE DeviceLibs MemoryTest @@ -19,11 +23,11 @@ catch_discover_tests(UnitTests PROPERTIES SKIP_REGULAR_EXPRESSION "HIP_SKIP_THI add_dependencies(build_tests UnitTests) # Add Multiproc tests as seperate binary -if(UNIX) - add_executable(MultiProcTests EXCLUDE_FROM_ALL main.cc hip_test_context.cc) - set_property(TARGET MultiProcTests PROPERTY CXX_STANDARD 17) - target_link_libraries(MultiProcTests PRIVATE MultiProc +if(UNIX AND HIP_PLATFORM MATCHES "amd") + add_executable(MultiProcTests EXCLUDE_FROM_ALL main.cc hip_test_context.cc) + set_property(TARGET MultiProcTests PROPERTY CXX_STANDARD 17) + target_link_libraries(MultiProcTests PRIVATE MultiProc stdc++fs) - catch_discover_tests(MultiProcTests PROPERTIES SKIP_REGULAR_EXPRESSION "HIP_SKIP_THIS_TEST") - add_dependencies(build_tests MultiProcTests) + catch_discover_tests(MultiProcTests PROPERTIES SKIP_REGULAR_EXPRESSION "HIP_SKIP_THIS_TEST") + add_dependencies(build_tests MultiProcTests) endif() diff --git a/projects/hip/tests/catch/hipTestMain/hip_test_context.cc b/projects/hip/tests/catch/hipTestMain/hip_test_context.cc index e10dc1a5f6..71c2a9bc0e 100644 --- a/projects/hip/tests/catch/hipTestMain/hip_test_context.cc +++ b/projects/hip/tests/catch/hipTestMain/hip_test_context.cc @@ -120,7 +120,7 @@ bool TestContext::parseJsonFile() { LogPrintf("Json contents:: %s", json_str.data()); picojson::value v; - std::string err; + std::string err = picojson::parse(v, json_str); if (err.size() > 1) { LogPrintf("Error from PicoJson: %s", err.data()); return false; @@ -130,6 +130,7 @@ bool TestContext::parseJsonFile() { LogPrintf("%s", "Data in json is not in correct format, it should be an object"); return false; } + const picojson::object &o = v.get(); for (picojson::object::const_iterator i = o.begin(); i != o.end(); ++i) { // Processing for DisabledTests