Commit be4d445e authored by Frank Barchard's avatar Frank Barchard

Add libyuv_unittest_apk target to run tests on Android

Roll chromium_revision bfea27a..bb79186 (340499:353481) in DEPS.
Changes: https://chromium.googlesource.com/chromium/src/+log/bfea27a..bb79186

To get the Android dependencies, you need to have
target_os = ["android"];
added to the end of your .gclient file (after the solution specs)
+ re-run gclient sync.
You'll also need to run: build/install-android-sdks.sh

Then build and run the test with something like this:
GYP_CROSSCOMPILE=1 GYP_DEFINES="OS=android component=static_library target_arch=arm" ./gyp_libyuv
ninja -C out/Release libyuv_unittest_apk
util/android/test_runner.py gtest -s libyuv_unittest --verbose --release

R=fbarchard@chromium.org

Review URL: https://codereview.chromium.org/1398383003 .
parent 41c6cc7e
*.pyc
.gn
pin-log.txt
base
build
buildtools
chromium/.gclient.tmp
......@@ -21,6 +22,7 @@ tools/generate_library_loader
tools/gn
tools/grit
tools/gyp
tools/isolate_driver.py
tools/memory
tools/protoc_wrapper
tools/python
......
......@@ -6,7 +6,7 @@ vars = {
# Roll the Chromium Git hash to pick up newer versions of all the
# dependencies and tools linked to in setup_links.py.
'chromium_revision': 'bfea27af55be979d8146ed4d225f07a9cf1fba8b', # 7.27.2015
'chromium_revision': 'bb79186c63ff4eff7a2a318a21731005c53f269b',
}
hooks = [
......
......@@ -14,12 +14,10 @@
'targets': [
{
'target_name': 'libyuv_unittest',
'type': 'executable',
'type': '<(gtest_target_type)',
'dependencies': [
'libyuv.gyp:libyuv',
# The tests are based on gtest
'testing/gtest.gyp:gtest',
'testing/gtest.gyp:gtest_main',
],
'defines': [
# Enable the following 3 macros to turn off assembly for specified CPU.
......@@ -77,6 +75,11 @@
'HAVE_JPEG',
],
}],
['OS=="android"', {
'dependencies': [
'<(DEPTH)/testing/android/native_test.gyp:native_test_native_code',
],
}],
# TODO(YangZhang): These lines can be removed when high accuracy
# YUV to RGB to Neon is ported.
[ '(target_arch == "armv7" or target_arch == "armv7s" \
......@@ -166,6 +169,40 @@
],
},
], # targets
'conditions': [
['OS=="android"', {
'targets': [
{
# TODO(kjellander): Figure out what to change in build/apk_test.gypi
# to it can be used instead of the copied code below. Using it in its
# current version was not possible, since the target starts with 'lib',
# which somewhere confuses the variables.
'target_name': 'libyuv_unittest_apk',
'type': 'none',
'variables': {
# These are used to configure java_apk.gypi included below.
'test_type': 'gtest',
'apk_name': 'libyuv_unittest',
'intermediate_dir': '<(PRODUCT_DIR)/libyuv_unittest_apk',
'final_apk_path': '<(intermediate_dir)/libyuv_unittest-debug.apk',
'java_in_dir': '<(DEPTH)/testing/android/native_test/java',
'native_lib_target': 'libyuv_unittest',
'gyp_managed_install': 0,
},
'includes': [ 'build/java_apk.gypi' ],
'dependencies': [
'<(DEPTH)/base/base.gyp:base_java',
'<(DEPTH)/build/android/pylib/device/commands/commands.gyp:chromium_commands',
'<(DEPTH)/build/android/pylib/remote/device/dummy/dummy.gyp:remote_device_dummy_apk',
'<(DEPTH)/testing/android/appurify_support.gyp:appurify_support_java',
'<(DEPTH)/testing/android/on_device_instrumentation.gyp:reporter_java',
'<(DEPTH)/tools/android/android_tools.gyp:android_tools',
'libyuv_unittest',
],
},
],
}],
],
}
# Local Variables:
......
......@@ -49,13 +49,15 @@ DIRECTORIES = [
'third_party/libjpeg_turbo',
'third_party/libsrtp',
'third_party/libudev',
'third_party/libvpx',
'third_party/libvpx_new',
'third_party/libyuv',
'third_party/llvm-build',
'third_party/lss',
'third_party/nss',
'third_party/ocmock',
'third_party/openmax_dl',
'third_party/opus',
'third_party/proguard',
'third_party/protobuf',
'third_party/sqlite',
'third_party/syzygy',
......@@ -81,9 +83,11 @@ if 'android' in target_os:
DIRECTORIES += [
'base',
'third_party/android_platform',
'third_party/android_testrunner',
'third_party/android_tools',
'third_party/appurify-python',
'third_party/ashmem',
'third_party/ijar',
'third_party/jsr-305',
'third_party/junit',
'third_party/libevent',
......@@ -101,6 +105,7 @@ if 'ios' in target_os:
FILES = {
'tools/find_depot_tools.py': None,
'tools/isolate_driver.py': None,
'third_party/BUILD.gn': None,
}
......
#!/usr/bin/env python
# Copyright 2014 The LibYuv Project Authors. All rights reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
"""
Runs tests on Android devices.
This script exists to avoid Libyuv being broken by changes in the Chrome Android
test execution toolchain. It also conveniently sets the CHECKOUT_SOURCE_ROOT
environment variable.
"""
import os
import sys
SCRIPT_DIR = os.path.dirname(__file__)
ROOT_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, os.pardir, os.pardir))
CHROMIUM_BUILD_ANDROID_DIR = os.path.join(ROOT_DIR, 'build', 'android')
sys.path.insert(0, CHROMIUM_BUILD_ANDROID_DIR)
import test_runner # pylint: disable=W0406
def main():
# Override environment variable to make it possible for the scripts to find
# the root directory (our symlinking of the Chromium build toolchain would
# otherwise make them fail to do so).
os.environ['CHECKOUT_SOURCE_ROOT'] = ROOT_DIR
return test_runner.main()
if __name__ == '__main__':
sys.exit(main())
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment