forked from ocaml/ocaml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_testsuite.sh
executable file
·87 lines (67 loc) · 2.56 KB
/
run_testsuite.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/sh -e
# ============================================================================
# ======= VARIABLES ==========================================================
# ============================================================================
# ROOT of the git repo
GITROOT=$(git rev-parse --show-toplevel)
# TEMPORARY file to store the list of tests to run
trap 'rm -f "${LIST_FILE}"' EXIT
LIST_FILE=$(mktemp) || exit 1
# Variable to decide what we are testing, values ares:
# - false (default), test all compilers
# - true , only test ocamlc.byte and ocamlopt.byte
# (this is done using by patching ocamltest's sources)
ONLY_BYTE=false
# ============================================================================
# ======= SCRIPTS ARGUMENTS ==================================================
# ============================================================================
function usage {
echo "usage: ./run_testsuite.sh {command}"
echo "where {command} can be one of:"
echo " all : run the testuite using all compilers"
echo " byte : run the testuite using only ocamlc.byte and ocamlopt.byte"
echo " help : display this message"
}
case $1 in
all)
ONLY_BYTE=false
;;
byte)
ONLY_BYTE=true
;;
help)
usage
exit 0
;;
*)
usage
exit 1
;;
esac
# ============================================================================
# ======= THE SCRIPT ITSELF ==================================================
# ============================================================================
# If running the testsuite for bytecode compilers
# (i.e. ocamlc.byte, ocamlopt.byte), then apply the relevant patch
# and rebuild ocamltest
if [ "${ONLY_BYTE}" = true ]; then
# Go to the root (simpler for applying patches,
# though probably not strictly necessary).
cd ${GITROOT};
# Apply the patch to ocamltest
git apply ${GITROOT}/.github/workflows/ocamltest_makefile.patch ||
echo "To only test ocamlc.byte and ocamlopt.byte, this script needs\
to apply a git patch, please commit or stash any current changes\
to ensure this can happen cleanly";
# Unapply the patch when the script exits (even under abnormal cirumstances)
trap 'cd ${GITROOT} && \
git apply -R ${GITROOT}/.github/workflows/ocamltest_makefile.patch' EXIT
# Rebuild ocamltest
make ocamltest;
fi
# Get into the testsuite
cd ${GITROOT}/testsuite
# Generate the lists of tests
grep -v '#' ../.github/workflows/test-list > ${LIST_FILE}
# Run the testsuite
make list-parallel FILE=${LIST_FILE}