X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=eval%2Flibeval.sh;h=676dbef399f3b6ea2ddd5df1029ef95c747b694c;hb=fdbe00e033228b9dfea601c58b9113144f564233;hp=bbf5a8fdb1f2da20027bd02f78268da24c525cad;hpb=67d97c2848dec9f3396a4a1c3bf10161e0071562;p=eval.git diff --git a/eval/libeval.sh b/eval/libeval.sh index bbf5a8f..676dbef 100644 --- a/eval/libeval.sh +++ b/eval/libeval.sh @@ -263,14 +263,14 @@ function test-result SG=${M#Caught fatal signal } SG=${SG#Committed suicide by signal } if [ "$SG" != "$M" ] ; then - SG=`perl -MConfig -e '@s=split / /,$Config{sig_name}; print $s[$ARGV[0]]' $SG` + SG=`kill -l $SG 2>/dev/null` || SG= [ -z "$SG" ] || M="$M (SIG$SG)" fi # Translate runtime errors to readable strings RE=${M#Exited with error status } if [ -n "$EXIT_CODE_HOOK" -a "$RE" != "$M" ] ; then - NEWMSG=`$EXIT_CODE_HOOK $RE` + NEWMSG=`$EXIT_CODE_HOOK $RE` || NEWMSG= if [ -n "$NEWMSG" ] ; then M="Runtime error $RE: $NEWMSG" fi @@ -305,6 +305,15 @@ function test-prolog ;; none) echo "Input file: " ;; + dir) echo "Input file: files in directory $PDIR/$TEST.in/" + [ -d $PDIR/$TEST.in ] || die "Not a directory: $PDIR/$TEST.in" + # TODO: recursive ln to $TDIR + cp -r $PDIR/$TEST.in $TDIR/$TEST.in + cp -r $PDIR/$TEST.in/* $BOXDIR/ + # Can have .stdin, but empty by default + touch $BOXDIR/.stdin + BOX_EXTRAS="$BOX_EXTRAS -i.stdin" + ;; *) die "Unknown IN_TYPE $IN_TYPE" ;; esac @@ -382,7 +391,10 @@ function test-run-file pcont " " BOXOPTS=$(expand-var TEST_SANDBOX_OPTS) echo "Sandbox options: $BOXOPTS" - if ! $BOXCMD $BOXOPTS -- ./$PROBLEM 2>$TMPDIR/exec.out ; then + EXECMD=$(expand-var TEST_EXEC_CMD) + [ -z "$EXECMD" ] || echo "Exec command: $EXECMD" + [ -z "$EXECMD" ] && EXECMD="./$PROBLEM" + if ! $BOXCMD $BOXOPTS -- $EXECMD 2>$TMPDIR/exec.out ; then cat $TMPDIR/exec.out MSG=`tail -1 $TMPDIR/exec.out` test-result 0 "$MSG" @@ -401,7 +413,10 @@ function test-run-interactive echo "Sandbox options: $BOXOPTS" ICCMD=$(expand-var IA_CHECK) echo "Interactive checker: $ICCMD" - if ! $HDIR/bin/iwrapper $BOXCMD $BOXOPTS -- ./$PROBLEM @@ $ICCMD 2>$TMPDIR/exec.out ; then + EXECMD=$(expand-var TEST_EXEC_CMD) + [ -z "$EXECMD" ] || echo "Exec command: $EXECMD" + [ -z "$EXECMD" ] && EXECMD="./$PROBLEM" + if ! $HDIR/bin/iwrapper $BOXCMD $BOXOPTS -- $EXECMD @@ $ICCMD 2>$TMPDIR/exec.out ; then cat $TMPDIR/exec.out MSG="`head -1 $TMPDIR/exec.out`" test-result 0 "$MSG" @@ -415,7 +430,7 @@ function test-run-interactive function test-run-open-data { [ -f $SDIR/$TEST.out ] || test-result 0 "No solution" - ln $SDIR/$TEST.out $TDIR/$TEST.out + try-ln $SDIR/$TEST.out $TDIR/$TEST.out } # Syntax checks @@ -443,7 +458,7 @@ function output-check MSG= if [ -n "$OUTPUT_CHECK" -a "$OUT_TYPE" != none -a -z "$EV_NOCHECK" ] ; then pcont " " - [ -f $PDIR/$TEST.out ] && ln $PDIR/$TEST.out $TDIR/$TEST.ok + [ -f $PDIR/$TEST.out ] && try-ln $PDIR/$TEST.out $TDIR/$TEST.ok OCHECK=$(expand-var OUTPUT_CHECK) echo "Output check command: $OCHECK" if ! eval $OCHECK 2>$TMPDIR/exec.out ; then