projects
/
tinc
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8156f37
)
Support running tests on NetBSD 8.2.
author
Kirill Isakov
<is-kir@ya.ru>
Fri, 30 Jul 2021 10:46:00 +0000
(16:46 +0600)
committer
Kirill Isakov
<is-kir@ya.ru>
Fri, 30 Jul 2021 10:46:00 +0000
(16:46 +0600)
test/testlib.sh.in
patch
|
blob
|
history
diff --git
a/test/testlib.sh.in
b/test/testlib.sh.in
index
c65bdde
..
047db87
100644
(file)
--- a/
test/testlib.sh.in
+++ b/
test/testlib.sh.in
@@
-386,19
+386,26
@@
wait_script() {
# group by enabling job control, but this results in weird behavior when
# running tests in parallel on some interactive shells
# (e.g. when /bin/sh is symlinked to dash).
# group by enabling job control, but this results in weird behavior when
# running tests in parallel on some interactive shells
# (e.g. when /bin/sh is symlinked to dash).
+ fifo=$(mktemp)
+ rm -f "$fifo"
+ mkfifo "$fifo"
+
+ # This weird thing is required to support old versions of ksh on NetBSD 8.2 and the like.
+ (tail -n +"$line" -f "$script_log" >"$fifo") &
+
new_line=$(
try_limit_time 60 sh -c "
new_line=$(
try_limit_time 60 sh -c "
- fifo=\$$.fifo
- cleanup() { rm -f \$fifo; }
- cleanup && trap cleanup EXIT
-
- mkfifo \$$.fifo
- tail -n '+$line' -f '$script_log' >\$fifo &
- grep -n -m '$count' '^$script,' <\$fifo
- kill \$!
+ grep -n -m $count '^$script,' <'$fifo'
" | awk -F: 'END { print $1 }'
)
" | awk -F: 'END { print $1 }'
)
+ # Try to stop the background tail, ignoring possible failure (some tails
+ # detect EOF, some don't, so it may have already exited), but do wait on
+ # it (which is required at least by old ksh).
+ kill $! || true
+ wait || true
+ rm -f "$fifo"
+
# Remember the next line number for future reference. We'll use it if
# wait_script is called again with same $peer and $script.
read -r "${line_var?}" <<EOF
# Remember the next line number for future reference. We'll use it if
# wait_script is called again with same $peer and $script.
read -r "${line_var?}" <<EOF