1*20bfefbeSAndroid Build Coastguard Worker# Device Configuration for localization_rendering_tests # 2*20bfefbeSAndroid Build Coastguard Worker 3*20bfefbeSAndroid Build Coastguard Worker## Setup ## 4*20bfefbeSAndroid Build Coastguard WorkerInclude the following three files in a new directory that you would want to run 5*20bfefbeSAndroid Build Coastguard Workeryour test from. These files would be referred to as the configuration files. 6*20bfefbeSAndroid Build Coastguard Worker* Android.bp 7*20bfefbeSAndroid Build Coastguard Worker* TEST_MAPPING 8*20bfefbeSAndroid Build Coastguard Worker* test_main.cpp 9*20bfefbeSAndroid Build Coastguard Worker 10*20bfefbeSAndroid Build Coastguard Worker 11*20bfefbeSAndroid Build Coastguard Worker## Android.bp file ## 12*20bfefbeSAndroid Build Coastguard WorkerDefine a new module in the Android.bp file. 13*20bfefbeSAndroid Build Coastguard Worker 14*20bfefbeSAndroid Build Coastguard WorkerThe following is a template for the Android.bp file, only the <device name> needs to be replaced. 15*20bfefbeSAndroid Build Coastguard Worker 16*20bfefbeSAndroid Build Coastguard Workercc_test_host { 17*20bfefbeSAndroid Build Coastguard Worker name: "system.teeui_localization_rendering_test.<device name>", 18*20bfefbeSAndroid Build Coastguard Worker cflags: [ 19*20bfefbeSAndroid Build Coastguard Worker "-Wall", 20*20bfefbeSAndroid Build Coastguard Worker "-Werror", 21*20bfefbeSAndroid Build Coastguard Worker "-Wextra", 22*20bfefbeSAndroid Build Coastguard Worker "-O0", 23*20bfefbeSAndroid Build Coastguard Worker ], 24*20bfefbeSAndroid Build Coastguard Worker srcs: [ 25*20bfefbeSAndroid Build Coastguard Worker "test_main.cpp", 26*20bfefbeSAndroid Build Coastguard Worker ], 27*20bfefbeSAndroid Build Coastguard Worker test_suites: ["device-tests"], 28*20bfefbeSAndroid Build Coastguard Worker shared_libs: [ 29*20bfefbeSAndroid Build Coastguard Worker "libbase", 30*20bfefbeSAndroid Build Coastguard Worker "libteeui_localization_rendering_test", 31*20bfefbeSAndroid Build Coastguard Worker ], 32*20bfefbeSAndroid Build Coastguard Worker static_libs: [ 33*20bfefbeSAndroid Build Coastguard Worker "libgtest", 34*20bfefbeSAndroid Build Coastguard Worker ] 35*20bfefbeSAndroid Build Coastguard Worker} 36*20bfefbeSAndroid Build Coastguard Worker 37*20bfefbeSAndroid Build Coastguard Worker 38*20bfefbeSAndroid Build Coastguard Worker## TEST_MAPPING ## 39*20bfefbeSAndroid Build Coastguard WorkerThe TEST_MAPPING file is going to run the test as a postsubmit test with the 40*20bfefbeSAndroid Build Coastguard Workerconfiguration parameters set within this file. 41*20bfefbeSAndroid Build Coastguard Worker 42*20bfefbeSAndroid Build Coastguard WorkerThe following is a template for the TEST_MAPPING file. All the flags should be 43*20bfefbeSAndroid Build Coastguard Workerconfigured with the values specific to the device. If no configuration is 44*20bfefbeSAndroid Build Coastguard Workerprovided, the values will default to the values for Blueline. 45*20bfefbeSAndroid Build Coastguard Worker 46*20bfefbeSAndroid Build Coastguard Worker{ 47*20bfefbeSAndroid Build Coastguard Worker "postsubmit": [ 48*20bfefbeSAndroid Build Coastguard Worker { 49*20bfefbeSAndroid Build Coastguard Worker "name": "system.teeui_localization_rendering_test.<device name>", 50*20bfefbeSAndroid Build Coastguard Worker "host" : true, 51*20bfefbeSAndroid Build Coastguard Worker "options": [ 52*20bfefbeSAndroid Build Coastguard Worker { 53*20bfefbeSAndroid Build Coastguard Worker "native-test-flag": "--width=<device width in pixels>" 54*20bfefbeSAndroid Build Coastguard Worker }, 55*20bfefbeSAndroid Build Coastguard Worker { 56*20bfefbeSAndroid Build Coastguard Worker "native-test-flag": "--height=<device height in pixels>" 57*20bfefbeSAndroid Build Coastguard Worker }, 58*20bfefbeSAndroid Build Coastguard Worker { 59*20bfefbeSAndroid Build Coastguard Worker "native-test-flag": "--dp2px=<pixel per density independent pixel (px/dp) ratio of the device. Typically <width in pixels>/412 >" 60*20bfefbeSAndroid Build Coastguard Worker }, 61*20bfefbeSAndroid Build Coastguard Worker { 62*20bfefbeSAndroid Build Coastguard Worker "native-test-flag": "--mm2px=<pixel per millimeter (px/mm) ratio>" 63*20bfefbeSAndroid Build Coastguard Worker }, 64*20bfefbeSAndroid Build Coastguard Worker { 65*20bfefbeSAndroid Build Coastguard Worker "native-test-flag": "--powerButtonTop=<distance from the top of the power button to the top of the screen in mm>" 66*20bfefbeSAndroid Build Coastguard Worker }, 67*20bfefbeSAndroid Build Coastguard Worker { 68*20bfefbeSAndroid Build Coastguard Worker "native-test-flag": "--powerButtonBottom=<distance from the bottom of the power button to the top of the screen in mm>" 69*20bfefbeSAndroid Build Coastguard Worker }, 70*20bfefbeSAndroid Build Coastguard Worker { 71*20bfefbeSAndroid Build Coastguard Worker "native-test-flag": "--volUpButtonTop=<distance from the top of the UP volume button to the top of the screen in mm>" 72*20bfefbeSAndroid Build Coastguard Worker }, 73*20bfefbeSAndroid Build Coastguard Worker { 74*20bfefbeSAndroid Build Coastguard Worker "native-test-flag": "--volUpButtonBottom=<distance from the bottom of the UP power button to the top of the screen in mm>" 75*20bfefbeSAndroid Build Coastguard Worker }, 76*20bfefbeSAndroid Build Coastguard Worker { 77*20bfefbeSAndroid Build Coastguard Worker "native-test-flag": "--saveScreen" 78*20bfefbeSAndroid Build Coastguard Worker } 79*20bfefbeSAndroid Build Coastguard Worker ] 80*20bfefbeSAndroid Build Coastguard Worker } 81*20bfefbeSAndroid Build Coastguard Worker ] 82*20bfefbeSAndroid Build Coastguard Worker} 83*20bfefbeSAndroid Build Coastguard Worker 84*20bfefbeSAndroid Build Coastguard Worker## test_main.cpp ## 85*20bfefbeSAndroid Build Coastguard WorkerThe current directory contains a test_main.cpp that initiates the localization 86*20bfefbeSAndroid Build Coastguard Workerrendering test. 87*20bfefbeSAndroid Build Coastguard WorkerMake a copy of the cpp file (found in this directory) and place it in the 88*20bfefbeSAndroid Build Coastguard Workertest configuration directory you will run the test from. 89*20bfefbeSAndroid Build Coastguard Worker 90*20bfefbeSAndroid Build Coastguard Worker## Run test ## 91*20bfefbeSAndroid Build Coastguard WorkerTo run the tests against the TEST_MAPPING configurations use the following 92*20bfefbeSAndroid Build Coastguard Workercommand: 93*20bfefbeSAndroid Build Coastguard Worker atest --test-mapping [src_path]:all 94*20bfefbeSAndroid Build Coastguard Workermore info on how to run atest can be found here: https://source.android.com/compatibility/tests/development/test-mapping 95*20bfefbeSAndroid Build Coastguard Worker 96*20bfefbeSAndroid Build Coastguard WorkerIt is possible to run the test as a binary and pass in configuration 97*20bfefbeSAndroid Build Coastguard Workervalues as commandline parameters. 98*20bfefbeSAndroid Build Coastguard WorkerThe following command is how to run the test 99*20bfefbeSAndroid Build Coastguard Workerin the commandline. 100*20bfefbeSAndroid Build Coastguard Worker atest system.teeui_localization_rendering_test.<device name> -- \ 101*20bfefbeSAndroid Build Coastguard Worker --test-arg 102*20bfefbeSAndroid Build Coastguard Worker com.android.tradefed.testtype.HostGTest:native-test-flag:"--width=100"\ 103*20bfefbeSAndroid Build Coastguard Worker --test-arg 104*20bfefbeSAndroid Build Coastguard Worker com.android.tradefed.testtype.HostGTest:native-test-flag:"--height=100"\ 105*20bfefbeSAndroid Build Coastguard Worker --test-arg 106*20bfefbeSAndroid Build Coastguard Worker com.android.tradefed.testtype.HostGTest:native-test-flag:"--dp2px=100"\ 107*20bfefbeSAndroid Build Coastguard Worker --test-arg 108*20bfefbeSAndroid Build Coastguard Worker com.android.tradefed.testtype.HostGTest:native-test-flag:"--mm2px=100" 109*20bfefbeSAndroid Build Coastguard Worker --test-arg 110*20bfefbeSAndroid Build Coastguard Worker com.android.tradefed.testtype.HostGTest:native-test-flag:"--powerButtonTop=100"\ 111*20bfefbeSAndroid Build Coastguard Worker --test-arg 112*20bfefbeSAndroid Build Coastguard Worker com.android.tradefed.testtype.HostGTest:native-test-flag:"--powerButtonBottom=100"\ 113*20bfefbeSAndroid Build Coastguard Worker --test-arg 114*20bfefbeSAndroid Build Coastguard Worker com.android.tradefed.testtype.HostGTest:native-test-flag:"--volUpButtonTop=100"\ 115*20bfefbeSAndroid Build Coastguard Worker --test-arg 116*20bfefbeSAndroid Build Coastguard Worker com.android.tradefed.testtype.HostGTest:native-test-flag:"--volUpButtonBottom=100"\ 117