From: Maksym Sobolyev Date: Fri, 13 Mar 2026 01:56:40 +0000 (-0700) Subject: test: Relax util::exec_to_string missing command assertion X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6673e6d11cbcdeb4e846d2d25772590caeb84a5f;p=thirdparty%2Fccache.git test: Relax util::exec_to_string missing command assertion The POSIX error for a missing command is not stable across systems. Some environments report the posix_spawnp failure directly, while others return a shell-style "Non-zero exit code: 127" instead. Accept both outcomes in the test and capture the actual error string to make future failures easier to diagnose. --- diff --git a/unittest/test_util_exec.cpp b/unittest/test_util_exec.cpp index 42b3da95..d4c85fd3 100644 --- a/unittest/test_util_exec.cpp +++ b/unittest/test_util_exec.cpp @@ -57,7 +57,11 @@ TEST_CASE("util::exec_to_string") #ifdef _WIN32 CHECK(result.error().starts_with("CreateProcess failure: ")); #else - CHECK(result.error() == "posix_spawnp failed: No such file or directory"); + CAPTURE(result.error()); + const bool expected_spawn_failure = + result.error().starts_with("posix_spawnp failed: ") + || result.error() == "Non-zero exit code: 127"; + CHECK(expected_spawn_failure); #endif } }