• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2011 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15#!/bin/bash
16# some simple scripts to automate theme test compiling and running
17
18# Allows a person developing the tests to very quickly run just the theme tests.
19# If you are doing this more than once, it is recommended that you open
20# cts/tests/Android.mk and comment out the line after the comment
21# "Build the test APK using its own makefile, and any other CTS-related packages".
22# Commenting out that line makes it so that you only build the necessary
23# theme tests, not all of CTS. Make sure that you do not check that modification
24# in, however.
25function rtt () {
26	if [ ! "$ANDROID_PRODUCT_OUT" ]; then
27	    echo "did you remember to lunch or tapas?" 1>&2;
28	    return;
29	fi;
30
31    croot && \
32	mmm cts/tests/ && \
33	mmm cts/tests/tests/theme/ && \
34	adb install -r $ANDROID_PRODUCT_OUT/data/app/CtsTestStubs.apk && \
35	adb install -r $ANDROID_PRODUCT_OUT/data/app/CtsThemeTestCases.apk && \
36	runtest -b --path cts/tests/tests/theme/src
37}
38
39# Builds the Theme Tests and installs them to the device.
40# Does not run the tests or generate the good versions.
41function tt () {
42	if [ ! "$ANDROID_PRODUCT_OUT" ]; then
43	    echo "did you remember to lunch or tapas?" 1>&2;
44	    return;
45	fi;
46
47	croot && \
48    adb root && \
49	mmm cts/tests/ && \
50	mmm cts/tests/tests/theme/ && \
51	adb install -r $ANDROID_PRODUCT_OUT/data/app/CtsTestStubs.apk && \
52	adb install -r $ANDROID_PRODUCT_OUT/data/app/CtsThemeTestCases.apk && \
53	adb shell rm -r data/data/com.android.cts.stub/files/
54}
55
56# Builds the theme tests and generates the masters for an xhdpi device.
57# Does not generate for large form factors (phones-only).
58function gttxhdpi () {
59	if [ ! "$ANDROID_PRODUCT_OUT" ]; then
60	    echo "did you remember to lunch or tapas?" 1>&2;
61	    return;
62	fi;
63
64    croot && \
65    adb root && \
66    make CtsTestStubs CtsThemeTestCases && \
67    adb install -r $ANDROID_PRODUCT_OUT/data/app/CtsTestStubs.apk && \
68    adb install -r $ANDROID_PRODUCT_OUT/data/app/CtsThemeTestCases.apk && \
69    adb shell rm -r data/data/com.android.cts.stub/files/ && \
70    adb shell am instrument -w -e class android.theme.cts.ThemeGenerator#generateThemeBitmaps com.android.cts.theme/android.test.InstrumentationCtsTestRunner && \
71    adb shell am instrument -w -e class android.theme.cts.ActivitySnapshotTests#generateActivityBitmaps com.android.cts.theme/android.test.InstrumentationCtsTestRunner && \
72    adb shell am instrument -w -e class android.theme.cts.SplitActivitySnapshotTests#generateActivityBitmaps com.android.cts.theme/android.test.InstrumentationCtsTestRunner && \
73    mkdir -p $ANDROID_HOST_OUT/cts/theme-assets-xhdpi && \
74    adb pull data/data/com.android.cts.stub/files/ $ANDROID_HOST_OUT/cts/theme-assets-xhdpi/
75}
76
77# Builds the theme tests and generates the masters for an hdpi device.
78# Does not generate for large form factors (phones-only).
79function gtthdpi () {
80	if [ ! "$ANDROID_PRODUCT_OUT" ]; then
81	    echo "did you remember to lunch or tapas?" 1>&2;
82	    return;
83	fi;
84
85    croot && \
86    adb root && \
87    mmm cts/tests/ && \
88    mmm cts/tests/tests/theme/ && \
89    adb install -r $ANDROID_PRODUCT_OUT/data/app/CtsTestStubs.apk && \
90    adb install -r $ANDROID_PRODUCT_OUT/data/app/CtsThemeTestCases.apk && \
91    adb shell rm -r data/data/com.android.cts.stub/files/ && \
92    adb shell am instrument -w -e class android.theme.cts.ThemeGenerator#generateThemeBitmaps com.android.cts.theme/android.test.InstrumentationCtsTestRunner && \
93    adb shell am instrument -w -e class android.theme.cts.ActivitySnapshotTests#generateActivityBitmaps com.android.cts.theme/android.test.InstrumentationCtsTestRunner && \
94    adb shell am instrument -w -e class android.theme.cts.SplitActivitySnapshotTests#generateActivityBitmaps com.android.cts.theme/android.test.InstrumentationCtsTestRunner && \
95    mkdir -p $ANDROID_HOST_OUT/cts/theme-assets-hdpi && \
96    adb pull data/data/com.android.cts.stub/files/ $ANDROID_HOST_OUT/cts/theme-assets-hdpi/
97}
98
99# Builds the theme tests and generates the masters for an mdpi device.
100# Generate for large and small form factors (phones and tablets).
101# This assumes that the device that will be used to generate the tests
102# is a large form factor mdpi device (stingray or wingray).
103function gttmdpi () {
104	if [ ! "$ANDROID_PRODUCT_OUT" ]; then
105	    echo "did you remember to lunch or tapas?" 1>&2;
106	    return;
107	fi;
108
109    croot && \
110    adb root && \
111    mmm cts/tests/ && \
112    mmm cts/tests/tests/theme/ && \
113    adb install -r $ANDROID_PRODUCT_OUT/data/app/CtsTestStubs.apk && \
114    adb install -r $ANDROID_PRODUCT_OUT/data/app/CtsThemeTestCases.apk && \
115    adb shell rm -r data/data/com.android.cts.stub/files/ && \
116    adb shell am instrument -w -e class android.theme.cts.ThemeGenerator#generateThemeBitmaps com.android.cts.theme/android.test.InstrumentationCtsTestRunner && \
117    adb shell am instrument -w -e class android.theme.cts.ActivitySnapshotTests#generateActivityBitmaps com.android.cts.theme/android.test.InstrumentationCtsTestRunner && \
118    adb shell am instrument -w -e class android.theme.cts.SplitActivitySnapshotTests#generateActivityBitmaps com.android.cts.theme/android.test.InstrumentationCtsTestRunner && \
119    mkdir -p $ANDROID_HOST_OUT/cts/theme-assets-large-mdpi && \
120    adb pull data/data/com.android.cts.stub/files/ $ANDROID_HOST_OUT/cts/theme-assets-large-mdpi/ && \
121    adb shell am display-size 800x480  && \
122    adb shell rm -r data/data/com.android.cts.stub/files/ && \
123    adb shell am instrument -w -e class android.theme.cts.ThemeGenerator#generateThemeBitmaps com.android.cts.theme/android.test.InstrumentationCtsTestRunner && \
124    adb shell am instrument -w -e class android.theme.cts.ActivitySnapshotTests#generateActivityBitmaps com.android.cts.theme/android.test.InstrumentationCtsTestRunner && \
125    adb shell am instrument -w -e class android.theme.cts.SplitActivitySnapshotTests#generateActivityBitmaps com.android.cts.theme/android.test.InstrumentationCtsTestRunner && \
126    mkdir -p $ANDROID_HOST_OUT/cts/theme-assets-hdpi && \
127    adb pull data/data/com.android.cts.stub/files/ $ANDROID_HOST_OUT/cts/theme-assets-mdpi/ && \
128    adb shell am display-size reset
129
130}
131