change
This commit is contained in:
@@ -0,0 +1,49 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
EXEFILE=$3
|
||||||
|
ANGELIXPRE=$ANGELIX_RUN
|
||||||
|
INPUT_NAME=$1
|
||||||
|
OUTPUT_NAME=$2
|
||||||
|
MY_TIMEOUT=$4
|
||||||
|
MY_NAME=my_output
|
||||||
|
# rm -R $MY_NAME* &>/dev/null
|
||||||
|
run_test()
|
||||||
|
{
|
||||||
|
test_case="$1"
|
||||||
|
|
||||||
|
echo $MY_TIMEOUT
|
||||||
|
if ! `which gtime` -o $MY_TIMEOUT -f "(%es)" gtimeout -k 50s 50s $ANGELIXPRE $EXEFILE < $test_case | sed -e '/^$/d' -e 's/^[ \t]*//' > $test_case$MY_NAME; then
|
||||||
|
echo Sample test \#$test_case: Runtime Error`cat $MY_TIMEOUT`
|
||||||
|
echo ========================================
|
||||||
|
echo Sample Input \#$test_case
|
||||||
|
cat $test_case
|
||||||
|
exit 2
|
||||||
|
else
|
||||||
|
if grep "Command" $MY_TIMEOUT; then
|
||||||
|
echo "ERROR";
|
||||||
|
exit -1;
|
||||||
|
fi
|
||||||
|
if diff --brief -w $test_case$MY_NAME $2; then
|
||||||
|
echo Sample test \#$test_case: Accepted`cat $MY_TIMEOUT`
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo Sample test \#$test_case: Wrong Answer`cat $MY_TIMEOUT`
|
||||||
|
echo ========================================
|
||||||
|
echo Sample Input \#$test_case
|
||||||
|
cat $test_case
|
||||||
|
echo ========================================
|
||||||
|
echo Sample Output \#$2
|
||||||
|
cat $2
|
||||||
|
echo ========================================
|
||||||
|
echo My Output \#$test_case$MY_NAME
|
||||||
|
cat $test_case$MY_NAME
|
||||||
|
echo ========================================
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
run_test "$INPUT_NAME" "$OUTPUT_NAME" ;
|
||||||
|
|
||||||
|
esac
|
||||||
|
exit 1
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ def test_all(testerPath,validTests,testPath):
|
|||||||
|
|
||||||
outpos = test.replace('input-','output-')
|
outpos = test.replace('input-','output-')
|
||||||
# cmd = 'diff -u --brief -w {} <( '.format(join(testPath,outpos))+testerPath+' < {} )'.format(join(testPath,test))
|
# cmd = 'diff -u --brief -w {} <( '.format(join(testPath,outpos))+testerPath+' < {} )'.format(join(testPath,test))
|
||||||
cmd = 'bash ' + join(DATA_PATH, 'test-valid2.sh') + ' {} {} {} {} '.format(join(testPath, test),
|
cmd = 'bash ' + join(ROOT_DIR,'data' , 'test-valid2.sh') + ' {} {} {} {} '.format(join(testPath, test),
|
||||||
join(testPath, outpos), testerPath, join(testPath,'time.out'))
|
join(testPath, outpos), testerPath, join(testPath,'time.out'))
|
||||||
out,e = shellGitCheckout(cmd)
|
out,e = shellGitCheckout(cmd)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user