Drop main() prototype. Syncs with NetBSD-8
[minix.git] / minix / tests / testrmib.sh
blobe32cb3dfc33c794d5867af278170fc39da1c1221
1 #!/bin/sh
3 # Shell script used to test the Remote MIB (RMIB) functionality.
5 # We test a couple of things here, using the rmibtest service and test87:
6 # - some cases where remote MIB subtree registration should fail;
7 # - a new mount point (minix.rtest) with a small tree behind it, on which we
8 # test some basic reads and writes on an integer pointer and a function;
9 # - shadowing of an existing subtree (minix.test) with a similarly looking
10 # subtree, which we then subject to a subset of test87;
11 # - resource accounting, making sure everything is the same before and after.
13 bomb() {
14 echo $*
15 minix-service down rmibtest 2>/dev/null
16 exit 1
19 PATH=/bin:/usr/bin:/sbin:/usr/sbin
20 export PATH
22 echo -n "Test RMIB "
24 cd rmibtest
26 sysctl -q minix.rtest && bomb "there should not be a minix.rtest"
28 old_nodes=`sysctl -n minix.mib.nodes 2>/dev/null` || bomb "no MIB stats?"
29 old_objects=`sysctl -n minix.mib.objects 2>/dev/null` || bomb "no MIB stats?"
30 old_remotes=`sysctl -n minix.mib.remotes 2>/dev/null` || bomb "no MIB stats?"
32 minix-service up `pwd`/rmibtest -label rmibtest -config rmibtest.conf || \
33 bomb "unable to start test service"
35 cd ..
37 sleep 1
39 new_remotes=`sysctl -n minix.mib.remotes 2>/dev/null` || \
40 bomb "unable to get mount stats"
41 [ $(($old_remotes + 2)) -eq $new_remotes ] || bomb "mounting subtree failed"
43 # Test the temporary minix.rtest subtree with its two mirroring nodes
44 sysctl -q minix.rtest || bomb "there should be a minix.rtest"
46 [ $(sysctl -n minix.rtest.int) -eq 5375123 ] || bomb "unexpected int value"
47 [ $(sysctl -n minix.rtest.func) -eq 5375123 ] || bomb "unexpected func value"
48 sysctl -wq minix.rtest.int=456 || bomb "unable to set int value"
49 [ $(sysctl -n minix.rtest.int) -eq 456 ] || bomb "unexpected int value"
50 [ $(sysctl -n minix.rtest.func) -eq 456 ] || bomb "unexpected func value"
51 sysctl -wq minix.rtest.func=7895375 || bomb "unable to set func value"
52 [ $(sysctl -n minix.rtest.int) -eq 7895375 ] || bomb "unexpected int value"
53 [ $(sysctl -n minix.rtest.func) -eq 7895375 ] || bomb "unexpected func value"
55 # Test the minix.test shadowing subtree using a subset of the regular MIB test
56 ./test87 19 >/dev/null || bomb "test87 reported failure"
58 minix-service down rmibtest
60 sleep 1
62 # Is everything back to the old situation?
63 new_nodes=`sysctl -n minix.mib.nodes 2>/dev/null` || bomb "no MIB stats?"
64 new_objects=`sysctl -n minix.mib.objects 2>/dev/null` || bomb "no MIB stats?"
65 new_remotes=`sysctl -n minix.mib.remotes 2>/dev/null` || bomb "no MIB stats?"
67 [ $old_nodes -eq $new_nodes ] || bomb "stats not equal after unmount"
68 [ $old_objects -eq $new_objects ] || bomb "stats not equal after unmount"
69 [ $old_remotes -eq $new_remotes ] || bomb "stats not equal after unmount"
71 sysctl -q minix.rtest && bomb "there should not be a minix.rtest anymore"
73 echo "ok"
74 exit 0