-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·92 lines (69 loc) · 2.06 KB
/
run.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
87
88
#!/bin/sh
# GAPC test script, fetches the repository, if something is new, testsuite is run,
# output only if test fails (-> error exit status)
# $1 name of the test
# $2 path to config file to be used
# $3 number of CPUs used
# $4 set to 1 to update only
# $5 system-suffix for tests
# get path to script
script_dir="$( cd "$(dirname "$0")" ; pwd -P )"
lockfile=$script_dir/$1.lock
LOG=$script_dir/log/$1.log
# the folder that is generated
WORKDIR=$script_dir/$1
# where to load sources from
SRC=ssh://hg@hg.cebitec.uni-bielefeld.de/pi/software/gapc/main_reconstruct
if ( set -o noclobber; echo "$$" > "$lockfile") 2> /dev/null; then
# set trap for interruptions
trap 'rm -f "$lockfile"; exit $?' INT TERM EXIT
if [ "$#" -le 3 -o "$4" -ne "1" ]; then
# if old workdir exists remove it
if [ -e "$WORKDIR" ]; then
rm -rf "$WORKDIR"
fi
# create workdir
mkdir -p "$WORKDIR"
hg clone $SRC "$WORKDIR" >> "$LOG"
echo "cloned"
else
# create workdir
mkdir -p "$WORKDIR"
fi
# get config file
cp "$2" "$WORKDIR/config.mf"
sed -i "s|^\s*PREFIX.*$|PREFIX="$WORKDIR"/install|" "$WORKDIR/config.mf"
echo "TRUTH_DIR=$script_dir/Truth" >> "$WORKDIR/config.mf"
echo "TRUTH_SUFFIX=$5" >> "$WORKDIR/config.mf"
PATH="$WORKDIR/install":$PATH
cd "$WORKDIR"
#execute all tests
make -j $3 >> "$LOG" 2>&1
ISmake=$?
make -j $3 install >> "$LOG" 2>&1
ISmakeInstall=$?
make -j $3 test-unit >> "$LOG" 2>&1
ISunit=$?
make -j $3 test-mod >> "$LOG" 2>&1
ISmod=$?
make test-paral >> "$LOG" 2>&1
ISparal=$?
make test-regress >> "$LOG" 2>&1
ISregress=$?
make test-ambiguity >> "$LOG" 2>&1
ISambi=$?
if [ $ISmake -ne 0 -o $ISunit -ne 0 -o $ISmod -ne 0 -o $ISparal -ne 0 -o $ISambi -ne 0 -o $ISmakeInstall -ne 0 ]; then
echo %%% Test returned errors - log file is:
echo $LOG
echo %%% exiting
rm -f "$lockfile"
trap - INT TERM EXIT
exit 23
fi
# clean up after yourself, and release your trap
rm -f "$lockfile"
trap - INT TERM EXIT
else
echo "Lock Exists: $lockfile owned by $(cat $lockfile)"
exit 20
fi