-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathtester
More file actions
executable file
·36 lines (27 loc) · 1.11 KB
/
Copy pathtester
File metadata and controls
executable file
·36 lines (27 loc) · 1.11 KB
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
#!/usr/bin/env bash
# This script calls `tests/tester.ml` by:
# (1) changing the working directory to be the root of OptiTrust
# (2) inserting as first argument the relative path from the
# OptiTrust root to the path of the current folder (pwd)
#
# The script also generates a bash file `tester_last.sh` at the
# OptiTrust root storing the command for replaying the exact same tests.
set -euo pipefail
OPTITRUST_PATH=$(dirname $0)
FOLDER_RELATIVE_PATH=$(realpath --relative-to=${OPTITRUST_PATH} $(pwd))
OPTITRUST_ABSOLUTE_PATH=$(realpath ${OPTITRUST_PATH})
cd ${OPTITRUST_PATH}
ARGS="$@"
FIRSTARG=$(echo ${ARGS} | awk '{print $1;}')
CMD="export OCAMLRUNPARAM=b && opam exec -- dune exec optitrust_tester -- ${FOLDER_RELATIVE_PATH} ${ARGS}"
# Save the command for run commands
if [ "${FIRSTARG}" = "run" ]; then
echo "#!/usr/bin/env bash" > ./tester_last.sh
echo "cd ${OPTITRUST_ABSOLUTE_PATH}; ${CMD}" >> ./tester_last.sh
chmod +x ./tester_last.sh
fi
# Limit the amount of memory that can be allocated
ulimit -v $((16 * 1024 * 1024)) # Never exceed 16 GiB of memory
# Run the command
echo "Running: ${CMD}"
eval ${CMD}