Previously if a test produced a diff, the only way to fix it was to
inspect the test output.

We introduce the BASH_TSTOUT_KEEPDIR environment variable which is
expected to point to a directory.
If set, that directory will be populated with output from all failed
tests, with test names as file names.

This makes debugging or updating the expected test outputs easier.

Co-Authored-By: Silvan Mosberger <[email protected]>
Co-Authored-By: Aleksander Bantyev <[email protected]>
---
 tests/run-all | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tests/run-all b/tests/run-all
index c8f503a2..5d769d0f 100644
--- a/tests/run-all
+++ b/tests/run-all
@@ -72,6 +72,11 @@ do
                        passed=$(( passed + 1 ))
                else
                        echo "$x EXITED NON-ZERO ($?) - possible anomaly unless 
otherwise noted"
+                       if [ "${BASH_TSTOUT_KEEPDIR+set}" = "set" ]; then
+                               cp "${BASH_TSTOUT}" "${BASH_TSTOUT_KEEPDIR}/$x"
+                       else
+                               echo "Hint: set BASH_TSTOUT_KEEPDIR environment 
variable to a directory to keep test output there"
+                       fi
                fi
                rm -f "${BASH_TSTOUT}"
                ;;
-- 
2.49.0


Reply via email to