From d309c4fa0ca2cd55e36cf1462b9057d6eb97a297 Mon Sep 17 00:00:00 2001 From: Lukas Zaoral Date: Tue, 13 Apr 2021 15:30:23 +0200 Subject: tests: Do not add klee tools to PATH in lit It may happen that some older instance of klee is already present in PATH. All tests that call plain klee instead of %klee may use it and then unexpectedly fail. This commit will make all tests that rely on klee tools being explicitly in PATH fail in our CI. From now on, only LLVM tools, FileCheck and not will be in lit's PATH. --- test/CMakeLists.txt | 3 +++ test/lit.cfg | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 2ff9b0eb..2a968333 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -71,6 +71,9 @@ if (NOT EXISTS "${LLVM_TOOLS_BINARY_DIR}/not") set(DOWNLOAD_NOT_SOURCE TRUE) endif() +# Do not build FileCheck and not to ${KLEE_TOOLS_DIR} as it will not be in lit's PATH. +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${KLEE_TOOLS_DIR}/testtools) + if (DOWNLOAD_FILECHECK_SOURCE) if (${LLVM_VERSION_MAJOR} GREATER 3) set(FILECHECK_SRC_URL "https://raw.githubusercontent.com/llvm/llvm-project/release/${LLVM_VERSION_MAJOR}.x/llvm/utils/FileCheck/FileCheck.cpp") diff --git a/test/lit.cfg b/test/lit.cfg index 6a02daee..a195a1dc 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -35,21 +35,21 @@ klee_src_root = getattr(config, 'klee_src_root', None) if klee_obj_root is not None: config.test_exec_root = os.path.join(klee_obj_root, 'test') -# Tweak the PATH to include the tool dir. -if klee_obj_root is not None: + # Check KLEE tools directory klee_tools_dir = getattr(config, 'klee_tools_dir', None) if not klee_tools_dir: lit_config.fatal('No KLEE tools dir set!') - # Check LLVM tool directory + # Check LLVM tools directory llvm_tools_dir = getattr(config, 'llvm_tools_dir', None) if not llvm_tools_dir: - lit_config.fatal('No LLVM tool directory set!') + lit_config.fatal('No LLVM tools directory set!') + # Add LLVM tools and FileCheck with not to PATH path = os.path.pathsep.join( ( + os.path.join(klee_tools_dir, "testtools"), llvm_tools_dir, - klee_tools_dir, config.environment['PATH'] ) ) -- cgit 1.4.1