aboutsummaryrefslogtreecommitdiff
path: root/benchmarks-script/glbenchmark/run.sh
blob: 0ff7cd0a8d1017b27f2fc1077378d26770298840 (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
#!/bin/bash

#need to be defined for different benchmark apks
activity="com.glbenchmark.glbenchmark25/com.glbenchmark.activities.GLBenchmarkDownloaderActivity"
#apk_file_name="GLBenchmark_v2.5.apk"
apk_file_name="GLBenchmark_2.5.1.apk"
test_method="testGLBenchmark"
apk_package="com.glbenchmark.glbenchmark25"
export DEV_ID=$1

function func_post_install(){
    #get the obb file and push it into android
    mkdir -p "${parent_dir}/Android/obb/com.glbenchmark.glbenchmark25"
    obb_file_name="main.1.com.glbenchmark.glbenchmark25.obb"
    obb_file_path="${parent_dir}/Android/obb/com.glbenchmark.glbenchmark25/${obb_file_name}"
    if [ ! -f "${obb_file_path}" ]; then
        get_file_with_base_url "${obb_file_name}"
        cp -uvf "${APKS_DIR}/${obb_file_name}" "${parent_dir}/Android/obb/com.glbenchmark.glbenchmark25/${obb_file_name}"
    fi
    adb push ${parent_dir}/Android /storage/sdcard0/Android

    user=`adb shell ls -l /data/data/|grep com.glbenchmark.glbenchmark25|cut -d \  -f 2`
    user=`echo ${user}|sed 's/\r//'`
    dir_prefs="/data/data/com.glbenchmark.glbenchmark25/shared_prefs"
    adb -s $DEV_ID push ${parent_dir}/shared_prefs "${dir_prefs}"
    adb -s $DEV_ID shell chown ${user}:${user} "${dir_prefs}"
    adb -s $DEV_ID shell chmod 771 "${dir_prefs}"
    adb -s $DEV_ID shell chown ${user}:${user} "${dir_prefs}/com.glbenchmark.glbenchmark25_preferences.xml"
    adb -s $DEV_ID shell chmod 660 "${dir_prefs}/com.glbenchmark.glbenchmark25_preferences.xml"
}

#following should no need to modify
parent_dir=`dirname ${0}`
source "${parent_dir}/../common/common.sh"
post_install="func_post_install"
pre_uninstall="adb -s $DEV_ID pull /data/data/com.glbenchmark.glbenchmark25/cache/last_results_2.5.1.xml $parent_dir/last_results_2.5.1.xml"
main "$@"