pre-commit 815 Bytes
Newer Older
1 2 3 4 5
ROOTDIR="$(git rev-parse --git-dir)"

cd $ROOTDIR/..
echo "Testing the program before commit..."
echo "Testing tallying..."
Julien Lopez's avatar
Julien Lopez committed
6 7 8 9 10 11
ocamlbuild tests/libtest/tallyingTest.native > /dev/null 2>&1 && ./tallyingTest.native > /dev/null 2>&1
if test $? -ne 0; then
   echo "Tests failed. Aborting commit."
   exit 2
fi
ocamlbuild tests/libtest/typesTest.native > /dev/null 2>&1 && ./typesTest.native > /dev/null 2>&1
12 13 14 15 16 17
if test $? -ne 0; then
   echo "Tests failed. Aborting commit."
   exit 2
fi
echo "Testing lambda..."
cd tests/lambda
Julien Lopez's avatar
Julien Lopez committed
18
make > /dev/null 2>&1 && ./lambdaTests.native > /dev/null 2>&1 && ./valueTests.native > /dev/null 2>&1
Julien Lopez's avatar
Julien Lopez committed
19 20 21 22
if test $? -ne 0; then
   echo "Tests failed. Aborting commit."
   exit 2
fi
23 24 25
echo "Cleaning..."
make clean > /dev/null 2>&1
cd ../..
Julien Lopez's avatar
Julien Lopez committed
26
ocamlbuild -clean > /dev/null 2>&1
27 28
echo "Success!"
exit 0