forked from jenkinsci/acceptance-test-harness
-
Notifications
You must be signed in to change notification settings - Fork 0
/
set-java.sh
executable file
·38 lines (33 loc) · 1.04 KB
/
set-java.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
#!/usr/bin/env bash
# Inspired by https://disconnected.systems/blog/another-bash-strict-mode/
set -uo pipefail
trap 's=$?; echo >&2 "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR
# The selection used by update-alternatives for each java version
if [[ $1 == '17' ]]; then
selection='17-openjdk'
elif [[ $1 == '21' ]]; then
selection='21-openjdk'
else
echo >&2 "Unsupported java version '${1}'"
exit 1
fi
# For some reason, all tools from JDK are split to 2 groups named java and javac
JAVA_PATH=$(update-alternatives --list java | grep $selection)
JAVAC_PATH=$(update-alternatives --list javac | grep $selection)
update-alternatives --set java "$JAVA_PATH"
update-alternatives --set javac "$JAVAC_PATH"
echo
echo -------------------- INFORMATION --------------------
echo Running on...
java -version
echo
javac -version
echo
echo Start running tests with...
echo
echo 'eval $(vnc.sh)'
echo
echo run.sh firefox latest -DforkCount=1 -Dmaven.test.failure.ignore=true -B -Dtest=...
echo
echo ------------------ END INFORMATION ------------------
echo