forked from jenkinsci/acceptance-test-harness
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·83 lines (66 loc) · 1.84 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
#!/bin/bash
if [[ $# -lt 2 ]]; then
cat <<-USAGE
Usage: $0 BROWSER JENKINS [ARGS]
It can use jenkins.war from local maven repository or download it when missing.
BROWSER: Value for BROWSER variable
JENKINS: Path to the Jenkins WAR, URL to the Jenkins WAR, version of the Jenkins WAR, "latest", or "lts"
Examples:
# Run full suite in Firefox against a URL:
$ ./run firefox https://updates.jenkins.io/download/war/2.394/jenkins.war
# Run full suite in Firefox against ./jenkins.war:
$ ./run firefox ./jenkins.war
# Run Ant plugin test in chrome against Jenkins 2.399:
$ ./run chrome 2.399 -Dtest=AntPluginTest
# Run full suite in Firefox against LTS:
$ ./run firefox lts
USAGE
exit 2
fi
MVN='mvn -V -e -ntp'
if [[ -n ${MAVEN_SETTINGS-} ]]; then
MVN="${MVN} -s ${MAVEN_SETTINGS}"
fi
function download() {
echo "Fetching $1 to $2"
status=$(curl --http1.1 -sSL --write-out '%{http_code}' --retry 3 --retry-delay 0 --retry-max-time 60 -o "$2" "$1")
if [[ $status -ne 200 ]]; then
echo >&2 "Failed to fetch the $1 ($status) to $2"
return 1
fi
}
if [[ -z $DISPLAY ]] && [[ -z $BROWSER_DISPLAY ]]; then
echo >&2 'Neither DISPLAY nor BROWSER_DISPLAY defined. Is the VNC server running?'
exit 1
fi
browser=$1
war=$2
extra_args=
if [[ ! -f $war ]]; then
case "$war" in
latest)
# Maven will download this in the process-test-resources phase
war=target/jenkins-war.war
;;
lts)
# Maven will download this in the process-test-resources phase
war=target/jenkins-war.war
extra_args='-Plts'
;;
*.war)
download "$war" "jenkins.war" || exit 1
war=jenkins.war
;;
*)
# Maven will download this in the process-test-resources phase
war=target/jenkins-war.war
extra_args="-Djenkins.version=$2"
;;
esac
fi
shift 2
if [[ $# -eq 0 ]]; then
extra_args+=' test'
fi
set -x
BROWSER=$browser JENKINS_WAR=$war $MVN $extra_args "$@"