blob: 950370245714048bf374291bf9afaa71d26ab3b0 (
plain)
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
|
#!/bin/bash
# LAVA wrapper for invoking jtreg(1) and accumulating the results.
#
# Copyright (C) 2013, Linaro Limited.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# Author: Andrew McDermott <andrew.mcdermott@linaro.org>
#
# All options before the '--' are for this script. The remaining are
# for jtreg(1).
test_case=unknown
java_vm=-client
product_home=/usr/lib/jvm/java-8-openjdk
while getopts ":j:o:p:t:" opt; do
case $opt in
j)
java_vm=$OPTARG
;;
o)
output_dir=$OPTARG
;;
p)
product_home=$OPTARG
;;
t)
test_case=$OPTARG
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
shift $((OPTIND-1))
output_dir=/tmp/jtreg/$test_case.$$
rm -rf $output_dir
jtreg \
-J${java_vm} \
-vmoption:${java_vm} \
-jdk:"${product_home}" \
-w:$output_dir/JTwork \
-r:$output_dir/JTreport \
"$@"
exit_code=$?
shopt -s globstar
shopt -s nullglob
# By pushd'ing we make the attached filenames in the LAVA dashboard
# much smaller.
process_file() {
local filename=$1
local result=$2
local ofile=/tmp/jtreg-test-process-file.$$
echo "#!/bin/bash" > $ofile
while IFS=' ' read -r tc rem; do
y=$(dirname $tc)
z=$(basename $tc .java)
test_result=$output_dir/JTwork/$y/${z}.jtr
echo "lava-test-case $z --result $result" >> $ofile
if [ -e $test_result ]; then
echo "pushd $output_dir/JTwork >/dev/null" >> $ofile
echo "lava-test-case-attach $z $y/${z}.jtr text/plain" >> $ofile
echo "popd > /dev/null" >> $ofile
fi
done < $filename
[ -e $ofile ] && chmod 755 $ofile
[ -e $ofile ] && $ofile
rm -f $ofile
}
if [ -d $output_dir/JTreport/text ]; then
pushd $output_dir/JTreport/text
for i in *.txt; do
lava-test-run-attach $i
if [ $i = "summary.txt" ]; then
egrep '[^ ]+[ ]+Not run\.' $i > notrun.txt
egrep '[^ ]+[ ]+(Failed|Error)\.' $i > failed.txt
egrep '[^ ]+[ ]+Passed\.' $i > pass.txt
lava-test-run-attach notrun.txt
lava-test-run-attach failed.txt
lava-test-run-attach pass.txt
process_file pass.txt pass
process_file failed.txt fail
fi
done
popd
fi
if [ -d $output_dir ]; then
pushd $output_dir
# Remove .class files as they are quite large.
find . -name \*.class -print | xargs rm
zip --quiet -r RESULTS-BUNDLE.zip *
lava-test-run-attach RESULTS-BUNDLE.zip
popd
fi
rm -rf $output_dir
exit $exit_code
|