summaryrefslogtreecommitdiffstats
path: root/tests/run.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run.sh')
-rw-r--r--tests/run.sh20
1 files changed, 14 insertions, 6 deletions
diff --git a/tests/run.sh b/tests/run.sh
index 87f94b4..612e11a 100644
--- a/tests/run.sh
+++ b/tests/run.sh
@@ -94,9 +94,10 @@ reap_test() {
# Wait for a background test to finish
wait_test() {
- local pid
+ local pid line ret
while true; do
+ line=$((LINENO + 1))
wait -n -ppid
ret=$?
@@ -106,7 +107,7 @@ wait_test() {
# Interrupted by signal
continue
else
- debug "${BASH_SOURCE[0]}" $((LINENO - 3)) "${RED}error $ret${RST}" >&$DUPERR
+ debug "${BASH_SOURCE[0]}" $line "${RED}error $ret${RST}" >&$DUPERR
exit 1
fi
done
@@ -120,7 +121,9 @@ wait_ready() {
# We'd like to parse the output of jobs -n, but we can't run it in a
# subshell or we won't get the right output
jobs -n >"$TMP/jobs"
- while read -r job status ret foo; do
+
+ local job status ret rest
+ while read -r job status ret rest; do
case "$status" in
Done)
reap_test 0
@@ -207,7 +210,6 @@ run_tests() {
done
if [ "${BAR:-}" ]; then
- progress "${YLW}[100%%]${RST} ${BLD}%3d${RST} / ${BLD}%d${RST}\n" $ran $total
hide_bar
fi
@@ -411,14 +413,20 @@ make_xattrs() {
esac
}
+# Get the Unix epoch time in seconds
+epoch_time() {
+ # https://stackoverflow.com/a/12746260/502399
+ awk 'BEGIN { srand(); print srand(); }'
+}
+
## Snapshot testing
# Return value when a difference is detected
EX_DIFF=20
# Detect colored diff support
-if diff --color /dev/null /dev/null &>/dev/null; then
- DIFF="diff --color"
+if ((COLOR_STDERR)) && diff --color=always /dev/null /dev/null &>/dev/null; then
+ DIFF="diff --color=always"
else
DIFF="diff"
fi