X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=bin%2Flib;h=27ea9b428420de5da78fe85cb20b1e007c451766;hb=e24e54a23e4cdee7bfe8d480c990697d39932cd0;hp=48c1a8f254d0b21f37344c7589c67cef063accb1;hpb=02d57c3865e8604c609a8f4ba20b8340103f9286;p=eval.git diff --git a/bin/lib b/bin/lib index 48c1a8f..27ea9b4 100644 --- a/bin/lib +++ b/bin/lib @@ -93,7 +93,7 @@ EOF function locate-source { - pstart "Locating source... " + pstart "Finding source... " for a in $EXTENSIONS ; do if [ -f $SDIR/$PROBLEM.$a ] ; then [ -z "$SRCN" ] || die "Multiple source files found: $SDIR/$PROBLEM.$a and $SDIR/$SRCN. Please fix." @@ -128,6 +128,7 @@ function compile echo "Compiler input files:" ls -Al $BOXDIR + echo "Compiler output:" if ! $BOXCMD $COMP_SANDBOX_OPTS -- $CCMD 2>$TDIR/compile.out ; then COMPILE_MSG="`cat $TDIR/compile.out`" pend "FAILED: $COMPILE_MSG" @@ -151,13 +152,14 @@ function compile # Running of test program with file input/output -function test-run-with-files +function test-run { pcont " " box-clean echo "Executable file: $TDIR/$PROBLEM" cp $TDIR/$PROBLEM $BOXDIR/ echo "Input: $TDIR/$PROBLEM" + ln $PDIR/$TEST.in $TDIR/$TEST.in cp $PDIR/$TEST.in $BOXDIR/$PROBLEM.in echo "Input files:" ls -Al $BOXDIR @@ -171,7 +173,7 @@ function test-run-with-files TEST_MSG="`cat $TDIR/exec.out`" pend "$TEST_MSG" echo "$TEST_MSG" - echo >$PTSFILE "0 $TEST_MSG" + echo >>$PTSFILE "0 $TEST_MSG" return 1 fi cat $TDIR/exec.out @@ -181,7 +183,7 @@ function test-run-with-files if [ ! -s $BOXDIR/$PROBLEM.out ] ; then pend "No output file." echo "No output file." - echo >$PTSFILE "0 No output." + echo >>$PTSFILE "0 No output." return 1 fi cp $BOXDIR/$PROBLEM.out $TDIR/$TEST.out @@ -198,7 +200,7 @@ function syntax-check $SCHECK && return 0 pend "Wrong syntax." echo "Wrong syntax." - echo >$PTSFILE "0 Wrong syntax." + echo >>$PTSFILE "0 Wrong syntax." return 1 } @@ -213,6 +215,26 @@ function output-check $OCHECK && return 0 pend "Wrong answer." echo "Wrong answer." - echo >$PTSFILE "0 Wrong answer." + echo >>$PTSFILE "0 Wrong answer." return 1 } + +# Setup of public commands + +function public-setup +{ + PDIR=$MO_PUBLIC/problems/$PROBLEM + SDIR=. + TDIR=~/.test + [ -d $PDIR ] || die "Unknown problem $PROBLEM" + + pstart "Initializing... " + mkdir -p $TDIR + rm -rf $TDIR/* + BOXDIR=~/.box + mkdir -p $BOXDIR + rm -rf $BOXDIR/* + BOXCMD="$MO_PUBLIC/bin/box -c$BOXDIR" + exec >log + pend "OK (see 'log' for details)" +}