Giacomo Tesio
0c2dabf975
Also, in binutils: fix inlining compilation error, see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=242053
58 lines
858 B
Bash
Executable File
58 lines
858 B
Bash
Executable File
#!/usr/bin/env rc
|
|
# poor man portable expect
|
|
|
|
QPROMPT='10.0.2.15# '
|
|
INFILE=/tmp/runqemu.$pid.in
|
|
OUTFILE=/tmp/runqemu.$pid.out
|
|
|
|
cd $JEHANNE/arch/amd64/kern
|
|
echo -n > $INFILE
|
|
echo -n > $OUTFILE
|
|
|
|
@{tail -f $INFILE | $JEHANNE/hacking/QA.sh >> $OUTFILE} &
|
|
QPID=$apid
|
|
|
|
tail -f $OUTFILE &
|
|
TPID=$apid
|
|
|
|
ifs='
|
|
'
|
|
INPUT=`{cat}
|
|
|
|
fn descendants {
|
|
if( ! ~ 0 $#1 ) {
|
|
echo $1;
|
|
ps -o pid= --ppid $1|xargs -n 1 rc -c 'descendants $1'
|
|
}
|
|
}
|
|
|
|
fn quit {
|
|
kill -2 `{descendants $QPID}
|
|
kill -2 $TPID
|
|
wait
|
|
rm $INFILE
|
|
rm $OUTFILE
|
|
exit $1
|
|
}
|
|
|
|
fn failOnError {
|
|
if( ! ~ 0 `{cat $OUTFILE | grep FAIL | wc -c}){
|
|
quit 1
|
|
}
|
|
}
|
|
|
|
for(cmd in $INPUT){
|
|
while( ~ 0 `{tail -n 1 $OUTFILE | sed -n '/'$QPROMPT'/p' | wc -c}){
|
|
sleep 2
|
|
}
|
|
failOnError
|
|
echo $cmd >> $INFILE
|
|
sleep 2
|
|
}
|
|
|
|
while( ~ 0 `{tail -n 1 $OUTFILE | sed -n '/'$QPROMPT'/p' | wc -c}){
|
|
sleep 2
|
|
}
|
|
failOnError
|
|
quit
|