diff options
author | Klemens Nanni <kn@cvs.openbsd.org> | 2022-10-16 12:34:14 +0000 |
---|---|---|
committer | Klemens Nanni <kn@cvs.openbsd.org> | 2022-10-16 12:34:14 +0000 |
commit | cb8e68ed92cdffe1a53d14ed40ef5d3a340c4e36 (patch) | |
tree | 124de485242688405d07597d8ad07ac9a016ede8 /regress/bin/ksh | |
parent | a4fbf77a5aced45b3fa707379e23e09d7470a875 (diff) |
Add new failing read/signal test
^C does not abort `read < /dev/zero', instead it read(2)s indefinitely,
one null byte at a time; bash and ksh93 from ports abort as expected.
Use the new timeout(1) $PROG trick to send ^C after 0.1s, but also
rely on it's -k for the final SIGKILL to stop the busy-looping process.
./th's `time-limit: 1' prints "test timed out (limit of 1 seconds)" but
leaves the process running.
Diffstat (limited to 'regress/bin/ksh')
-rw-r--r-- | regress/bin/ksh/read.t | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/regress/bin/ksh/read.t b/regress/bin/ksh/read.t index 021d1e58870..83b93ad9cae 100644 --- a/regress/bin/ksh/read.t +++ b/regress/bin/ksh/read.t @@ -1,4 +1,4 @@ -# $OpenBSD: read.t,v 1.1 2013/12/02 20:39:44 millert Exp $ +# $OpenBSD: read.t,v 1.2 2022/10/16 12:34:13 kn Exp $ # # To test: @@ -56,3 +56,16 @@ expected-stdout: [abc] --- +name: signal-aborts-endless-read +description: + Check that an endless read can be interrupted. +# XXX ^C does nothing, needs uncatchable SIGKILL to stop +expected-fail: yes +stdin: + exec timeout --preserve-status -s INT -k 0.5s -- 0.1s $PROG -c ' + read < /dev/zero + ' +# 2/9 == INT/KILL +# XXX using signal expressions like 's == 2' only works with ksh +expected-exit: e == 128 + 2 +--- |