-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupdateTestResultsPages.sh
executable file
·186 lines (152 loc) · 4.79 KB
/
updateTestResultsPages.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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
#!/usr/bin/env bash
# Utility to invoke eclipse antrunner to update test index pages and
# re-sync dl site.
# this localBuildProperties.shsource file is to ease local builds to override some variables.
# It should not be used for production builds.
source localBuildProperties.shsource 2>/dev/null
function show_time () {
num=$1
min=0
hour=0
day=0
if((num>59));then
((sec=num%60))
((num=num/60))
if((num>59));then
((min=num%60))
((num=num/60))
if((num>23));then
((hour=num%24))
((day=num/24))
else
((hour=num))
fi
else
((min=num))
fi
else
((sec=num))
fi
echo "$day d $hour h $min m $sec s"
}
if (( $# < 3 ))
then
# usage:
scriptname=$(basename $0)
printf "\n\t%s\n" "This script, $scriptname requires three arguments, in order: "
printf "\t\t%s\t%s\n" "eclipseStream" "(e.g. 4.2.0 or 3.8.0) "
printf "\t\t%s\t%s\n" "buildId" "(e.g. N20120415-2015) "
printf "\t\t%s\t%s\n" "jobName" "(e.g. ep4I-unit-lin64) "
printf "\t\t%s\t%s\n" "jobNumber" "(e.g. 59) "
printf "\t%s\n" "for example,"
printf "\t%s\n\n" "./$scriptname 4.2.0 N20120415-2015 ep4I-unit-lin64 59"
exit 1
fi
eclipseStream=$1
if [ -z "${eclipseStream}" ]
then
echo "must provide eclipseStream as first argument, for this function $0"
exit 1
fi
buildId=$2
if [ -z "${buildId}" ]
then
echo "must provide buildId as second argument, for this function $0"
exit 1
fi
JOB_NAME=$3
if [ -z "${JOB_NAME}" ]
then
echo "must provide JOB_NAME as third argument, for this function $0"
exit 1
fi
JOB_NUMBER=$4
if [ -z "${JOB_NUMBER}" ]
then
# technically, not required, though later may want to force and error, since
# probably indicates something is wrong.
echo -e "\n\tERROR: JOB_NUMBER as fourth argument, not provided to this function $0. Exiting."
exit 1
fi
eclipseStreamMajor=${eclipseStream:0:1}
buildType=${buildId:0:1}
pathToDL=eclipse/downloads/drops
if (( $eclipseStreamMajor > 3 ))
then
pathToDL=eclipse/downloads/drops$eclipseStreamMajor
fi
buildRoot=${BUILD_HOME}/${eclipseStreamMajor}${buildType}
siteDir=${buildRoot}/siteDir
fromDir=${siteDir}/${pathToDL}/${buildId}
if [ ! -d "${fromDir}" ]
then
echo "ERROR: fromDir is not a directory? fromDir: ${fromDir}"
exit 1
fi
JAVA_11_HOME=${JAVA_11_HOME:-/opt/public/common/java/openjdk/jdk-11_x64-latest}
export JAVA_HOME=${JAVA_HOME:-${JAVA_11_HOME}}
devJRE=$JAVA_HOME/jre/bin/java
if [[ ! -n ${devJRE} && -x ${devJRE} ]]
then
echo "ERROR: could not find (or execute) JRE where expected: ${devJRE}"
exit 1
else
# display version, just to be able to log it.
echo "JRE Location and Version: ${devJRE}"
echo $( $devJRE -version )
fi
# We use a separate basebuilder for each "drop", to make sure it is specific for that drop,
# and they won't interfere with each other.
basebuilderDir=${fromDir}/org.eclipse.releng.basebuilder
aggregatorDir=${fromDir}/eclipse.platform.releng.aggregator
EBuilderDir=${aggregatorDir}/eclipse.platform.releng.tychoeclipsebuilder
if [[ ! -d "${basebuilderDir}" ]]
then
# WORKSPACE, here, is the "Hudson-type" of workspace, not eclipse.
ant -f $EBuilderDir/eclipse/getBaseBuilderAndTools.xml -DWORKSPACE=${fromDir}
fi
# remember, the Eclipse install must match the VM used (e.g. both 64 bit, both 32 bit, etc).
ECLIPSE_EXE="${basebuilderDir}/eclipse"
# somehow, seems like this is often not executable ... I guess launcher jar usually used.
chmod -c +x $ECLIPSE_EXE
if [ ! -n ${ECLIPSE_EXE} -a -x ${ECLIPSE_EXE} ]
then
echo "ERROR: ECLIPSE_EXE is not defined or not executable: ${ECLIPSE_EXE}"
exit 1
fi
# Normal unit tests
unittestJobPattern="^.*-unit-.*$"
#if [[ $JOB_NAME =~ ${unittestJobPattern} ]]
#then
BUILDFILE=${aggregatorDir}/production/testScripts/genTestIndexes.xml
BUILDFILESTR="-f ${BUILDFILE}"
echo
echo " BUILDFILESTR: $BUILDFILESTR"
# provide blank, to get default
BUILDTARGET=" "
devworkspace="${fromDir}/workspace-updateTestResults"
devArgs="-Xmx512m -Dhudson=true -DbuildHome=${BUILD_HOME} -DeclipseStream=${eclipseStream} -DeclipseStreamMajor=${eclipseStreamMajor} -DbuildId=${buildId} -Djob=$JOB_NAME"
echo
echo " = = Properties in updateTestResultsPages.sh: generate section = = "
echo " dev script: $0"
echo " BUILD_HOME: ${BUILD_HOME}"
echo " devworkspace: $devworkspace"
echo " devArgs: $devArgs"
echo " devJRE: $devJRE"
echo " BUILDFILESTR: $BUILDFILESTR"
echo " job: $JOB_NAME"
echo
if [ -n ${ECLIPSE_EXE} -a -x ${ECLIPSE_EXE} ]
then
${ECLIPSE_EXE} --launcher.suppressErrors -nosplash -consolelog -data $devworkspace -application org.eclipse.ant.core.antRunner $BUILDFILESTR $BUILDTARGET -vm $devJRE -vmargs $devArgs
RC=$?
if [[ $RC != 0 ]]
then
echo "ERROR: eclipse returned non-zero return code, exiting with RC: $RC."
exit $RC
fi
else
echo "ERROR: ECLIPSE_EXE is not defined to executable eclipse."
RC=1
exit $RC
fi