Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1From 30c4d7fb34a09cf0a711c43231bd13fc380844d0 Mon Sep 17 00:00:00 2001 2From: Silvan Mosberger <silvan.mosberger@moduscreate.com> 3Date: Tue, 7 Oct 2025 15:08:49 +0200 4Subject: [PATCH 2/2] allow keeping output of potentially failed tests 5 6Previously if a test produced a diff, the only way to fix it was to 7inspect the test output. 8 9We introduce the BASH_TSTOUT_KEEPDIR environment variable which is 10expected to point to a directory. 11If set, that directory will be populated with output from all failed 12tests, with test names as file names. 13 14This makes debugging or updating the expected test outputs easier. 15 16Co-Authored-By: Silvan Mosberger <silvan.mosberger@tweag.io> 17Co-Authored-By: Aleksander Bantyev <alexander.bantyev@tweag.io> 18--- 19 tests/run-all | 5 +++++ 20 1 file changed, 5 insertions(+) 21 22diff --git tests/run-all tests/run-all 23index c8f503a2..5d769d0f 100644 24--- tests/run-all 25+++ tests/run-all 26@@ -72,6 +72,11 @@ do 27 passed=$(( passed + 1 )) 28 else 29 echo "$x EXITED NON-ZERO ($?) - possible anomaly unless otherwise noted" 30+ if [ "${BASH_TSTOUT_KEEPDIR+set}" = "set" ]; then 31+ cp "${BASH_TSTOUT}" "${BASH_TSTOUT_KEEPDIR}/$x" 32+ else 33+ echo "Hint: set BASH_TSTOUT_KEEPDIR environment variable to a directory to keep test output there" 34+ fi 35 fi 36 rm -f "${BASH_TSTOUT}" 37 ;; 38-- 392.49.0 40