ref: 9d6814dfeb05d4d251994404923f46901868eaa9
dir: /test/
#!/bin/rc fn fail{ >[1=2] echo $1 >[1=2]; exit $1 } argv0=$0 ~ $rideaddr '' && { fail 'missing server address argument' } ./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' x=`{grep debug ctl} echo 'debug 1' >ctl || fail 'Could not write ctl' y=`{grep debug ctl} ~ $y(2) 1 || fail 'Written and read ctl values differ' echo debug $x(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' x=`{grep connect ctl} echo 'connect localhost' >ctl || fail 'Could not write client ctl' y=`{grep connect ctl} ~ $y(2) localhost || fail 'Written and read client ctl values differ' echo umask $x(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' <clone { cd `{read} echo 'connect '^$rideaddr >ctl echo >text || fail 'Could not connect to server' <event >text { ~ `{wc -c info} 0 && fail 'Did not receive RIDE info' echo '⍳5' || fail 'Could not send message' cont=1 while(~ $cont 1){ ev=`{read} if(~ $ev(1) o){ rx=`{dd -if text -ibs 1 -skip $ev(4) -count $ev(3) >[2]/dev/null} cont=0 } } ~ $rx '0 1 2 3 4' || fail 'Did not receive expected response' } cd .. }