#!/bin/rc # # Execfs Regression # echo '== Execfs Regression ==' # # Parameters # TESTDIR=.test EXECLOG=execfs.log MPIPELOG=mpipefs.log E_MNTPATH=/tmp/testbed/E # # Cleanup Previous Instances # fn cleanup { echo Cleaning up previous runs. # FIXME: should there be multiple mpipes? unmount /n/mpipetest > /dev/null >[2] /dev/null unmount $E_MNTPATH > /dev/null >[2] /dev/null rm -f $E_MNTPATH /tmp/testbed rm -f /srv/mpipe rm -f /srv/execfs unmount /proc > /dev/null >[2] /dev/null bind '#p' /proc } # # Startup execfs # fn startup { echo Starting mpipefs.... mkdir -p $E_MNTPATH if(~ $#* 0) { ../$O.mpipefs >[2] $MPIPELOG } if not { ../$O.mpipefs -D -v $1 >[2] $MPIPELOG # CHATTY } mount /srv/mpipe /n/mpipetest test echo Starting execfs. if(~ $#* 0) { ../$O.execfs -s execfs -E ../$O.execcmd -m $E_MNTPATH >[2] $EXECLOG } if not { ../$O.execfs -D -v $1 -s execfs -E ../$O.execcmd -m $E_MNTPATH >[2] $EXECLOG # CHATTY } bind -bc '#p' $E_MNTPATH bind -bc . /$objtype/bin bind -bc .. /$objtype/bin } # # Setup a test directory # fn testdir { mkdir -p $TESTDIR } fn myexecstdin { mypid=`{cat} #` echo -n exec /bin/cat >>[2] execfs.log >>[2] error.log cat $TESTDIR/test > $E_MNTPATH/$mypid/stdin >>[2] error.log cat $E_MNTPATH/$mypid/stdout > $TESTDIR/test1 >>[2] error.log } fn myexecstdout { mypid=`{cat} #` echo -n exec /bin/cat $TESTDIR/test >>[2] error.log cat $E_MNTPATH/$mypid/stdout > $TESTDIR/test1 >>[2] error.log } fn stdout { echo -n Basic Test.... # initialize files echo Hello Squidboy > $TESTDIR/test echo > $TESTDIR/test1 # execute test myexecstdout <>$E_MNTPATH/clone >[1=0] # verify results if(! cmp -s $TESTDIR/test $TESTDIR/test1) { echo FAILED! exit 'stdout: test failed' } echo Success! # cleanup rm -rf $TESTDIR/* } fn stdin { echo -n Stdin Test.... # initialize files echo Hello Squidboy > $TESTDIR/test echo > $TESTDIR/test1 # execute test myexecstdin <>$E_MNTPATH/clone >[1=0] # verify results if(! cmp -s $TESTDIR/test $TESTDIR/test1) { echo FAILED! exit 'stdout: test failed' } echo Success! # cleanup rm -rf $TESTDIR/* } # Setup rfork cleanup startup $1 testdir # Note: the current tests die on the 4'th run of either stdout or # stdin. If I run cleanup**startup between each it runs fine. For # now I am leaving it at two tests and will look into it later. # Tests stdout stdin #failing # FIXME: running dubug with more than 3 stdin/stdout tests or regress # with more than 1, causes the clone to fail while opening # /proc/#/ctl. Ex: # # can't open: '/tmp/testbed/E/clone' execfs: fsopen: opening # [/proc/220943/ctl] failed: '/proc/220943/ctl' process exited mk: rc # mpipefs.rc rc ... : exit status=rc 220177: rc 220903: error # # you can run cleanup/startup between each one to force it to work... # Cleanup rm -rf $TESTDIR cleanup