Skip to content
This repository has been archived by the owner on Aug 18, 2021. It is now read-only.

Commit

Permalink
untabify and a few improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Claudiu Gheorghe committed Apr 9, 2010
1 parent 9476dd8 commit c6d27cb
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 59 deletions.
29 changes: 26 additions & 3 deletions testing/pa/dummy/verify
Expand Up @@ -4,12 +4,35 @@ input_file=$1
output_file=$2
ref_file=$3

# validate output file
if [ -z $output_file ];
then
echo "output filename not given"
exit 1
elif [ ! -f $output_file ];
then
echo "output file '$output_file' is missing"
exit 1
fi

# validate reference file
if [ -z $ref_file ];
then
echo "reference filename not given"
exit 1
elif [ ! -f $ref_file ];
then
echo "reference file '$ref_file' is missing"
exit 1
fi

out_value=`head -n 1 $output_file`
ref_value=`head -n 1 $ref_file`

if [ $out_value -eq $ref_value ];
then
exit 0;
exit 0
else
echo "incorrect result - expecting $ref_value, found $out_value";
exit 1;
echo "incorrect result - expecting $ref_value, found $out_value"
exit 1
fi
113 changes: 57 additions & 56 deletions testing/pa/pa-linux_vmchecker_run.sh
@@ -1,20 +1,21 @@
#!/bin/sh

# @author claudiugh
# Script generic de rulare a temelor sub limita de timp
# depinde de:
# - tracker: trebuie sa fie compilat din Makefile.checker
# - verify: executabil generic (script sh/bash/python sau executabil) care verifica outputul studentului
# Generic script for running assignments with CPU time limit
# depends on:
# - tracker: has to be compiled from Makefile.checker
# - verify: runnable file (sh/bash/python script or executable)
# verifies the ouput generated by student's assignment
#

#home=$1
#cd $home
home=$1
cd $home

INPUT_DIR=input
OUTPUT_DIR=output
REFERENCES_DIR=refs
TRACKER=tracker
VERIFIER=verify
TRACKER=./tracker
VERIFIER=./verify

print_fail_reason()
{
Expand All @@ -27,40 +28,40 @@ run_test()
# run test
if [ -f $TRACKER ];
then
./$TRACKER $timeout $INPUT_DIR/$input_file $OUTPUT_DIR/$output_file \
> $test_name-tracker.out 2> $test_name-tracker.err;
err=$?;
if [ $err -eq 0 ];
then
if [ -f $VERIFIER ];
then
./$VERIFIER $INPUT_DIR/$input_file \
$OUTPUT_DIR/$output_file \
$REFERENCES_DIR/$output_file \
> $test_name-verifier.out
if [ $? -eq 0 ];
then
echo $test_name: passed;
echo `cat $test_name-tracker.out`;
return 0;
else
echo $test_name: failed;
echo reason: `cat $test_name-verifier.out`;
return 1;
fi
else
echo "verifier not found";
exit;
fi
else
echo $test_name: failed;
print_fail_reason;
return 1;
echo;
fi
$TRACKER $timeout $INPUT_DIR/$input_file $OUTPUT_DIR/$output_file \
> $test_name-tracker.out 2> $test_name-tracker.err;
err=$?;
if [ $err -eq 0 ];
then
if [ -f $VERIFIER ];
then
$VERIFIER $INPUT_DIR/$input_file \
$OUTPUT_DIR/$output_file \
$REFERENCES_DIR/$output_file \
> $test_name-verifier.out
if [ $? -eq 0 ];
then
echo $test_name: passed;
echo `cat $test_name-tracker.out`;
return 0;
else
echo $test_name: failed;
echo reason: `cat $test_name-verifier.out`;
return 1;
fi
else
echo "verifier not found";

This comment has been minimized.

Copy link
@brtzsnr

brtzsnr Apr 9, 2010

echo "verifier $VERIFIER not found"

exit;
fi
else
echo $test_name: failed;
print_fail_reason;
return 1;
echo;
fi
else
echo "the tracker is not built";
exit;
echo "the tracker is not built";
exit;
fi
}

Expand All @@ -73,16 +74,16 @@ run_all_tests()
failed=0
for input_file in $input_files
do
test_name=`echo $input_file | sed s/\.in//`
output_file=$test_name.out
run_test
if [ $? -eq 0 ];
then
passed=`expr $passed + 1`
else
failed=`expr $failed + 1`
fi
echo;
test_name=`echo $input_file | sed s/\.in//`
output_file=$test_name.out
run_test
if [ $? -eq 0 ];
then
passed=`expr $passed + 1`
else
failed=`expr $failed + 1`
fi
echo;
done
echo; echo results: $passed passed, $failed failed;
}
Expand All @@ -93,19 +94,19 @@ detect_lang()
java_files=`ls | grep -c .java$`
if [ $java_files -gt 0 ];
then
echo "language: java"
lang="java"
echo "language: java"
lang="java"
else
echo "language: c/c++";
lang="c"
echo "language: c/c++";
lang="c"
fi
}

setup()
{
if [ ! -d $OUTPUT_DIR ];
then
mkdir $OUTPUT_DIR
mkdir $OUTPUT_DIR
fi
}

Expand Down

1 comment on commit c6d27cb

@luciang
Copy link

@luciang luciang commented on c6d27cb Apr 9, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

never do untabify and other stuff in the same patch if the other stuff has functionality changes.
It's extremely hard to verify what exactly changed.

Please sign in to comment.