diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 577df71531e..453b940efa6 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2925,8 +2925,9 @@ if(BUILD_TESTING) set(CTestTestBadExe_REGEX "(\\*\\*\\*Failed)|BAD_COMMAND") endif() set_tests_properties(CTestTestBadExe PROPERTIES - PASS_REGULAR_EXPRESSION "${CTestTestBadExe_REGEX}") - + PASS_REGULAR_EXPRESSION "${CTestTestBadExe_REGEX}" + TIMEOUT 30) + # CI tooling such as CodeQL may inject libraries via LD_PRELOAD that alter # process execution error reporting, preventing the BAD_COMMAND string from # appearing in the output. Clear LD_PRELOAD for this test so that the diff --git a/Tests/CTestTestBadExe/CMakeLists.txt b/Tests/CTestTestBadExe/CMakeLists.txt index d01fc42f3bb..7f1a5383ef0 100644 --- a/Tests/CTestTestBadExe/CMakeLists.txt +++ b/Tests/CTestTestBadExe/CMakeLists.txt @@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.10) project(CTestTestBadExe) include(CTest) -configure_file("${CMAKE_CURRENT_SOURCE_DIR}/notAnExe.txt" "${CMAKE_CURRENT_BINARY_DIR}/notAnExe.txt" COPYONLY) +# Use a file without an extension to avoid Windows file associations +# (e.g. .txt -> Notepad) which can cause the test to hang instead of +# reporting BAD_COMMAND. +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/notAnExe" "${CMAKE_CURRENT_BINARY_DIR}/notAnExe" COPYONLY) -add_test (TestBadExe "${CMAKE_CURRENT_BINARY_DIR}/notAnExe.txt") +add_test (TestBadExe "${CMAKE_CURRENT_BINARY_DIR}/notAnExe") diff --git a/Tests/CTestTestBadExe/notAnExe.txt b/Tests/CTestTestBadExe/notAnExe similarity index 100% rename from Tests/CTestTestBadExe/notAnExe.txt rename to Tests/CTestTestBadExe/notAnExe