diff options
author | Mattias Andrée <maandree@kth.se> | 2023-12-16 12:40:10 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2023-12-16 12:40:10 +0100 |
commit | 683f205402a99cfc8cea46c83ce9b46a42616d42 (patch) | |
tree | f6ee1619454a6ec8b9e31770bbbc2abf36aae2fd /tests/load-functions | |
parent | Improve portability (diff) | |
download | libsyscalls-683f205402a99cfc8cea46c83ce9b46a42616d42.tar.gz libsyscalls-683f205402a99cfc8cea46c83ce9b46a42616d42.tar.bz2 libsyscalls-683f205402a99cfc8cea46c83ce9b46a42616d42.tar.xz |
All kinds of stuff
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'tests/load-functions')
-rw-r--r-- | tests/load-functions | 24 |
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 } |