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.
This commit is contained in:
Gheorghe-Teodor Bercea 2020-05-04 08:37:58 -04:00 committed by GitHub
parent e785a75705
commit f5f336db08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -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 $<TARGET_FILE:cruntime>)
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=$<TARGET_FILE:cruntime> ${PYTHON_EXECUTABLE}
COMMAND LD_PRELOAD=${LD_PRELOADS} ${PYTHON_EXECUTABLE}
${CMAKE_CURRENT_BINARY_DIR}/test.py)
add_dependencies(check-onnx-backend onnx-mlir)