Drop manual CodeQL actions
[fast-export.git] / run-tests
blob0ad5bf601fe5688ea3dd1d18d4cef29b9d3dd7ae
1 #!/bin/bash
3 READLINK="readlink"
4 if command -v greadlink > /dev/null; then
5 READLINK="greadlink" # Prefer greadlink over readlink
6 fi
8 if ! $READLINK -f "$(which "$0")" > /dev/null 2>&1 ; then
9 ROOT="$(dirname "$(which "$0")")"
10 if [ ! -f "$ROOT/hg-fast-export.py" ] ; then
11 echo "test runner requires a readlink implementation which knows" \
12 " how to canonicalize paths in order to be called via a symlink."
13 exit 1
15 else
16 ROOT="$(dirname "$($READLINK -f "$(which "$0")")")"
20 export SHARNESS_TEST_SRCDIR="${SHARNESS_TEST_SRCDIR:-$ROOT/t/sharness}"
22 TESTS=$(find $ROOT/t -maxdepth 1 -name \*.t -executable -type f)
24 failed=0
25 type parallel >& /dev/null
26 if [ $? -eq 0 ]; then
27 echo "Using parallel to run tests"
28 function F() {
29 echo "Running test $1"
32 export -f F
33 parallel F ::: $TESTS || failed=1
34 else
35 for i in $TESTS ; do
36 echo "Running test $i"
37 $i || failed=1
38 done
41 if [ "$failed" -eq "0" ]; then
42 echo "All tests passed";
43 else
44 echo "There were failed tests";
47 exit $failed