forked from bazelbuild/rules_scala
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdt_patch_test.sh
executable file
·118 lines (99 loc) · 3.78 KB
/
dt_patch_test.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
108
109
110
111
112
113
114
115
116
117
118
#!/usr/bin/env bash
dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
NC='\033[0m'
GREEN='\033[0;32m'
RED='\033[0;31m'
run_test_local() {
# runs the tests locally
set +e
SECONDS=0
TEST_ARG=$@
echo "running test $TEST_ARG"
RES=$($TEST_ARG 2>&1)
RESPONSE_CODE=$?
DURATION=$SECONDS
if [ $RESPONSE_CODE -eq 0 ]; then
echo -e "${GREEN} Test \"$TEST_ARG\" successful ($DURATION sec) $NC"
else
echo -e "${RED} Test \"$TEST_ARG\" failed $NC ($DURATION sec) $NC"
return $RESPONSE_CODE
fi
}
run_in_test_repo() {
local test_command=$1
local test_repo=$2
cd "${dir}/${test_repo}" || exit 1
${test_command}
RESPONSE_CODE=$?
cd ../..
return $RESPONSE_CODE
}
test_compiler_patch() {
local SCALA_VERSION="$1"
run_in_test_repo "bazel build //... --repo_env=SCALA_VERSION=${SCALA_VERSION} //..." "test_dt_patches"
}
test_compiler_srcjar() {
set -o pipefail
local SCALA_VERSION="$1"
run_in_test_repo "bazel build //... --repo_env=SCALA_VERSION=${SCALA_VERSION} //..." "test_dt_patches_user_srcjar" 2>&1 | (! grep "canonical reproducible")
}
test_compiler_srcjar_nonhermetic() {
set -o pipefail
local SCALA_VERSION="$1"
run_in_test_repo "bazel build //... --repo_env=SCALA_VERSION=${SCALA_VERSION} //..." "test_dt_patches_user_srcjar" 2>&1 | grep "canonical reproducible"
}
test_compiler_srcjar_error() {
local SCALA_VERSION="$1"
local EXPECTED_ERROR="scala_compiler_srcjar invalid"
run_in_test_repo "bazel build //... --repo_env=SCALA_VERSION=${SCALA_VERSION} //..." "test_dt_patches_user_srcjar" 2>&1 | grep "$EXPECTED_ERROR"
}
run_test_local test_compiler_patch 2.12.1
#run_test_local test_compiler_patch 2.11.0
#run_test_local test_compiler_patch 2.11.1
#run_test_local test_compiler_patch 2.11.2
#run_test_local test_compiler_patch 2.11.3
#run_test_local test_compiler_patch 2.11.4
#run_test_local test_compiler_patch 2.11.5
#run_test_local test_compiler_patch 2.11.6
#run_test_local test_compiler_patch 2.11.7
#run_test_local test_compiler_patch 2.11.8
#run_test_local test_compiler_patch 2.11.9
#run_test_local test_compiler_patch 2.11.10
#run_test_local test_compiler_patch 2.11.11
run_test_local test_compiler_patch 2.11.12
#run_test_local test_compiler_patch 2.12.0
run_test_local test_compiler_patch 2.12.1
run_test_local test_compiler_patch 2.12.2
run_test_local test_compiler_patch 2.12.3
run_test_local test_compiler_patch 2.12.4
run_test_local test_compiler_patch 2.12.5
run_test_local test_compiler_patch 2.12.6
run_test_local test_compiler_patch 2.12.7
run_test_local test_compiler_patch 2.12.8
run_test_local test_compiler_patch 2.12.9
run_test_local test_compiler_patch 2.12.10
run_test_local test_compiler_patch 2.12.11
run_test_local test_compiler_patch 2.12.12
run_test_local test_compiler_patch 2.12.13
run_test_local test_compiler_patch 2.12.14
run_test_local test_compiler_patch 2.12.15
run_test_local test_compiler_patch 2.12.16
run_test_local test_compiler_patch 2.13.0
run_test_local test_compiler_patch 2.13.1
run_test_local test_compiler_patch 2.13.2
run_test_local test_compiler_patch 2.13.3
run_test_local test_compiler_patch 2.13.4
run_test_local test_compiler_patch 2.13.5
run_test_local test_compiler_patch 2.13.6
run_test_local test_compiler_patch 2.13.7
run_test_local test_compiler_patch 2.13.8
run_test_local test_compiler_srcjar_error 2.12.11
run_test_local test_compiler_srcjar_error 2.12.12
run_test_local test_compiler_srcjar_error 2.12.13
# These tests are semi-stateful, if two tests are run sequentially with the
# same Scala version, the DEBUG message about a canonical reproducible form
# that we grep for will only be outputted the first time (on Bazel >= 6).
run_test_local test_compiler_srcjar 2.12.14
run_test_local test_compiler_srcjar 2.12.15
run_test_local test_compiler_srcjar 2.12.16
run_test_local test_compiler_srcjar_nonhermetic 2.12.17