aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2016-09-12 21:24:58 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-09-12 21:24:58 +0000
commite776ef7a58b15bcde2950b9f9b0470a8829b51cb (patch)
tree21ba82ee766e7a4a7dd197a406ac569b933104df
parent013ee6fccb6bb9ebd6215b504f0eef45dccfde4e (diff)
parent532ad271afc5aad49352559ad994466c868facd8 (diff)
downloadgoogletest-e776ef7a58b15bcde2950b9f9b0470a8829b51cb.tar.gz
Add build files. am: 69ab970c69 am: 3c83e04439
am: 532ad271af Change-Id: Idbc20f5dbe4bfad29dd2c51702dc84a5c8000320
-rw-r--r--Android.bp14
-rw-r--r--Android.mk17
-rw-r--r--googlemock/Android.bp86
-rw-r--r--googlemock/Android.mk72
-rw-r--r--googletest/Android.bp142
-rw-r--r--googletest/Android.mk143
-rwxr-xr-xrun_tests.py97
7 files changed, 571 insertions, 0 deletions
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 00000000..b7aa6efd
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,14 @@
+// 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.
+subdirs = ["googlemock", "googletest"]
diff --git a/Android.mk b/Android.mk
new file mode 100644
index 00000000..41a41d07
--- /dev/null
+++ b/Android.mk
@@ -0,0 +1,17 @@
+#
+# 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.
+#
+
+include $(call all-subdir-makefiles)
diff --git a/googlemock/Android.bp b/googlemock/Android.bp
new file mode 100644
index 00000000..0f2f9e5f
--- /dev/null
+++ b/googlemock/Android.bp
@@ -0,0 +1,86 @@
+// 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.
+
+cc_defaults {
+ name: "gmock_flags",
+
+ local_include_dirs: ["include"],
+ export_include_dirs: ["include"],
+
+ cflags: ["-Wno-missing-field-initializers"],
+}
+
+cc_defaults {
+ name: "gmock_ndk",
+ sdk_version: "9",
+ stl: "gnustl_static",
+ cppflags: ["-std=c++11"],
+}
+
+cc_defaults {
+ name: "gmock_defaults",
+ host_supported: true,
+ sanitize: {
+ never: true,
+ },
+ target: {
+ windows: {
+ enabled: true,
+ },
+ },
+}
+
+cc_library_static {
+ name: "libgmock_ndk",
+ defaults: ["gmock_ndk", "gmock_flags"],
+ srcs: ["src/gmock-all.cc"],
+ static_libs: ["libgtest_ndk_gnustl"],
+}
+
+cc_library_static {
+ name: "libgmock_main_ndk",
+ defaults: ["gmock_ndk", "gmock_flags"],
+ srcs: ["src/gmock_main.cc"],
+ static_libs: ["libgtest_ndk_gnustl"],
+}
+
+cc_library_static {
+ name: "libgmock",
+ defaults: ["gmock_defaults", "gmock_flags"],
+ srcs: ["src/gmock-all.cc"],
+ rtti: true,
+ static_libs: ["libgtest"],
+}
+
+cc_library_static {
+ name: "libgmock_main",
+ defaults: ["gmock_defaults", "gmock_flags"],
+ srcs: ["src/gmock_main.cc"],
+ static_libs: ["libgtest"],
+}
+
+// Deprecated: use libgmock instead
+cc_library_host_static {
+ name: "libgmock_host",
+ defaults: ["gmock_defaults", "gmock_flags"],
+ whole_static_libs: ["libgmock"],
+}
+
+cc_library_host_static {
+ name: "libgmock_main_host",
+ defaults: ["gmock_defaults", "gmock_flags"],
+ whole_static_libs: ["libgmock_main"],
+}
+
+// Tests are in the Android.mk. Run with external/googletest/run_tests.py.
diff --git a/googlemock/Android.mk b/googlemock/Android.mk
new file mode 100644
index 00000000..79969bd9
--- /dev/null
+++ b/googlemock/Android.mk
@@ -0,0 +1,72 @@
+# 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.
+#
+#
+
+LOCAL_PATH := $(call my-dir)
+
+# Defines a test module.
+#
+# The upstream gmock configuration builds each of these as separate executables.
+# It's a pain for how we run tests in the platform, but we can handle that with
+# a test running script.
+#
+# $(1): Test name. test/$(1).cc will automatically be added to sources.
+# $(2): Additional source files.
+# $(3): "libgmock_main" or empty.
+# $(4): Variant. Can be "_host", "_ndk", or empty.
+define gmock-unit-test
+ $(eval include $(CLEAR_VARS)) \
+ $(eval LOCAL_MODULE := $(1)$(4)) \
+ $(eval LOCAL_CPP_EXTENSION := .cc) \
+ $(eval LOCAL_SRC_FILES := test/$(strip $(1)).cc $(2)) \
+ $(eval LOCAL_C_INCLUDES := $(LOCAL_PATH)/include) \
+ $(eval LOCAL_C_INCLUDES += $(LOCAL_PATH)/../googletest) \
+ $(eval LOCAL_CPP_FEATURES := rtti) \
+ $(eval LOCAL_STATIC_LIBRARIES := $(if $(3),$(3)$(4)) libgmock$(4)) \
+ $(eval LOCAL_STATIC_LIBRARIES += libgtest$(4)) \
+ $(if $(findstring _ndk,$(4)),$(eval LOCAL_SDK_VERSION := 9)) \
+ $(eval LOCAL_NDK_STL_VARIANT := stlport_static) \
+ $(if $(findstring _host,$(4)),,\
+ $(eval LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_NATIVE_TESTS))) \
+ $(eval $(if $(findstring _host,$(4)), \
+ include $(BUILD_HOST_EXECUTABLE), \
+ include $(BUILD_EXECUTABLE)))
+endef
+
+# Create modules for each test in the suite.
+#
+# $(1): Variant. Can be "_host", "_ndk", or empty.
+define gmock-test-suite
+ $(eval $(call gmock-unit-test,gmock-actions_test,,libgmock_main,$(1))) \
+ $(eval $(call gmock-unit-test,gmock-cardinalities_test,,libgmock_main,$(1))) \
+ $(eval $(call gmock-unit-test,gmock-generated-actions_test,,libgmock_main,$(1))) \
+ $(eval $(call gmock-unit-test,gmock-generated-function-mockers_test,,libgmock_main,$(1))) \
+ $(eval $(call gmock-unit-test,gmock-generated-internal-utils_test,,libgmock_main,$(1))) \
+ $(eval $(call gmock-unit-test,gmock-generated-matchers_test,,libgmock_main,$(1))) \
+ $(eval $(call gmock-unit-test,gmock-internal-utils_test,,libgmock_main,$(1))) \
+ $(eval $(call gmock-unit-test,gmock-matchers_test,,libgmock_main,$(1))) \
+ $(eval $(call gmock-unit-test,gmock-more-actions_test,,libgmock_main,$(1))) \
+ $(eval $(call gmock-unit-test,gmock-nice-strict_test,,libgmock_main,$(1))) \
+ $(eval $(call gmock-unit-test,gmock-port_test,,libgmock_main,$(1))) \
+ $(eval $(call gmock-unit-test,gmock-spec-builders_test,,libgmock_main,$(1))) \
+ $(eval $(call gmock-unit-test,gmock_link_test,test/gmock_link2_test.cc,libgmock_main,$(1))) \
+ $(eval $(call gmock-unit-test,gmock_test,,libgmock_main,$(1)))
+endef
+
+# Test is disabled because Android doesn't build gmock with exceptions.
+# $(eval $(call gmock-unit-test,gmock_ex_test,,libgmock_main,$(1)))
+
+$(call gmock-test-suite,)
+$(call gmock-test-suite,_host)
diff --git a/googletest/Android.bp b/googletest/Android.bp
new file mode 100644
index 00000000..308b6dc9
--- /dev/null
+++ b/googletest/Android.bp
@@ -0,0 +1,142 @@
+// 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.
+
+cc_defaults {
+ name: "libgtest_defaults",
+ local_include_dirs: [
+ "include",
+ ],
+ export_include_dirs: [
+ "include",
+ ],
+ target: {
+ android: {
+ product_variables: {
+ unbundled_build: {
+ // Don't build for unbundled branches
+ enabled: false,
+ },
+ },
+ },
+ },
+}
+
+cc_defaults {
+ name: "libgtest_host_defaults",
+ target: {
+ windows: {
+ enabled: true,
+ },
+ },
+}
+
+// NDK libraries.
+// We need to build one pair of (libgtest, libgtest_main) for each of the three
+// STLs we support in the NDK since the user's app might use any of them.
+
+// stlport
+cc_library_static {
+ name: "libgtest_ndk_stlport",
+ defaults: ["libgtest_defaults"],
+ sdk_version: "9",
+ stl: "stlport_static",
+ srcs: ["src/gtest-all.cc"],
+}
+
+cc_library_static {
+ name: "libgtest_main_ndk_stlport",
+ defaults: ["libgtest_defaults"],
+ sdk_version: "9",
+ stl: "stlport_static",
+ srcs: ["src/gtest_main.cc"],
+}
+
+// libc++
+cc_library_static {
+ name: "libgtest_ndk_c++",
+ defaults: ["libgtest_defaults"],
+ sdk_version: "9",
+ stl: "c++_static",
+ srcs: ["src/gtest-all.cc"],
+}
+
+cc_library_static {
+ name: "libgtest_main_ndk_c++",
+ defaults: ["libgtest_defaults"],
+ sdk_version: "9",
+ stl: "c++_static",
+ srcs: ["src/gtest_main.cc"],
+}
+
+// gnustl
+cc_library_static {
+ name: "libgtest_ndk_gnustl",
+ defaults: ["libgtest_defaults"],
+ sdk_version: "9",
+ stl: "gnustl_static",
+ srcs: ["src/gtest-all.cc"],
+}
+
+cc_library_static {
+ name: "libgtest_main_ndk_gnustl",
+ defaults: ["libgtest_defaults"],
+ sdk_version: "9",
+ stl: "gnustl_static",
+ srcs: ["src/gtest_main.cc"],
+}
+
+// Platform and host libraries.
+cc_library_static {
+ name: "libgtest",
+ defaults: ["libgtest_defaults", "libgtest_host_defaults"],
+ host_supported: true,
+ srcs: ["src/gtest-all.cc"],
+ sanitize: {
+ never: true,
+ },
+ rtti: true,
+}
+
+cc_library_static {
+ name: "libgtest_main",
+ defaults: ["libgtest_defaults", "libgtest_host_defaults"],
+ host_supported: true,
+ clang: true,
+ srcs: ["src/gtest_main.cc"],
+ sanitize: {
+ never: true,
+ },
+}
+
+// Legacy libraries for makefiles that refer to libgtest_host
+cc_library_host_static {
+ name: "libgtest_host",
+ whole_static_libs: ["libgtest"],
+ defaults: ["libgtest_host_defaults"],
+}
+
+cc_library_host_static {
+ name: "libgtest_main_host",
+ whole_static_libs: ["libgtest_main"],
+ defaults: ["libgtest_host_defaults"],
+}
+
+cc_library {
+ name: "libgtest_prod",
+ defaults: ["libgtest_defaults", "libgtest_host_defaults"],
+ host_supported: true,
+ export_include_dirs: ["include"],
+}
+
+// Tests are in the Android.mk. Run with external/googletest/run_tests.py.
diff --git a/googletest/Android.mk b/googletest/Android.mk
new file mode 100644
index 00000000..49d33b8e
--- /dev/null
+++ b/googletest/Android.mk
@@ -0,0 +1,143 @@
+#
+# 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.
+#
+
+# Note that the platform modules are defined in the Android.bp. This file is
+# used for the NDK, but is also how we define the tests for the platform.
+
+LOCAL_PATH := $(call my-dir)
+
+# Defines a test module.
+#
+# The upstream gtest configuration builds each of these as separate executables.
+# It's a pain for how we run tests in the platform, but we can handle that with
+# a test running script.
+#
+# $(1): Test name. test/$(1).cc will automatically be added to sources.
+# $(2): Additional source files.
+# $(3): "libgtest_main" or empty.
+# $(4): Variant. Can be "_host", "_ndk", or empty.
+# $(5): NDK STL if $(4) is "_ndk", else empty.
+define gtest-unit-test
+ $(eval include $(CLEAR_VARS)) \
+ $(eval LOCAL_MODULE := \
+ $(1)$(if $(findstring _ndk,$(4)),$(4))$(if $(5),_$(5))) \
+ $(eval LOCAL_CPP_EXTENSION := .cc) \
+ $(eval LOCAL_SRC_FILES := test/$(strip $(1)).cc $(2)) \
+ $(eval LOCAL_C_INCLUDES := $(LOCAL_PATH)/include) \
+ $(eval LOCAL_CPP_FEATURES := rtti) \
+ $(eval LOCAL_STATIC_LIBRARIES := \
+ $(if $(3),$(3)$(4)$(if $(5),_$(5))) libgtest$(4)$(if $(5),_$(5))) \
+ $(if $(findstring _ndk,$(4)),$(eval LOCAL_LDLIBS := -ldl)) \
+ $(if $(findstring _ndk,$(4)),$(eval LOCAL_SDK_VERSION := 9)) \
+ $(if $(findstring _ndk,$(4)),$(eval LOCAL_NDK_STL_VARIANT := $(5)_static)) \
+ $(if $(findstring _host,$(4)),,\
+ $(eval LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_NATIVE_TESTS))) \
+ $(eval $(if $(findstring _host,$(4)), \
+ include $(BUILD_HOST_EXECUTABLE), \
+ include $(BUILD_EXECUTABLE)))
+endef
+
+# Create modules for each test in the suite.
+#
+# $(1): Variant. Can be "_host", "_ndk", or empty.
+# $(2): NDK STL if $(1) is "_ndk", else empty.
+#
+# The NDK variant of gtest-death-test_test is disabled because we don't have
+# pthread_atfork on android-9.
+define gtest-test-suite
+ $(if $(findstring _ndk,$(1)),, \
+ $(eval $(call gtest-unit-test, \
+ gtest-death-test_test,,libgtest_main,$(1),$(2)))) \
+ $(eval $(call gtest-unit-test,gtest_environment_test,,,$(1),$(2))) \
+ $(eval $(call gtest-unit-test,gtest-filepath_test,, \
+ libgtest_main,$(1),$(2))) \
+ $(eval $(call gtest-unit-test,gtest-linked_ptr_test,, \
+ libgtest_main,$(1),$(2))) \
+ $(eval $(call gtest-unit-test,gtest-listener_test,, \
+ libgtest_main,$(1),$(2))) \
+ $(eval $(call gtest-unit-test,gtest_main_unittest,, \
+ libgtest_main,$(1),$(2))) \
+ $(eval $(call gtest-unit-test,gtest-message_test,, \
+ libgtest_main,$(1),$(2))) \
+ $(eval $(call gtest-unit-test,gtest_no_test_unittest,,,$(1),$(2))) \
+ $(eval $(call gtest-unit-test,gtest-options_test,, \
+ libgtest_main,$(1),$(2))) \
+ $(eval $(call gtest-unit-test,gtest-param-test_test, \
+ test/gtest-param-test2_test.cc,,$(1),$(2))) \
+ $(eval $(call gtest-unit-test,gtest-port_test,,libgtest_main,$(1),$(2))) \
+ $(eval $(call gtest-unit-test,gtest_pred_impl_unittest,, \
+ libgtest_main,$(1),$(2))) \
+ $(eval $(call gtest-unit-test,gtest_premature_exit_test,,,$(1),$(2))) \
+ $(eval $(call gtest-unit-test,gtest_prod_test,test/production.cc, \
+ libgtest_main,$(1),$(2))) \
+ $(eval $(call gtest-unit-test,gtest_repeat_test,,,$(1),$(2))) \
+ $(eval $(call gtest-unit-test,gtest_sole_header_test,, \
+ libgtest_main,$(1),$(2))) \
+ $(eval $(call gtest-unit-test,gtest_stress_test,,,$(1),$(2))) \
+ $(eval $(call gtest-unit-test,gtest-test-part_test,, \
+ libgtest_main,$(1),$(2))) \
+ $(eval $(call gtest-unit-test, \
+ gtest-typed-test_test,test/gtest-typed-test2_test.cc, \
+ libgtest_main,$(1),$(2))) \
+ $(eval $(call gtest-unit-test,gtest_unittest,,libgtest_main,$(1),$(2))) \
+ $(eval $(call gtest-unit-test,gtest-unittest-api_test,,,$(1),$(2)))
+endef
+
+# Test is disabled because Android doesn't build gtest with exceptions.
+# $(eval $(call gtest-unit-test,gtest_throw_on_failure_ex_test,,,$(1),$(2)))
+
+# Test is disabled until https://github.com/google/googletest/pull/728 lands.
+# $(eval $(call gtest-unit-test,gtest-printers_test,,libgtest_main,$(1),$(2)))
+
+# If we're being invoked from ndk-build, we'll have NDK_ROOT defined.
+ifdef NDK_ROOT
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libgtest
+LOCAL_CPP_EXTENSION := .cc
+LOCAL_SRC_FILES := src/gtest-all.cc
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/src $(LOCAL_PATH)/include
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
+LOCAL_RTTI_FLAG := -frtti
+LOCAL_CPP_FEATURES := rtti
+include $(BUILD_STATIC_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libgtest_main
+LOCAL_CPP_EXTENSION := .cc
+LOCAL_SRC_FILES := src/gtest_main.cc
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/src $(LOCAL_PATH)/include
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
+LOCAL_RTTI_FLAG := -frtti
+LOCAL_CPP_FEATURES := rtti
+include $(BUILD_STATIC_LIBRARY)
+
+else
+
+# Tests for the platform built NDK gtest.
+$(call gtest-test-suite,_ndk,stlport)
+$(call gtest-test-suite,_ndk,gnustl)
+$(call gtest-test-suite,_ndk,c++)
+
+# Tests for the host gtest.
+ifeq (,$(TARGET_BUILD_APPS))
+$(call gtest-test-suite,_host,)
+endif
+
+endif
+
+# Tests for the platform device gtest and for use in the NDK itself.
+$(call gtest-test-suite,)
diff --git a/run_tests.py b/run_tests.py
new file mode 100755
index 00000000..76f2e944
--- /dev/null
+++ b/run_tests.py
@@ -0,0 +1,97 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+"""Runs all tests for gtest/gmock."""
+import argparse
+import logging
+import os
+import sys
+
+
+# pylint: disable=design
+
+
+def logger():
+ """Return the default logger for the module."""
+ return logging.getLogger(__name__)
+
+
+def call(cmd, *args, **kwargs):
+ """Proxy for subprocess.call with logging."""
+ import subprocess
+ logger().info('call `%s`', ' '.join(cmd))
+ return subprocess.call(cmd, *args, **kwargs)
+
+
+def parse_args():
+ "Parse and return command line arguments."""
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--host', action='store_true')
+ parser.add_argument('-v', '--verbose', action='store_true')
+ return parser.parse_args()
+
+
+def main():
+ "Program entry point."""
+ args = parse_args()
+ log_level = logging.INFO
+ if args.verbose:
+ log_level = logging.DEBUG
+ logging.basicConfig(level=log_level)
+
+ if args.host:
+ test_location = os.path.join(os.environ['ANDROID_HOST_OUT'], 'bin')
+ else:
+ data_dir = os.path.join(os.environ['OUT'], 'data')
+ test_location = os.path.join(data_dir, 'nativetest64')
+ if not os.path.exists(test_location):
+ test_location = os.path.join(data_dir, 'nativetest')
+
+ num_tests = 0
+ failures = []
+ logger().debug('Scanning %s for tests', test_location)
+ for test in os.listdir(test_location):
+ if not test.startswith('gtest') and not test.startswith('gmock'):
+ logger().debug('Skipping %s', test)
+ continue
+ num_tests += 1
+
+ if args.host:
+ cmd = [os.path.join(test_location, test)]
+ if call(cmd) != 0:
+ failures.append(test)
+ else:
+ device_dir = test_location.replace(os.environ['OUT'], '')
+ cmd = ['adb', 'shell', 'cd {} && ./{}'.format(device_dir, test)]
+ if call(cmd) != 0:
+ failures.append(test)
+
+ if num_tests == 0:
+ logger().error('No tests found!')
+ sys.exit(1)
+
+ num_failures = len(failures)
+ num_passes = num_tests - num_failures
+ logger().info('%d/%d tests passed', num_passes, num_tests)
+ if len(failures) > 0:
+ logger().error('Failures:\n%s', '\n'.join(failures))
+ else:
+ logger().info('All tests passed!')
+ sys.exit(num_failures)
+
+
+if __name__ == '__main__':
+ main()