From f9bca70966959b66e0ef7bbb3de88019f2e50a91 Mon Sep 17 00:00:00 2001 From: Sneha Ramachandran Date: Thu, 12 Feb 2026 15:42:09 -0500 Subject: [PATCH] fix for flaky test --- Tests/CMakeLists.txt | 5 +++-- Tests/CTestTestBadExe/CMakeLists.txt | 7 +++++-- Tests/CTestTestBadExe/{notAnExe.txt => notAnExe} | 0 3 files changed, 8 insertions(+), 4 deletions(-) rename Tests/CTestTestBadExe/{notAnExe.txt => notAnExe} (100%) 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