From 5c5b0d4df9d301521787f988a7b3bedc4ba9f3c6 Mon Sep 17 00:00:00 2001 From: "nileshagrawal@chromium.org" Date: Wed, 16 May 2012 03:46:39 +0000 Subject: Run APK tests on the android_test trybot. 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 --- base/android/base_jni_registrar.cc | 2 ++ base/base.gyp | 3 ++- build/android/buildbot_functions.sh | 27 +++++++++++++++------------ build/android/buildbot_try_compile_test.sh | 3 ++- build/android/run_tests.py | 13 ++++++++++--- ipc/ipc.gyp | 3 ++- testing/android/AndroidManifest.xml | 2 +- ui/ui_unittests.gypi | 3 ++- 8 files changed, 36 insertions(+), 20 deletions(-) diff --git a/base/android/base_jni_registrar.cc b/base/android/base_jni_registrar.cc index a920037..06b0149 100644 --- a/base/android/base_jni_registrar.cc +++ b/base/android/base_jni_registrar.cc @@ -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" @@ -19,6 +20,7 @@ namespace android { static RegistrationMethod kBaseRegisteredMethods[] = { { "BuildInfo", base::android::RegisterBuildInfo }, + { "LocaleUtils", base::android::RegisterLocaleUtils }, { "PathUtils", base::android::RegisterPathUtils }, { "SystemMessageHandler", base::RegisterSystemMessageHandler }, }; diff --git a/base/base.gyp b/base/base.gyp index 7b4f970..52df286 100644 --- a/base/base.gyp +++ b/base/base.gyp @@ -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', diff --git a/build/android/buildbot_functions.sh b/build/android/buildbot_functions.sh index 2ea50f3..1db548e 100755 --- a/build/android/buildbot_functions.sh +++ b/build/android/buildbot_functions.sh @@ -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. @@ -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 +} diff --git a/build/android/buildbot_try_compile_test.sh b/build/android/buildbot_try_compile_test.sh index e48ed1b..58a7919 100755 --- a/build/android/buildbot_try_compile_test.sh +++ b/build/android/buildbot_try_compile_test.sh @@ -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 diff --git a/build/android/run_tests.py b/build/android/run_tests.py index 6f59cb2..f059a24 100755 --- a/build/android/run_tests.py +++ b/build/android/run_tests.py @@ -76,6 +76,13 @@ _TEST_SUITES = ['base_unittests', '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. @@ -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 diff --git a/ipc/ipc.gyp b/ipc/ipc.gyp index 7b137f0..0e72df5 100644 --- a/ipc/ipc.gyp +++ b/ipc/ipc.gyp @@ -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', diff --git a/testing/android/AndroidManifest.xml b/testing/android/AndroidManifest.xml index de98aec..3678c47 100644 --- a/testing/android/AndroidManifest.xml +++ b/testing/android/AndroidManifest.xml @@ -10,7 +10,7 @@ found in the LICENSE file. android:versionCode="1" android:versionName="1.0"> - +