mirror of
https://github.com/chromium/crashpad.git
synced 2024-12-27 07:14:10 +08:00
[ios] Fix --gtest_filter for non-xcuitest targets
Change-Id: I477919feec68d317ca3cb8a0d07022e9405156dd Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4118347 Reviewed-by: Justin Cohen <justincohen@chromium.org> Commit-Queue: Ben Hamilton <benhamilton@google.com>
This commit is contained in:
parent
62a0099c0e
commit
bd479a1202
@ -315,7 +315,7 @@ def _RunOnAndroidTarget(binary_dir, test, android_device, extra_command_line):
|
|||||||
def _RunOnIOSTarget(binary_dir, test, is_xcuitest=False, gtest_filter=None):
|
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."""
|
"""Runs the given iOS |test| app on iPhone 8 with the default OS version."""
|
||||||
|
|
||||||
def xctest(binary_dir, test):
|
def xctest(binary_dir, test, gtest_filter=None):
|
||||||
"""Returns a dict containing the xctestrun data needed to run an
|
"""Returns a dict containing the xctestrun data needed to run an
|
||||||
XCTest-based test app."""
|
XCTest-based test app."""
|
||||||
test_path = os.path.join(CRASHPAD_DIR, binary_dir)
|
test_path = os.path.join(CRASHPAD_DIR, binary_dir)
|
||||||
@ -332,6 +332,8 @@ def _RunOnIOSTarget(binary_dir, test, is_xcuitest=False, gtest_filter=None):
|
|||||||
'XCInjectBundleInto': '__TESTHOST__/' + test,
|
'XCInjectBundleInto': '__TESTHOST__/' + test,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if gtest_filter:
|
||||||
|
module_data['CommandLineArguments'] = ['--gtest_filter='+gtest_filter]
|
||||||
return {test: module_data}
|
return {test: module_data}
|
||||||
|
|
||||||
def xcuitest(binary_dir, test):
|
def xcuitest(binary_dir, test):
|
||||||
@ -368,18 +370,17 @@ def _RunOnIOSTarget(binary_dir, test, is_xcuitest=False, gtest_filter=None):
|
|||||||
|
|
||||||
xctestrun_path = f.name
|
xctestrun_path = f.name
|
||||||
print(xctestrun_path)
|
print(xctestrun_path)
|
||||||
with open(xctestrun_path, 'wb') as fp:
|
|
||||||
if is_xcuitest:
|
|
||||||
plistlib.dump(xcuitest(binary_dir, test), fp)
|
|
||||||
else:
|
|
||||||
plistlib.dump(xctest(binary_dir, test), fp)
|
|
||||||
|
|
||||||
command = [
|
command = [
|
||||||
'xcodebuild', 'test-without-building', '-xctestrun', xctestrun_path,
|
'xcodebuild', 'test-without-building', '-xctestrun', xctestrun_path,
|
||||||
'-destination', 'platform=iOS Simulator,name=iPhone 8',
|
'-destination', 'platform=iOS Simulator,name=iPhone 8',
|
||||||
]
|
]
|
||||||
|
with open(xctestrun_path, 'wb') as fp:
|
||||||
|
if is_xcuitest:
|
||||||
|
plistlib.dump(xcuitest(binary_dir, test), fp)
|
||||||
if gtest_filter:
|
if gtest_filter:
|
||||||
command.append('-only-testing:' + test + '/' + gtest_filter)
|
command.append('-only-testing:' + test + '/' + gtest_filter)
|
||||||
|
else:
|
||||||
|
plistlib.dump(xctest(binary_dir, test, gtest_filter), fp)
|
||||||
subprocess.check_call(command)
|
subprocess.check_call(command)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user