Skip to content

Instantly share code, notes, and snippets.

@MasseGuillaume
Created April 26, 2012 15:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MasseGuillaume/2500535 to your computer and use it in GitHub Desktop.
Save MasseGuillaume/2500535 to your computer and use it in GitHub Desktop.
log1000 correction tp4
#! /bin/sh
SOURCE=tictactoe.cpp
SOURCE_TMP=tmp_tictactoe.cpp
DIFF_FAIL="ok"
COMPILE_FAIL="ok"
cp $SOURCE $SOURCE_TMP
#test patches
for diff in *.diff
do
#patch
echo "+ "$diff
patch $SOURCE < $diff &> /dev/null
#compile
# make clean &> /dev/null
make test &> /dev/null
# compile must not fail
if [ "$?" != "0" ]; then
COMPILE_FAIL="$COMPILE_FAIL $diff"
fi
./ttt_test &> /dev/null
# test must fail
if [ "$?" == "0" ]; then
DIFF_FAIL="$DIFF_FAIL $diff"
fi
rm $SOURCE
cp $SOURCE_TMP $SOURCE
done;
rm $SOURCE_TMP
echo "DIFFs: `ls *.diff | wc -l`"
if [ DIFF_FAIL != "ok" ]; then
for diff in $DIFF_FAIL
do
echo $diff
done;
fi
echo "Compile:"
if [ COMPILE_FAIL != "ok" ]; then
for fail in $COMPILE_FAIL
do
echo $fail
done;
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment