forked from opprop/checker-framework-inference
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.ci-build.sh
executable file
·107 lines (84 loc) · 3.01 KB
/
.ci-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
103
104
105
106
107
#!/bin/bash
echo Entering "$(cd "$(dirname "$0")" && pwd -P)/$(basename "$0")" in `pwd`
# Fail the whole script if any command fails
set -e
export SHELLOPTS
# Optional argument $1 is one of:
# cfi-tests, downstream
# If it is omitted, this script does everything.
export GROUP=$1
if [[ "${GROUP}" == "" ]]; then
export GROUP=all
fi
SLUGOWNER=${TRAVIS_REPO_SLUG%/*}
if [[ "$SLUGOWNER" == "" ]]; then
SLUGOWNER=opprop
fi
echo "SLUGOWNER=$SLUGOWNER"
if [[ "${GROUP}" != "cfi-tests" && "${GROUP}" != downstream* && "${GROUP}" != "all" ]]; then
echo "Bad argument '${GROUP}'; should be omitted or one of: cfi-tests, downstream-*, all."
exit 1
fi
. ./.ci-build-without-test.sh
# Test CF Inference
if [[ "${GROUP}" == "cfi-tests" || "${GROUP}" == "all" ]]; then
./gradlew testCheckerInferenceScript
./gradlew testCheckerInferenceDevScript
./gradlew test
./gradlew testDataflowExternalSolvers
fi
# Downstream tests
# Only perform downstream test in opprop.
if [[ "${GROUP}" == downstream* && "${SLUGOWNER}" == "opprop" ]]; then
# clone_downstream Git_Target Git_Branch
clone_downstream () {
DOWNSTREAM_PROJ="$(pwd -P)/../$1"
echo "clone downstream to: ${DOWNSTREAM_PROJ}"
COMMAND="/tmp/plume-scripts/git-clone-related opprop $1 ${DOWNSTREAM_PROJ}"
echo "Running: ($COMMAND)"
(eval $COMMAND)
echo "... done: ($COMMAND)"
}
# test_downstream Git_Target Build_Test_Command
test_downstream() {
COMMAND="cd ../$1 && ${@:2}"
echo "Running: ($COMMAND)"
(eval $COMMAND)
echo "... done: ($COMMAND)"
}
if [[ "${GROUP}" == "downstream-ontology" ]]; then
ONTOLOGY_GIT=ontology
ONTOLOGY_BRANCH=master
ONTOLOGY_COMMAND="./gradlew build -x test && ./test-ontology.sh"
./gradlew testLibJar
clone_downstream $ONTOLOGY_GIT $ONTOLOGY_BRANCH
test_downstream $ONTOLOGY_GIT $ONTOLOGY_COMMAND
fi
# Units test (Skip for now)
# if [[ "${GROUP}" == "downstream-units" ]]; then
# UNITS_GIT=units-inference
# UNITS_BRANCH=master
# UNITS_COMMAND="./gradlew build -x test && ./test-units.sh"
#
# clone_downstream $UNITS_GIT $UNITS_BRANCH
# test_downstream $UNITS_GIT $UNITS_COMMAND
# fi
# Security Demo test
if [[ "${GROUP}" == "downstream-security-demo" ]]; then
SECURITY_GIT=security-demo
SECURITY_BRANCH=master
SECURITY_COMMAND="./gradlew build -x test && ./test-security.sh"
./gradlew testLibJar
clone_downstream $SECURITY_GIT $SECURITY_BRANCH
test_downstream $SECURITY_GIT $SECURITY_COMMAND
fi
# Universe test
if [[ "${GROUP}" == "downstream-universe" ]]; then
UNIVERSE_GIT=universe
UNIVERSE_BRANCH=master
UNIVERSE_COMMAND="./gradlew build -x test && ./gradlew test"
clone_downstream $UNIVERSE_GIT $UNIVERSE_BRANCH
test_downstream $UNIVERSE_GIT $UNIVERSE_COMMAND
fi
fi
echo Exiting "$(cd "$(dirname "$0")" && pwd -P)/$(basename "$0")" in `pwd`