summaryrefslogtreecommitdiff
path: root/test-art-target-test.sh
blob: a41966c23d1f76c10f0fd77d65e40ec5d193f86e (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
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
#!/bin/bash

export LEGACY_USE_JAVA7=true
# We do not use a tmpfs out/target/product in this test
NO_TMPFS_TARGET_PRODUCT=y
. $PWD/setup-android.sh
[[ $JENKINS_MODE ]] && sudo chmod 1777 /tmp

TEST_ART_COMMAND="test-art-target"
TEST_ART_OUTPUT_DIR=$WORKSPACE/$TEST_ART_COMMAND/
export GTEST_OUTPUT=xml:$TEST_ART_OUTPUT_DIR
MAKE_TARGETS=$TEST_ART_COMMAND
mkdir -p $WORKSPACE/$TEST_ART_COMMAND/

if [[ ! -e ./art/tools/buildbot-build.sh ]]; then
    wget https://android-git.linaro.org/gitweb/platform/art.git/blob_plain/refs/heads/master:/tools/buildbot-build.sh -O ./art/tools/buildbot-build.sh
    sed -i "s/build-art-target-tests/build-art-target/g" ./art/tools/buildbot-build.sh
    chmod a+x ./art/tools/buildbot-build.sh
else
    cd system/core;  git reset --hard dda68c0fcfe4ced4ae410821c7681f02a2b9aff2
    cd ../../
fi

MAKE_START=$(date +%s.%N)
source build/envsetup.sh
lunch armv8-eng
export ANDROID_COMPILE_WITH_JACK=true
export CUSTOM_TARGET_LINKER=/data/local/tmp/system/bin/linker64
export ANDROID_PRODUCT_OUT=$PWD/out/target/product/armv8/
export TARGET_PRODUCT=armv8
./art/tools/buildbot-build.sh -j12 --target

if [[ $? -ne 0 ]]; then
    echo "Error: *** buildbot-build setup failed. Exiting the build"
    exit 1
fi

# Build servers do not necessarily have up to date udev rules, start adb-server
# as root to avoid the issue
[[ $JENKINS_MODE ]] && sudo out/host/linux-x86/bin/adb start-server
[[ $JENKINS_MODE ]] && adb root

if [[ $? -ne 0 ]]; then
    echo "Error: *** Device is not accessible. Please check the setup"
    exit 1
fi

[[ $JENKINS_MODE ]] && echo "Building on: " `hostname` >> $WORKSPACE/device_log.txt
[[ $JENKINS_MODE ]] && echo "***********************************************" >> $WORKSPACE/device_log.txt
[[ $JENKINS_MODE ]] && echo "****** Battery level before 64bit tests ********" >> $WORKSPACE/device_log.txt
[[ $JENKINS_MODE ]] && adb shell dumpsys battery >> $WORKSPACE/device_log.txt
[[ $JENKINS_MODE ]] && sudo dmesg -C

adb shell rm -rf /data/local/tmp /data/art-test /data/nativetest
./art/tools/setup-buildbot-device.sh

export ART_BUILD_HOST_DEBUG=false
export ART_TEST_ANDROID_ROOT="/data/local/tmp/system"
export ART_TEST_FULL=false
export ART_TEST_INTERPRETER=true
export ART_TEST_KEEP_GOING=true
export ART_TEST_OPTIMIZING=true
export ART_TEST_RUN_TEST_2ND_ARCH=false
export ART_TEST_RUN_TEST_DEBUG=false
export ART_TEST_RUN_TEST_NDEBUG=true
export ART_USE_OPTIMIZING_COMPILER=true
failed=0
actually_failed=0

make -j12 test-art-target-sync

export ART_TEST_NO_SYNC=true

./art/tools/run-libcore-tests.sh  --mode=device --variant=X64   > $WORKSPACE/build-logs-libcore-tests.txt 2>&1

if [[ $? -ne 0 ]]; then
    echo "Error: *** libcore tests failed"
    cat $WORKSPACE/build-logs-libcore-tests.txt
    failed=1
fi

make -j2 test-art-target-gtest64  > $WORKSPACE/build-logs-gtest-64.txt 2>&1

if [[ $? -ne 0 ]]; then
    echo "Error: *** Error test-art-target-gtest64 failed"
    cat $WORKSPACE/build-logs-gtest-64.txt
    failed=1
fi

make -j2 test-art-target-run-test-default  >> $WORKSPACE/build-logs-run-test-default-64.txt 2>&1

if [[ $? -ne 0 ]]; then
    echo "Error: *** Error test-art-target-run-test-default failed"
    cat $WORKSPACE/build-logs-run-test-default-64.txt
    failed=1
fi

make -j2 test-art-target-run-test-interpreter  >> $WORKSPACE/build-logs-run-test-interpreter-64.txt 2>&1

if [[ $? -ne 0 ]]; then
    echo "Error: *** Error test-art-target-run-test-interpreter failed"
    cat $WORKSPACE/build-logs-run-test-interpreter-64.txt
    failed=1
fi

export ART_TEST_RUN_TEST_DEBUGGABLE=true

make -j2 test-art-target-run-test-optimizing  >> $WORKSPACE/build-logs-run-test-optimizing-64.txt 2>&1

if [[ $? -ne 0 ]]; then
    echo "Error: *** Error test-art-target-run-test-optimizing failed"
    cat $WORKSPACE/build-logs-run-test-optimizing-64.txt
    failed=1
fi

cat $WORKSPACE/build-logs-gtest-64.txt > $WORKSPACE/build-logs-64.txt
cat $WORKSPACE/build-logs-run-test-default-64.txt >> $WORKSPACE/build-logs-64.txt
cat $WORKSPACE/build-logs-run-test-interpreter-64.txt >> $WORKSPACE/build-logs-64.txt
cat $WORKSPACE/build-logs-run-test-optimizing-64.txt >> $WORKSPACE/build-logs-64.txt

echo "YVALUE=`grep "2mPASSED" $WORKSPACE/build-logs-64.txt | grep "gtest" | wc -l`" > $WORKSPACE/gtest-pass_count-64.txt
echo "YVALUE=`grep "1mFAILED" $WORKSPACE/build-logs-64.txt | grep "gtest" | wc -l`" > $WORKSPACE/gtest-fail_count-64.txt
echo "YVALUE=`grep "3mSKIPPING" $WORKSPACE/build-logs-64.txt | grep "gtest" | wc -l`" > $WORKSPACE/gtest-skip_count-64.txt
echo "YVALUE=`grep "2mPASSED" $WORKSPACE/build-logs-64.txt | grep "run-test" | wc -l`" > $WORKSPACE/run-test-pass_count-64.txt
echo "YVALUE=`grep "1mFAILED" $WORKSPACE/build-logs-64.txt | grep "run-test" | wc -l`" > $WORKSPACE/run-test-fail_count-64.txt
echo "YVALUE=`grep "3mSKIPPING" $WORKSPACE/build-logs-64.txt | grep "run-test" | wc -l`" > $WORKSPACE/run-test-skip_count-64.txt
#grep -rni "1mFAILED" $WORKSPACE/build-logs-64.txt | sed  "s/.*://g" | sed "s/ .*//g" > $WORKSPACE/failing-tests-64.txt
#grep -rni "3mSKIPPING" $WORKSPACE/build-logs-64.txt | sed  "s/.*://g" | sed "s/ .*//g" > $WORKSPACE/skipped-tests-64.txt

[[ $JENKINS_MODE ]] && echo "***********************************************" >> $WORKSPACE/device_log.txt
[[ $JENKINS_MODE ]] && echo "****** Battery level after 64bit tests ********" >> $WORKSPACE/device_log.txt
[[ $JENKINS_MODE ]] && adb shell dumpsys battery >> $WORKSPACE/device_log.txt

rm -rf out/target/product/armv8*

adb shell rm -rf /data/local/tmp /data/art-test /data/nativetest

source build/envsetup.sh
lunch aosp_flounder32-eng
export CUSTOM_TARGET_LINKER=/data/local/tmp/system/bin/linker
export ANDROID_PRODUCT_OUT=$PWD/out/target/product/flounder32/
export TARGET_PRODUCT=aosp_flounder32
export ANDROID_COMPILE_WITH_JACK=true
time ./art/tools/buildbot-build.sh -j12 --target
./art/tools/setup-buildbot-device.sh
export ART_TEST_RUN_TEST_DEBUGGABLE=false
export ART_BUILD_HOST_DEBUG=false
export ART_TEST_ANDROID_ROOT="/data/local/tmp/system"
export ART_TEST_FULL=false
export ART_TEST_INTERPRETER=true
export ART_TEST_KEEP_GOING=true
export ART_TEST_OPTIMIZING=true
export ART_TEST_RUN_TEST_2ND_ARCH=false
export ART_TEST_RUN_TEST_DEBUG=false
export ART_TEST_RUN_TEST_NDEBUG=true
export ART_TEST_RUN_TEST_DEBUGGABLE=false
export ART_USE_OPTIMIZING_COMPILER=true
export ART_TEST_NO_SYNC=false


make -j12 test-art-target-sync

export ART_TEST_NO_SYNC=true

./art/tools/run-libcore-tests.sh  --mode=device --variant=X32   >> $WORKSPACE/build-logs-libcore-tests.txt 2>&1

if [[ $? -ne 0 ]]; then
    echo "Error: *** libcore tests failed"
    cat $WORKSPACE/build-logs-libcore-tests.txt
    failed=1
fi

make -j2 test-art-target-gtest32  > $WORKSPACE/build-logs-gtest-32.txt 2>&1

if [[ $? -ne 0 ]]; then
    echo "Error: *** Error test-art-target-gtest64 failed"
    cat $WORKSPACE/build-logs-gtest-32.txt
    failed=1
fi

make -j2 test-art-target-run-test-default  >> $WORKSPACE/build-logs-run-test-default-32.txt 2>&1

if [[ $? -ne 0 ]]; then
    echo "Error: *** Error test-art-target-run-test-default failed"
    cat $WORKSPACE/build-logs-run-test-default-32.txt
    failed=1
fi

make -j2 test-art-target-run-test-interpreter  >> $WORKSPACE/build-logs-run-test-interpreter-32.txt 2>&1

if [[ $? -ne 0 ]]; then
    echo "Error: *** Error test-art-target-run-test-interpreter failed"
    cat $WORKSPACE/build-logs-run-test-interpreter-32.txt
    failed=1
fi

export ART_TEST_RUN_TEST_DEBUGGABLE=true

make -j2 test-art-target-run-test-optimizing  >> $WORKSPACE/build-logs-run-test-optimizing-32.txt 2>&1

if [[ $? -ne 0 ]]; then
    echo "Error: *** Error test-art-target-run-test-optimizing failed"
    cat $WORKSPACE/build-logs-run-test-optimizing-32.txt
    failed=1
fi

cat $WORKSPACE/build-logs-gtest-32.txt > $WORKSPACE/build-logs-32.txt
cat $WORKSPACE/build-logs-run-test-default-32.txt >> $WORKSPACE/build-logs-32.txt
cat $WORKSPACE/build-logs-run-test-interpreter-32.txt >> $WORKSPACE/build-logs-32.txt
cat $WORKSPACE/build-logs-run-test-optimizing-32.txt >> $WORKSPACE/build-logs-32.txt

echo "YVALUE=`grep "2mPASSED" $WORKSPACE/build-logs-32.txt | grep "gtest" | wc -l`" > $WORKSPACE/gtest-pass_count-32.txt
echo "YVALUE=`grep "1mFAILED" $WORKSPACE/build-logs-32.txt | grep "gtest" | wc -l`" > $WORKSPACE/gtest-fail_count-32.txt
echo "YVALUE=`grep "3mSKIPPING" $WORKSPACE/build-logs-32.txt | grep "gtest" | wc -l`" > $WORKSPACE/gtest-skip_count-32.txt
echo "YVALUE=`grep "2mPASSED" $WORKSPACE/build-logs-32.txt | grep "run-test" | wc -l`" > $WORKSPACE/run-test-pass_count-32.txt
echo "YVALUE=`grep "1mFAILED" $WORKSPACE/build-logs-32.txt | grep "run-test" | wc -l`" > $WORKSPACE/run-test-fail_count-32.txt
echo "YVALUE=`grep "3mSKIPPING" $WORKSPACE/build-logs-32.txt | grep "run-test" | wc -l`" > $WORKSPACE/run-test-skip_count-32.txt
#grep -rni "1mFAILED" $WORKSPACE/build-logs-32.txt | sed  "s/.*://g" | sed "s/ .*//g" > $WORKSPACE/failing-tests-32.txt
#grep -rni "3mSKIPPING" $WORKSPACE/build-logs-32.txt | sed  "s/.*://g" | sed "s/ .*//g" > $WORKSPACE/skipped-tests-32.txt


MAKE_END=$(date +%s.%N)

MAKE_TIME=$(echo "$MAKE_END - $MAKE_START" | bc)
echo "YVALUE=$MAKE_TIME" > $WORKSPACE/make_time.txt
echo "YVALUE=$REPO_TIME" > $WORKSPACE/repo_time.txt
ccache -s

[[ $JENKINS_MODE ]] && echo "***********************************************" >> $WORKSPACE/device_log.txt
[[ $JENKINS_MODE ]] && echo "****** Battery level after 32bit tests ********" >> $WORKSPACE/device_log.txt
[[ $JENKINS_MODE ]] && adb shell dumpsys battery >> $WORKSPACE/device_log.txt
[[ $JENKINS_MODE ]] && echo "*********** Dumping dmesg output *************" >> $WORKSPACE/device_log.txt
[[ $JENKINS_MODE ]] && dmesg >> $WORKSPACE/device_log.txt

if [[ $failed -ne 0 ]]; then
    cat $WORKSPACE/build-logs-libcore-tests.txt | grep "FAIL " | sed "s/^[ \t]*//" | sed -e "s/ .*//g" > $WORKSPACE/failed-test.txt
    cat $WORKSPACE/build-logs-32.txt | grep -i "FAILED!" >> $WORKSPACE/failed-test.txt
    cat $WORKSPACE/build-logs-64.txt | grep -i "FAILED!" >> $WORKSPACE/failed-test.txt
    grep " FAILED" $WORKSPACE/build-logs-32.txt  | grep "^test" | sed -e "s/ FAILED//g" | grep gtest >> $WORKSPACE/failed-test.txt
    grep " FAILED" $WORKSPACE/build-logs-64.txt  | grep "^test" | sed -e "s/ FAILED//g" | grep gtest >> $WORKSPACE/failed-test.txt
    grep "\[91mFAILED" $WORKSPACE/build-logs-32.txt | grep "^test" | sed -e "s/ .*//g" | grep gtest >>$WORKSPACE/failed-test.txt
    grep "\[91mFAILED" $WORKSPACE/build-logs-64.txt | grep "^test" | sed -e "s/ .*//g" | grep gtest >>$WORKSPACE/failed-test.txt
    sed -i "s/.*test\///g" $WORKSPACE/failed-test.txt
    sed -i "s/: FAILED\!//g" $WORKSPACE/failed-test.txt
    IFS=';' read -r -a ignored_tests <<< $CURRENT_FAILING_ART_TESTS
    for test in ${ignored_tests[@]}
    do
       echo $test >> $WORKSPACE/ignored_tests.txt
    done
    while read p; do
        if ! grep -i $p $WORKSPACE/ignored_tests.txt; then
            actually_failed=1
            export failing_tests="$failing_tests $p"
        fi
    done < $WORKSPACE/failed-test.txt
       
    echo "*********** Dumping dmesg output *************"
    dmesg
    echo "*********** Battery LEVEL *****************"
    out/host/linux-x86/bin/adb shell dumpsys battery
    if [[ $actually_failed -ne 0 ]]; then
        set +x
        echo "$failing_tests tests have failed"
        exit 1
    fi
    exit 0
fi