From cfc840c3d1786710e67f1c3d526298080e40692b Mon Sep 17 00:00:00 2001 From: Max Zhang Date: Mon, 24 Jul 2023 22:44:08 -0700 Subject: [PATCH] Re-enable black_box_test framework on Android arm Enable blackbox tests on Android arm Some failed test cases are filtered and the list is added in configuration.py as global. This effort is tracked by b/291648592. b/165629644 --- cobalt/black_box_tests/black_box_tests.py | 15 +++++-- starboard/android/arm/cobalt/configuration.py | 43 +++++++++++++++++++ 2 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 starboard/android/arm/cobalt/configuration.py diff --git a/cobalt/black_box_tests/black_box_tests.py b/cobalt/black_box_tests/black_box_tests.py index f094cc2d7451..c0386676448a 100755 --- a/cobalt/black_box_tests/black_box_tests.py +++ b/cobalt/black_box_tests/black_box_tests.py @@ -35,7 +35,6 @@ from starboard.tools import log_level _DISABLED_BLACKBOXTEST_CONFIGS = [ - 'android-arm/devel', 'android-arm64/devel', 'android-x86/devel', 'evergreen-arm/devel', @@ -179,6 +178,9 @@ def LoadTests(launcher_params, test_set): loader_out_directory=launcher_params.loader_out_directory) test_targets = [] + test_filters = build.GetPlatformConfig( + _launcher_params.platform).GetApplicationConfiguration( + 'cobalt').GetTestFilters() if test_set in ['all', 'blackbox']: test_targets = _TESTS_NO_SIGNAL @@ -194,8 +196,15 @@ def LoadTests(launcher_params, test_set): test_suite = unittest.TestSuite() for test in test_targets: - test_suite.addTest(unittest.TestLoader().loadTestsFromModule( - importlib.import_module(_TEST_DIR_PATH + test))) + filter_hit = 0 + for filtered_test in test_filters: + if (test_set == filtered_test.target_name and + test == filtered_test.test_name): + filter_hit = 1 + continue + if filter_hit == 0: + test_suite.addTest(unittest.TestLoader().loadTestsFromModule( + importlib.import_module(_TEST_DIR_PATH + test))) return test_suite diff --git a/starboard/android/arm/cobalt/configuration.py b/starboard/android/arm/cobalt/configuration.py new file mode 100644 index 000000000000..fb6d56101e30 --- /dev/null +++ b/starboard/android/arm/cobalt/configuration.py @@ -0,0 +1,43 @@ +# Copyright 2023 The Cobalt Authors. All Rights Reserved. +# +# 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. +"""Starboard Android arm Cobalt configuration.""" + +from starboard.android.shared.cobalt import configuration +from starboard.tools.testing import test_filter + +# A map of failing or crashing tests per target +_FILTERED_TESTS = { + 'blackbox': [ + 'web_debugger', + 'cancel_sync_loads_when_suspended', + 'preload_font', + 'preload_visibility', + 'preload_launch_parameter', + 'suspend_visibility', + 'timer_hit_after_preload', + 'timer_hit_in_preload', + 'deep_links', + 'web_platform_tests', + ], +} + + +class CobaltAndroidArmConfiguration(configuration.CobaltAndroidConfiguration): + """Starboard Android Arm Cobalt configuration.""" + + def GetTestFilters(self): + filters = super().GetTestFilters() + for target, tests in _FILTERED_TESTS.items(): + filters.extend(test_filter.TestFilter(target, test) for test in tests) + return filters