Skip to content

Commit

Permalink
Run APK tests on the android_test trybot.
Browse files Browse the repository at this point in the history
Test failures are ignored for now.

TBR=mark@chromium.org,tsepez@chromium.org
BUG=125059
TEST=

Review URL: https://chromiumcodereview.appspot.com/10387086

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137352 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
nileshagrawal@chromium.org committed May 16, 2012
1 parent 574acb0 commit 5c5b0d4
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 20 deletions.
2 changes: 2 additions & 0 deletions base/android/base_jni_registrar.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "base/basictypes.h"
#include "base/android/build_info.h"
#include "base/android/locale_utils.h"
#include "base/android/jni_android.h"
#include "base/android/jni_registrar.h"
#include "base/android/path_utils.h"
Expand All @@ -19,6 +20,7 @@ namespace android {

static RegistrationMethod kBaseRegisteredMethods[] = {
{ "BuildInfo", base::android::RegisterBuildInfo },
{ "LocaleUtils", base::android::RegisterLocaleUtils },
{ "PathUtils", base::android::RegisterPathUtils },
{ "SystemMessageHandler", base::RegisterSystemMessageHandler },
};
Expand Down
3 changes: 2 additions & 1 deletion base/base.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -668,12 +668,13 @@
# a template, and builds them.
'action_name': 'generate_and_build',
'inputs': [
'../testing/android/AndroidManifest.xml',
'../testing/android/generate_native_test.py',
'<(PRODUCT_DIR)/lib.target/libbase_unittests.so',
'<(PRODUCT_DIR)/lib.java/chromium_base.jar'
],
'outputs': [
'<(PRODUCT_DIR)/ChromeNativeTests_base_unittests-debug.apk',
'<(PRODUCT_DIR)/base_unittests_apk/base_unittests-debug.apk',
],
'action': [
'../testing/android/generate_native_test.py',
Expand Down
27 changes: 15 additions & 12 deletions build/android/buildbot_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -194,23 +194,12 @@ function bb_compile {
# Re-gyp and compile with unit test bundles configured as shlibs for
# the native test runner. Experimental for now. Once the native test
# loader is on by default, this entire function becomes obsolete.
function bb_native_test_compile_run_tests {
function bb_compile_apk_tests {
echo "@@@BUILD_STEP Re-gyp for the native test runner@@@"
GYP_DEFINES="$GYP_DEFINES gtest_target_type=shared_library" android_gyp

echo "@@@BUILD_STEP Native test runner compile@@@"
bb_goma_make

# Make sure running the template prints an expected failure.
echo "@@@BUILD_STEP Native test runner template test@@@"
tempfile=/tmp/tempfile-$$.txt
build/android/run_tests.py --xvfb --verbose \
-s out/Release/replaceme_apk/replaceme-debug.apk \
| sed 's/@@@STEP_FAILURE@@@//g' | tee $tempfile
happy_failure=$(cat $tempfile | grep RUNNER_FAILED | wc -l)
if [[ $happy_failure -eq 0 ]] ; then
echo "@@@STEP_WARNINGS@@@"
fi
}

# Experimental compile step; does not turn the tree red if it fails.
Expand Down Expand Up @@ -239,3 +228,17 @@ function bb_run_tests {
echo "@@@BUILD_STEP Run Tests on actual hardware@@@"
build/android/run_tests.py --xvfb --verbose
}

# Run APK tests on an actual device.
function bb_run_apk_tests {
echo "@@@BUILD_STEP Run APK Tests on actual hardware@@@"
tempfile=/tmp/tempfile-$$.txt
# Filter out STEP_FAILURES, we don't want REDNESS on test failures for now.
build/android/run_tests.py --xvfb --verbose --apk=True \
| sed 's/@@@STEP_FAILURE@@@//g' | tee $tempfile
happy_failure=$(cat $tempfile | grep RUNNER_FAILED | wc -l)
if [[ $happy_failure -eq 0 ]] ; then
echo "@@@STEP_WARNINGS@@@"
fi
rm -f $tempfile
}
3 changes: 2 additions & 1 deletion build/android/buildbot_try_compile_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ bb_baseline_setup "${ROOT}"/../..
bb_install_build_deps "${ROOT}"/../..
bb_compile
bb_run_tests
bb_native_test_compile_run_tests
bb_compile_apk_tests
bb_run_apk_tests
13 changes: 10 additions & 3 deletions build/android/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@
'ui_unittests',
]

# Test suites which are build as an APK. This will be replaced by the default
# list when we start building all suites as APK.
_APK_TEST_SUITES = ['replaceme', # Test the template apk too.
'base_unittests',
'ipc_tests',
'ui_unittests',
]

def FullyQualifiedTestSuites(apk):
"""Return a fully qualified list that represents all known suites.
Expand All @@ -86,11 +93,11 @@ def FullyQualifiedTestSuites(apk):
test_suite_dir = os.path.abspath(os.path.join(run_tests_helper.CHROME_DIR,
'out', 'Release'))
if apk:
# out/Release/$SUITE_apk/ChromeNativeTests-debug.apk
# out/Release/$SUITE_apk/$SUITE-debug.apk
suites = [os.path.join(test_suite_dir,
t + '_apk',
'ChromeNativeTests-debug.apk')
for t in _TEST_SUITES]
t + '-debug.apk')
for t in _APK_TEST_SUITES]
else:
suites = [os.path.join(test_suite_dir, t) for t in _TEST_SUITES]
return suites
Expand Down
3 changes: 2 additions & 1 deletion ipc/ipc.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,13 @@
# a template, and builds them.
'action_name': 'generate_and_build',
'inputs': [
'../testing/android/AndroidManifest.xml',
'../testing/android/generate_native_test.py',
'<(PRODUCT_DIR)/lib.target/libipc_tests.so',
'<(PRODUCT_DIR)/lib.java/chromium_base.jar'
],
'outputs': [
'<(PRODUCT_DIR)/ChromeNativeTests_ipc_tests-debug.apk',
'<(PRODUCT_DIR)/ipc_tests_apk/ipc_tests-debug.apk',
],
'action': [
'../testing/android/generate_native_test.py',
Expand Down
2 changes: 1 addition & 1 deletion testing/android/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ found in the LICENSE file.
android:versionCode="1"
android:versionName="1.0">

<uses-sdk android:minSdkVersion="15" />
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="14" />

<application android:label="ChromeNativeTests">
<activity android:name=".ChromeNativeTestActivity"
Expand Down
3 changes: 2 additions & 1 deletion ui/ui_unittests.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,13 @@
# a template, and builds them.
'action_name': 'generate_and_build',
'inputs': [
'../testing/android/AndroidManifest.xml',
'../testing/android/generate_native_test.py',
'<(PRODUCT_DIR)/lib.target/libui_unittests.so',
'<(PRODUCT_DIR)/lib.java/chromium_base.jar',
],
'outputs': [
'<(PRODUCT_DIR)/ChromeNativeTests_ui_unittests-debug.apk',
'<(PRODUCT_DIR)/ui_unittests_apk/ui_unittests-debug.apk',
],
'action': [
'../testing/android/generate_native_test.py',
Expand Down

0 comments on commit 5c5b0d4

Please sign in to comment.