From 62a0099c0e8bb1dee042cc2c2da896cff70e4963 Mon Sep 17 00:00:00 2001 From: Ben Hamilton Date: Fri, 16 Dec 2022 15:24:02 -0700 Subject: [PATCH] [ios] Support --gtest_filter for iOS tests Change-Id: I5511911110b58b7accd0f78cc1094924bfbda71e Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4114702 Reviewed-by: Justin Cohen Commit-Queue: Ben Hamilton --- build/run_tests.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/build/run_tests.py b/build/run_tests.py index 8ad19e34..eec7be47 100755 --- a/build/run_tests.py +++ b/build/run_tests.py @@ -312,7 +312,7 @@ def _RunOnAndroidTarget(binary_dir, test, android_device, extra_command_line): _adb_shell(['rm', '-rf', device_temp_dir]) -def _RunOnIOSTarget(binary_dir, test, is_xcuitest=False): +def _RunOnIOSTarget(binary_dir, test, is_xcuitest=False, gtest_filter=None): """Runs the given iOS |test| app on iPhone 8 with the default OS version.""" def xctest(binary_dir, test): @@ -374,10 +374,13 @@ def _RunOnIOSTarget(binary_dir, test, is_xcuitest=False): else: plistlib.dump(xctest(binary_dir, test), fp) - subprocess.check_call([ + command = [ 'xcodebuild', 'test-without-building', '-xctestrun', xctestrun_path, - '-destination', 'platform=iOS Simulator,name=iPhone 8' - ]) + '-destination', 'platform=iOS Simulator,name=iPhone 8', + ] + if gtest_filter: + command.append('-only-testing:' + test + '/' + gtest_filter) + subprocess.check_call(command) # This script is primarily used from the waterfall so that the list of tests @@ -468,7 +471,8 @@ def main(args): elif is_ios: _RunOnIOSTarget(args.binary_dir, test, - is_xcuitest=test.startswith('ios')) + is_xcuitest=test.startswith('ios'), + gtest_filter=args.gtest_filter) else: subprocess.check_call([os.path.join(args.binary_dir, test)] + extra_command_line)