shithub: ridefs

ref: 38f2878c44f584d472560c9a426d01cdd3fb99cb
dir: /test/

View raw version
#!/bin/rc

fn fail{ echo $1; exit $1}

./6.out $* ||
	fail 'Crashed at startup'

cd /mnt/ride ||
	fail 'Not mounted'

ls . >/dev/null ||
	fail 'Mountpoint not readable'

cat ctl >/dev/null ||
	fail 'Could not read ctl'

ot=`{grep timeout ctl}
echo 'timeout 5000' >ctl ||
	fail 'Could not write ctl'

nt=`{grep timeout ctl}
~ $nt(2) 5000 ||
	fail 'Written and read ctl values differ'
echo timeout $ot(2) >ctl

cat clone >/dev/null ||
	fail 'Could not clone'

<clone {
	cd `{read} ||
		fail 'Could not cd to client'

	cat ctl >/dev/null ||
		fail 'Could not read client ctl'

	ot=`{grep timeout ctl}
	echo 'timeout 5000' >ctl ||
		fail 'Could not write client ctl'

	nt=`{grep timeout ctl}
	~ $nt(2) 5000 ||
		fail 'Written and read client ctl values differ'
	echo timeout $ot(2) >ctl

	cd .. ||
		fail 'Could not cd out of client directory'
}

n=`{read clone}
ls -d $n >[2]/dev/null &&
	fail 'Did not clean up closed client'