diff options
author | Rodrigo Arias Mallo <rodarima@gmail.com> | 2024-06-01 15:31:07 +0200 |
---|---|---|
committer | Rodrigo Arias Mallo <rodarima@gmail.com> | 2024-06-01 20:24:32 +0200 |
commit | 620126ab1a1fff783ccf71155e0831f35ae8bf83 (patch) | |
tree | ac4dd9cf7cfc6170e69ac0eeb9d5ba609c1f1315 | |
parent | d64f7051995575c2c1044d7c0d6fd7dcaa07beb6 (diff) |
Remove test directories for distclean
In order to leave a clean build directory by distclean, all generated
files must be removed. The environment variable DILLO_TEST_LEAVE_FILES
can be set to leave the generated test results, which aids debugging
when tests fail.
-rwxr-xr-x | test/html/driver.sh | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/test/html/driver.sh b/test/html/driver.sh index 3ab37e41..5c69fcde 100755 --- a/test/html/driver.sh +++ b/test/html/driver.sh @@ -2,7 +2,7 @@ # # File: driver.sh # -# Copyright (C) 2023 Rodrigo Arias Mallo <rodarima@gmail.com> +# Copyright (C) 2023-2024 Rodrigo Arias Mallo <rodarima@gmail.com> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -55,26 +55,29 @@ function test_file() { fi test_name=$(basename "$html_file") + wdir="${test_name}_wdir" - wdir=$(mktemp -d "${test_name}_XXX") + # Clean any previous files + rm -rf "$wdir" + mkdir -p "$wdir" # Use a FIFO to read the display number - mkfifo $wdir/display.fifo - exec 6<> $wdir/display.fifo + mkfifo "$wdir/display.fifo" + exec 6<> "$wdir/display.fifo" Xvfb -screen 5 1024x768x24 -displayfd 6 & xorgpid=$! # Always kill Xvfb on exit trap "kill $xorgpid" EXIT - read dispnum < $wdir/display.fifo + read dispnum < "$wdir/display.fifo" export DISPLAY=":$dispnum" render_page "$html_file" "$wdir/html.png" render_page "$ref_file" "$wdir/ref.png" # AE = Absolute Error count of the number of different pixels - diffcount=$(compare -metric AE $wdir/html.png $wdir/ref.png $wdir/diff.png 2>&1) + diffcount=$(compare -metric AE "$wdir/html.png" "$wdir/ref.png" "$wdir/diff.png" 2>&1) # The test passes only if both images are identical if [ "$diffcount" = "0" ]; then @@ -86,7 +89,11 @@ function test_file() { fi exec 6>&- - rm $wdir/display.fifo + rm "$wdir/display.fifo" + + if [ -z "$DILLO_TEST_LEAVE_FILES" ]; then + rm -rf "$wdir" + fi return $ret } |