diff options
Diffstat (limited to 'fw/test/fwtest.rc')
| -rwxr-xr-x | fw/test/fwtest.rc | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/fw/test/fwtest.rc b/fw/test/fwtest.rc index 15ea531..d4222a8 100755 --- a/fw/test/fwtest.rc +++ b/fw/test/fwtest.rc @@ -30,6 +30,11 @@ src=$2 if(~ $#src 0) src=/sys/src/cmd/fw +# where the scripts are, likewise +lib=$3 +if(~ $#lib 0) + lib=/lib/fw + tmp=/tmp/fwtest.$pid mkdir -p $tmp nA=$tmp/nA @@ -391,6 +396,37 @@ echo '== packets, between two stacks' stopfw $nA $nB } +echo '== fwstart' +if(test -f $lib/fwstart) +@{ + rfork n + # /mnt as it is at boot: a real directory, with no fw in it yet. + # -c because without it the bound directory forbids creation and + # fwstart's mkdir fails for a reason the real /mnt would not give. + mkdir -p $tmp/mnt + bind -c $tmp/mnt /mnt + >$tmp/marker + echo 'fw=nosuchether rules='^$tmp/empty.ndb > $tmp/fwcfg + @{ rc $lib/fwstart $tmp/fwcfg } <$tmp/marker >$tmp/fwout >[2=1] + sleep 1 + + # mount(2) needs the mount point to exist, so the old + # "mntgen /mnt/fw only if /mnt/fw is missing" ran it exactly when + # it could not work, and every card's control directory failed + r=`{if(test -d /mnt/fw/whatever) echo yes; if not echo no} + check 'a control directory appears for each card' yes $"r + + r=`{grep -c nosuchether $tmp/fwout} + check 'a card that is not there is reported and skipped' 1 $"r + + # anything it leaves running holds the descriptors it was started + # with, and on a console that is the console + r=`{cat /proc/*/fd >[2]/dev/null | grep -c $tmp/marker} + check 'and nothing it started kept our descriptors' 0 $"r +} +if not + echo ' skip no '^$lib^'/fwstart' + echo '== the test cleans up after itself' r=`{nfw} check 'no fw processes are left running' $"fwbefore $"r |
