diff options
| author | Jilles Tjoelker <jilles@FreeBSD.org> | 2019-09-18 19:21:20 +0000 |
|---|---|---|
| committer | Jilles Tjoelker <jilles@FreeBSD.org> | 2019-09-18 19:21:20 +0000 |
| commit | c47438a13df086deec733050272ff9b8278b9841 (patch) | |
| tree | e31afe9649d0afd0b9d101f0e83506fe22f43909 /usr.bin/procstat | |
| parent | 959eff58c1b6c07efe78fab405c8f634c6a4f40b (diff) | |
Notes
Diffstat (limited to 'usr.bin/procstat')
| -rwxr-xr-x | usr.bin/procstat/tests/procstat_test.sh | 14 | ||||
| -rw-r--r-- | usr.bin/procstat/tests/while1.c | 5 |
2 files changed, 8 insertions, 11 deletions
diff --git a/usr.bin/procstat/tests/procstat_test.sh b/usr.bin/procstat/tests/procstat_test.sh index bc381381a0f7..b96c36bffce2 100755 --- a/usr.bin/procstat/tests/procstat_test.sh +++ b/usr.bin/procstat/tests/procstat_test.sh @@ -25,7 +25,6 @@ # $FreeBSD$ # -MAX_TRIES=20 PROG_PID= PROG_PATH=$(atf_get_srcdir)/while1 @@ -37,16 +36,13 @@ start_program() PROG_COMM=while1 PROG_PATH=$(atf_get_srcdir)/$PROG_COMM - $PROG_PATH $* & + mkfifo wait_for_start || atf_fail "mkfifo" + $PROG_PATH $* >wait_for_start & PROG_PID=$! - try=0 - while [ $try -lt $MAX_TRIES ] && ! kill -0 $PROG_PID; do - sleep 0.5 - : $(( try += 1 )) - done - if [ $try -ge $MAX_TRIES ]; then - atf_fail "Polled for program start $MAX_TRIES tries and failed" + if ! read dummy <wait_for_start; then + atf_fail "Program did not start properly" fi + rm wait_for_start } atf_test_case binary_info diff --git a/usr.bin/procstat/tests/while1.c b/usr.bin/procstat/tests/while1.c index b8e275ff14f1..cc201b712745 100644 --- a/usr.bin/procstat/tests/while1.c +++ b/usr.bin/procstat/tests/while1.c @@ -33,7 +33,8 @@ int main(void) { + if (write(STDOUT_FILENO, "started\n", 8) != 8) + abort(); for (;;) - usleep(100); - exit(1); + pause(); } |
