summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Wiley <wiley@google.com>2016-08-19 20:12:45 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-08-19 20:12:45 +0000
commit89321bf6250b6be2934b48d6e08945d840a89042 (patch)
tree4e8b5d183684626477483507b5a3ca53d90dac04
parent59f193df6a9023e8696c36e773d080580b92766e (diff)
parent574a5d232481b52371b512d7b15b28b88dd58171 (diff)
downloadandroid_system_tools_aidl-89321bf6250b6be2934b48d6e08945d840a89042.tar.gz
android_system_tools_aidl-89321bf6250b6be2934b48d6e08945d840a89042.tar.bz2
android_system_tools_aidl-89321bf6250b6be2934b48d6e08945d840a89042.zip
Add a simple all in one testing script am: cce25d35d2
am: 574a5d2324 Change-Id: I63c05f989273160818122cae9c1a583dfab47fdd
-rw-r--r--docs/making-changes.md7
-rwxr-xr-xruntests.sh41
-rwxr-xr-xtests/integration-test.py37
3 files changed, 54 insertions, 31 deletions
diff --git a/docs/making-changes.md b/docs/making-changes.md
index f0e94d5..ac84b86 100644
--- a/docs/making-changes.md
+++ b/docs/making-changes.md
@@ -16,11 +16,6 @@ This codebase has both integration and unittests, all of which are expected to
consistently pass against a device/emulator:
```
-$ mmma system/tools/aidl && \
- out/host/linux-x86/nativetest64/aidl_unittests/aidl_unittests && \
- adb remount && adb sync && \
- adb install -r `find out/ -name aidl_test_services.apk` && \
- (pushd system/tools/aidl/ && tests/integration-test.py) && \
- echo "All tests pass"
+$ ./runtests.sh && echo "All tests pass"
```
diff --git a/runtests.sh b/runtests.sh
new file mode 100755
index 0000000..05809f9
--- /dev/null
+++ b/runtests.sh
@@ -0,0 +1,41 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2016 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+if [ -z $ANDROID_BUILD_TOP ]; then
+ echo "You need to source and lunch before you can use this script"
+ exit 1
+fi
+
+echo "Running tests"
+set -e # fail early
+
+# NOTE We can't actually run these commands, since they rely on functions added
+# by build/envsetup.sh to the bash shell environment.
+echo "+ mmma -j32 $ANDROID_BUILD_TOP/system/tools/aidl"
+make -j32 -C $ANDROID_BUILD_TOP -f build/core/main.mk \
+ MODULES-IN-system-tools-aidl
+
+set -x # print commands
+
+${ANDROID_HOST_OUT}/nativetest64/aidl_unittests/aidl_unittests
+
+adb root
+adb wait-for-device
+adb remount
+adb sync
+adb install -r \
+ ${ANDROID_PRODUCT_OUT}/system/app/aidl_test_services/aidl_test_services.apk
+${ANDROID_BUILD_TOP}/system/tools/aidl/tests/integration-test.py
diff --git a/tests/integration-test.py b/tests/integration-test.py
index f189977..0079ba9 100755
--- a/tests/integration-test.py
+++ b/tests/integration-test.py
@@ -124,29 +124,17 @@ class AdbHost(object):
return ShellResult(p.returncode, stdout, stderr)
-def run_test(test_native, test_java, apk_path=None, refresh_binaries=False,
- device_serial=None, verbose=False):
+def run_test(host, test_native, test_java):
"""Body of the test.
Args:
+ host: AdbHost object to run tests on
test_native: True iff we should test native Binder clients.
test_java: True iff we shoudl test Java Binder clients.
- apk_path: Optional path to an APK to install via `adb install`
- refresh_binaries: True iff we should `adb sync` new binaries to the
- device.
- device_serial: Optional string containing the serial number of the
- device under test.
- verbose: True iff we should enable verbose output during the test.
"""
print('Starting aidl integration testing...')
- host = AdbHost(device_serial=device_serial, verbose=verbose)
- if apk_path is not None:
- host.adb('install -r %s' % apk_path)
- if refresh_binaries:
- host.adb('remount')
- host.adb('sync')
- host.run('setenforce 0')
+
# Kill any previous test context
host.run('rm -f %s' % JAVA_LOG_FILE, ignore_status=True)
host.run('pkill %s' % NATIVE_TEST_SERVICE, ignore_status=True)
@@ -184,21 +172,20 @@ def run_test(test_native, test_java, apk_path=None, refresh_binaries=False,
def main():
"""Main entry point."""
parser = argparse.ArgumentParser(description=__doc__)
- parser.add_argument('--apk', dest='apk_path', type=str, default=None,
- help='Path to an APK to install on the device.')
- parser.add_argument('--refresh-bins', action='store_true', default=False,
- help='Pass this flag to have the test run adb sync')
- parser.add_argument('--serial', '-s', type=str, default=None,
- help='Serial number of device to test against')
parser.add_argument(
'--test-filter', default=TEST_FILTER_ALL,
choices=[TEST_FILTER_ALL, TEST_FILTER_JAVA, TEST_FILTER_NATIVE])
parser.add_argument('--verbose', '-v', action='store_true', default=False)
args = parser.parse_args()
- run_test(args.test_filter in (TEST_FILTER_ALL, TEST_FILTER_NATIVE),
- args.test_filter in (TEST_FILTER_ALL, TEST_FILTER_JAVA),
- apk_path=args.apk_path, refresh_binaries=args.refresh_bins,
- device_serial=args.serial, verbose=args.verbose)
+ host = AdbHost(verbose=args.verbose)
+ try:
+ # Tragically, SELinux interferes with our testing
+ host.run('setenforce 0')
+ run_test(host,
+ args.test_filter in (TEST_FILTER_ALL, TEST_FILTER_NATIVE),
+ args.test_filter in (TEST_FILTER_ALL, TEST_FILTER_JAVA))
+ finally:
+ host.run('setenforce 1')
if __name__ == '__main__':