From 210b070496ef912a3b4745477b609b150b013d6b Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Fri, 8 Jun 2001 15:25:28 +0000 Subject: [PATCH 1/1] Submitting and checking of open data problems. --- public/check | 25 ++++++++++++++++++------- public/submit | 36 ++++++++++++++++++++++-------------- 2 files changed, 40 insertions(+), 21 deletions(-) diff --git a/public/check b/public/check index fee56b6..ea6512d 100644 --- a/public/check +++ b/public/check @@ -6,16 +6,27 @@ set -e . $MO_PUBLIC/bin/lib . $MO_PUBLIC/config -[ -n "$1" ] || die "Usage: check " +[ -n "$1" ] || die "Usage: check []" PROBLEM=$1 public-setup . $PDIR/config -locate-source -compile PTSFILE=$TDIR/points -for TEST in $SAMPLE_TESTS ; do - pstart "Checking on sample input $TEST: " - test-run +if [ -n "$OPEN_DATA_PROBLEM" ] ; then + [ -n "$2" ] || die "You need to specify test number for open data problems." + TEST=$2 + open-locate + pstart "Checking $TEST: " syntax-check pend "OK" -done +else + [ -z "$2" ] || die "No test number should be specified for normal problems." + locate-source + compile + for TEST in $SAMPLE_TESTS ; do + pstart "Checking on sample input $TEST: " + test-run + syntax-check + output-check + pend "OK" + done +fi diff --git a/public/submit b/public/submit index dfdbb13..bdd475f 100644 --- a/public/submit +++ b/public/submit @@ -11,23 +11,31 @@ if [ "$1" = --force ] ; then FORCE=1 shift fi -[ -n "$1" -o "$1" = "--help" ] || die "Usage: submit [--force] " +[ -n "$1" -o "$1" = "--help" ] || die "Usage: submit [--force] []" PROBLEM=$1 public-setup . $PDIR/config -locate-source -compile PTSFILE=$TDIR/points FAILED=0 -for TEST in $SAMPLE_TESTS ; do - pstart "Checking on sample input $TEST: " - if test-run && syntax-check ; then - pend "OK" - else - FAILED=$(($FAILED+1)) - fi -done -pstart "Submiting... " +if [ -n "$OPEN_DATA_PROBLEM" ] ; then + [ -n "$2" ] || die "You need to specify test number for open data problems." + TEST=$2 + open-locate + syntax-check || FAILED=1 +else + [ -z "$2" ] || die "No test number should be specified for normal problems." + locate-source + compile + for TEST in $SAMPLE_TESTS ; do + pstart "Checking on sample input $TEST: " + if test-run && syntax-check && output-check ; then + pend "OK" + else + FAILED=$(($FAILED+1)) + fi + done +fi +pstart "Submitting... " if [ $FAILED != 0 ] ; then if [ $FORCE != 0 ] ; then pcont "(tests failed, but --force given) " @@ -37,7 +45,7 @@ if [ $FAILED != 0 ] ; then fi fi mkdir -p ~/.submit -rm -rf ~/.submit/$PROBLEM -mkdir ~/.submit/$PROBLEM +[ -z "$OPEN_DATA_PROBLEM" ] && rm -rf ~/.submit/$PROBLEM +mkdir -p ~/.submit/$PROBLEM cp $SRCN ~/.submit/$PROBLEM/ pend "OK" -- 2.39.2