forked from GaloisInc/saw-script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·102 lines (87 loc) · 2.27 KB
/
build.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/bin/bash
set -x
set -v
set -e
TESTABLE="abcBridge jvm-verifier parameterized-utils saw-core"
dotests="false"
jobs=""
while getopts "tpfj:" opt; do
case $opt in
t)
dotests="true"
;;
j)
jobs="-j$OPTARG"
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
esac
done
git submodule init
git submodule update
(cd deps/abcBridge && git submodule init && git submodule update)
if [ ! -e stack.yaml -a -z "$STACK_YAML" ] ; then
set +x
echo
echo "ERROR: no stack.yaml file found."
echo
echo "Select one of the given stack configuration files using:"
echo
echo " ln -s stack.<ghc version and os>.yaml stack.yaml"
exit 1
fi
stack setup
LOCALBINPATH=$(stack path --local-bin-path | tr -d '\r\n')
if [ "${OS}" == "Windows_NT" ] ; then
HERE=$(cygpath -w $(pwd))
PATH=$PATH:$(cygpath -u -a $LOCALBINPATH)
else
HERE=$(pwd)
PATH=$PATH:$LOCALBINPATH
fi
stack="stack $jobs"
${stack} install alex
${stack} install happy
${stack} install c2hs
which alex
which happy
which c2hs
if [ "${dotests}" == "true" ] ; then
if [ -z ${TEST_TIMEOUT} ]; then
TEST_TIMEOUT="120s"
fi
mkdir -p tmp
for pkg in ${TESTABLE}; do
test_arguments="--xml=${HERE}/tmp/${pkg}-test-results.xml --timeout=${TEST_TIMEOUT}"
if [ ! "${QC_TESTS}" == "" ]; then
test_arguments="${test_arguments} --quickcheck-tests=${QC_TESTS}"
fi
# Stack is returning 1 when a test fails, which kills the whole
# build. Presumably Cabal returned 0 in this case.
#
# If the build part of the test fails, there won't be any XML
# file, so we'll detect failure in that case when we check for the
# XML file below.
(
set +e
${stack} build --test --test-arguments="${test_arguments}" ${pkg}
exit 0
)
if [ -e tmp/${pkg}-test-results.xml ]; then
xsltproc jenkins-junit-munge.xsl tmp/${pkg}-test-results.xml > tmp/jenkins-${pkg}-test-results.xml
else
echo "Missing test results: tmp/${pkg}-test-results.xml"
exit 1
fi
done
else
${stack} build
fi
# Link bin directory to a more convenient location
rm -f bin
ln -s `stack path --local-install-root`/bin
set +x +v
echo
echo "COPIED EXECUTABLES TO `pwd`/bin."