~andreas-pokorny/mir/use-ld-preload-in-test-script

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
#!/bin/bash
# build script for Mir on android arm devices
# script assumes that the Mir dependencies are already set up on the device.
# if they are not set up, see the setup-android-dependencies.sh script
# test run requires package 'android-tools-adb'
# test also assumes that the device is rooted and accessible over the adb bridge
#
# todo: this script should become part of the 'make install'/'make test' system
#

set -e

if [ -z ${1} ]; then
    BUILD_DIR=build-android-arm
else
    BUILD_DIR=${1}
fi

pushd ${BUILD_DIR} > /dev/null 
    #
    # Upload and run the tests!
    # Requires: https://wiki.canonical.com/ProductStrategyTeam/Android/Deploy
    #
    RUN_DIR=/home/phablet/mirtest

    adb wait-for-device
    adb shell mkdir -p ${RUN_DIR}/udev_recordings

    for x in bin/mir_acceptance_tests \
             bin/mir_integration_tests \
             bin/mir_unit_tests \
             lib/libmirclient.so.* \
             lib/libmircommon.so.* \
             lib/libmirplatform.so.* \
             lib/libmirplatform*driver.so \
             lib/libmirclient*driver.so \
             lib/libmirprotobuf.so.* \
             lib/libmirclient-debug-extension.so.* \
             lib/libmirplatformstub.so \
             lib/libmirserver.so.*
    do
        adb push $x ${RUN_DIR}
    done

    for x in bin/udev_recordings/*
    do 
        adb push $x ${RUN_DIR}/udev_recordings
    done

    echo "cd ${RUN_DIR};
        export GTEST_OUTPUT=xml:./;
        export LD_LIBRARY_PATH=.;
        ./mir_unit_tests;
        ./mir_integration_tests;
        ./mir_acceptance_tests;
        exit;
        exit" | adb shell

    adb pull "${RUN_DIR}/mir_acceptance_tests.xml"
    adb pull "${RUN_DIR}/mir_integration_tests.xml"
    adb pull "${RUN_DIR}/mir_unit_tests.xml"

popd > /dev/null