From f5f336db085971f460bf9d81094f5ae662c3377d Mon Sep 17 00:00:00 2001 From: Gheorghe-Teodor Bercea Date: Mon, 4 May 2020 08:37:58 -0400 Subject: [PATCH] Fix running backend tests triggered by preloading cruntime dynamic library (#104) * Reorganize main function. * Follow review comments. * Emit constants are globals in Krnl and LLVM dialects. * Fix preloading of runtime shared library for backend tests. * Update library name. * Only add libstdc++ library if it exists. --- test/backend/CMakeLists.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/backend/CMakeLists.txt b/test/backend/CMakeLists.txt index 4e4c3ce..b980b7f 100644 --- a/test/backend/CMakeLists.txt +++ b/test/backend/CMakeLists.txt @@ -2,8 +2,17 @@ configure_file(test.py test.py COPYONLY) configure_file(test_config.py.in test_config.py) find_package(PythonInterp 3 REQUIRED) + +set(LD_PRELOADS $) + +get_filename_component(CXX_BIN_DIR ${CMAKE_CXX_COMPILER} PATH) +set(LIBSTDCXX_LIB "${CXX_BIN_DIR}/../lib64/libstdc++.so") +if(EXISTS ${LIBSTDCXX_LIB}) + set(LD_PRELOADS ${LIBSTDCXX_LIB}:${LD_PRELOADS}) +endif() + add_custom_target(check-onnx-backend - COMMAND LD_PRELOAD=$ ${PYTHON_EXECUTABLE} + COMMAND LD_PRELOAD=${LD_PRELOADS} ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/test.py) add_dependencies(check-onnx-backend onnx-mlir)