summaryrefslogtreecommitdiffstats
path: root/tests/load-functions
diff options
context:
space:
mode:
Diffstat (limited to 'tests/load-functions')
-rw-r--r--tests/load-functions24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/load-functions b/tests/load-functions
index 2e9ddda..3436158 100644
--- a/tests/load-functions
+++ b/tests/load-functions
@@ -1,6 +1,30 @@
# -*- sh -*-
# See LICENSE file for copyright and license details.
+parallelindex=0
+p () {
+ (
+ set +ev
+ pid=$$-$parallelindex
+ a=.a-$pid.tmp
+ b=.b-$pid.tmp
+ log=.x-$pid.tmp
+ ( set -ev ; $t "$@" ) > $log 2>&1
+ r=$?
+ test $r = 0 || cat -- $log >&2
+ rm -f -- .?-$pid.tmp
+ exit $r
+ ) &
+ eval parallelpid$(( ++parallelindex ))=$!
+}
+await () {
+ while (( parallelindex )); do
+ parallelvar=parallelpid$(( parallelindex-- ))
+ eval wait '$'$parallelvar
+ done
+}
+
+
stderr () {
("$@") 2>&1 >/dev/null
}