jehanne/qa/kern/nested_note.runner
Giacomo Tesio f9b2e9aba4 kernel: generalize awake
Awake can now interrupt several blocking syscalls (even
during note handling).

Among others, it can interrupt await, pread and pwrite.

It cannot interrupt several others for different reasons:

- awake cannot be interrupted by awake;
- syscalls like remove and create can be used for kernel comunication
  and it would be hard to know if the effect occurred in the
  receiving fs if they were interrupted;
- other syscalls do not need awake since they just provide access
  to kernel infos (eg seek or fd2path)

NOTE: awakes registered before a note cannot occur during the note
handling and will be deferred till the next call to noted.
2017-05-15 00:05:59 +02:00

36 lines
800 B
Bash
Executable File

#!/cmd/rc
# this test ensure that notes are enqueued in kernel
runner=$0
test = `{echo $runner|sed 's/.runner//'}
test_output = /tmp/output-`{basename $test}
if ( test -e $test_output) rm $test_output
$test $test_output &
testpid = $apid
while ( ! test -e $test_output ) { sleep 2 }
echo $test started, output to $test_output, kill at /proc/$testpid/ctl
echo -n first > /proc/$testpid/note
echo -n second > /proc/$testpid/note
echo -n stop > /proc/$testpid/note
wait $testpid
if ( cat $test_output | grep 'waiting after first.......................' > /dev/null ) {
if ( cat $test_output | grep 'waiting after second.......................' > /dev/null ) {
if ( cat $test_output | grep 'PASS' > /dev/null ) {
rm $test_output
echo PASS
exit PASS
}
}
}
cat $test_output
echo FAIL
exit FAIL