From 8b8f6f5256a16ee90f28e7b481bd12e7b5cf4aad Mon Sep 17 00:00:00 2001 From: Raul Torres Date: Wed, 13 Nov 2024 18:47:41 -0500 Subject: [PATCH] Recover runner_tests_lightning --- runtime/tests/CMakeLists.txt | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/runtime/tests/CMakeLists.txt b/runtime/tests/CMakeLists.txt index da70168a05..fef089f486 100644 --- a/runtime/tests/CMakeLists.txt +++ b/runtime/tests/CMakeLists.txt @@ -40,6 +40,39 @@ target_sources(runner_tests_qir_runtime PRIVATE catch_discover_tests(runner_tests_qir_runtime) +add_executable(runner_tests_lightning runner_main.cpp) + +# Skip dynamic device loading test when sanitizers are enabled or when building on mac, +# due to the fact that our current support is not fully compatible on macOS. +# RTLD_DEEPBIND incompatibility. +if (ENABLE_ADDRESS_SANITIZER OR APPLE) + set(dl_manager_tests "") +else() + # Tests which use dlopen and RTLD_DEEPBIND are incompatible with sanitizers. + # All tests which go through dlopen need to be tested without sanitizers. + # They produce the following error message: + # You are trying to dlopen a this-file-does-not-exist.so shared + # library with RTLD_DEEPBIND flag which is incompatible with sanitizer + # runtime (see https://github.com/google/sanitizers/issues/611 for + # details). If you want to run this-file-does-not-exist.so library under + # sanitizers please remove RTLD_DEEPBIND from dlopen flags. + set(dl_manager_tests + Test_DLManager.cpp + ) +endif() + +target_link_libraries(runner_tests_lightning PRIVATE + Catch2::Catch2 + pybind11::embed + catalyst_qir_runtime + ) + +target_sources(runner_tests_lightning PRIVATE ${cov_helper_src} + ${dl_manager_tests} + ) + +catch_discover_tests(runner_tests_lightning) + if(ENABLE_OPENQASM) add_executable(runner_tests_openqasm runner_main.cpp) add_dependencies(runner_tests_openqasm openqasm_python_module) @@ -67,5 +100,3 @@ if(ENABLE_OPENQASM) catch_discover_tests(runner_tests_openqasm) endif() - -add_executable(runner_tests_lightning runner_main.cpp)