summaryrefslogtreecommitdiff
path: root/acov.sh
blob: 7bf0b4ae2f3d45249519d9fc8f6d6c0dc4f9a3a4 (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
#!/bin/bash
. $PWD/setup-android.sh

set -e

export flags="-B NATIVE_COVERAGE=true ART_COVERAGE=true"
source build/envsetup.sh
lunch aosp_arm64-eng
acov --clean

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-host-tests/build-art-host/g" ./art/tools/buildbot-build.sh
    chmod a+x ./art/tools/buildbot-build.sh
fi

TEST_ART_COMMAND="test-art-host-gtest"
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/
source build/envsetup.sh
lunch aosp_arm64-userdebug
./art/tools/buildbot-build.sh -j8 --host

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
make -j8 $MAKE_TARGETS

for target in "ARM" "x86" "mips"; do
    if [[ $target = "ARM" ]]; then
        lunch aosp_arm64-eng
        out_dir=generic_arm64
    elif [[ $target = "mips" ]]; then
        lunch aosp_mips64-eng
        out_dir=generic_mips64
    else
        lunch aosp_x86_64-eng
        out_dir=generic_x86_64
    fi

    make $flags -j$jcpu_count dex2oatd dex2oat
    for mode in Quick Optimizing; do
        sed -i "s/\$(COMPILED_CLASSES_FLAGS)/\$(COMPILED_CLASSES_FLAGS) --compiler-backend=$mode/g" build/core/dex_preopt_libart_boot.mk
        for arch in 32 64; do
            case $target in
                "ARM")
                    [[ $arch = 32 ]] && libdir="arm"
                    [[ $arch = 64 ]] && libdir="arm64"
                    ;;
                "mips")
                    [[ $arch = 32 ]] && libdir="mips"
                    [[ $arch = 64 ]] && libdir="mips64"
                    ;;
                "x86")
                    [[ $arch = 32 ]] && libdir="x86"
                    [[ $arch = 64 ]] && libdir="x86_64"
                    ;;
            esac

            [[ $target = "mips" && $arch = 32 && $mode = "Optimizing" ]] && continue
            [[ $target = "mips" && $arch = 64 && $mode = "Quick" ]] && continue

            make -j$jcpu_count $flags out/target/product/$out_dir/system/framework/$libdir/boot.art > logs.txt 2>&1
            cat logs.txt
            cat logs.txt  | grep "dex2oatd --runtime-arg" > cmd.txt
            sed -i "s/.*out\/host\/linux-x86\/bin\/dex2oatd/out\/host\/linux-x86\/bin\/dex2oat/g" cmd.txt
            `cat cmd.txt`
        done

        cd build/core
        git reset --hard
        cd -
    done
done

export EXTRA_ARGS=--gcov-tool=/usr/bin/gcov-4.6
mkdir -p $WORKSPACE/gcov-results
lcov -c -b $ANDROID_BUILD_TOP -d $ANDROID_HOST_OUT -o $WORKSPACE/gcov-results/results $EXTRA_ARGS
genhtml -q -o $WORKSPACE/gcov-results/ $WORKSPACE/gcov-results/results
acovscore=`grep " %" $WORKSPACE/gcov-results/index.html  | sed -e "s/.*\">//g" | sed -e "s/%.*//g"`
var=1
for score in $acovscore; do
    echo "YVALUE=$score" > $WORKSPACE/overall_$var.txt
    var=$((var+1))
done
acovscore=`grep " %" $WORKSPACE/gcov-results/art/compiler/optimizing/index.html  | sed -e "s/.*\">//g" | sed -e "s/%.*//g"`
var=1
for score in $acovscore; do
    echo "YVALUE=$score" > $WORKSPACE/optimizing_$var.txt
    var=$((var+1))
done

ccache -s