Commit ab57b409 authored by Zhaoyang Li's avatar Zhaoyang Li Committed by Chromium LUCI CQ

[iOS][test runner] Use error log level for GMock.

This change will prevent "Uninteresting mock function call" GMock log
spams, which could attribute to 1/3 of log lines in some unit test
targets and is causing slowness in swarming infra processing logs at
collecting tasks.

Bug: 1157537
Change-Id: I1dd2780329ab8568a4582d6ef4e3a5a7d4a68016
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2587605Reviewed-by: default avatarJustin Cohen <justincohen@chromium.org>
Commit-Queue: Zhaoyang Li <zhaoyangli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841664}
parent 473b3bf5
......@@ -472,6 +472,8 @@ class DeviceXCTestUnitTestsApp(GTestsApp):
]
self.test_args.append('--gtest_filter=%s' % gtest_filter)
self.test_args.append('--gmock_verbose=error')
xctestrun_data['TestTargetName'].update(
{'CommandLineArguments': self.test_args})
......@@ -587,6 +589,8 @@ class SimulatorXCTestUnitTestsApp(GTestsApp):
]
self.test_args.append('--gtest_filter=%s' % gtest_filter)
self.test_args.append('--gmock_verbose=error')
xctestrun_data['TestTargetName'].update(
{'CommandLineArguments': self.test_args})
......
......@@ -3,12 +3,20 @@
# found in the LICENSE file.
"""Unittests for test_apps.py."""
import mock
import unittest
import test_apps
import test_runner_test
_TEST_APP_PATH = '/path/to/test_app.app'
_HOST_APP_PATH = '/path/to/host_app.app'
_BUNDLE_ID = 'org.chromium.gtest.test-app'
_MODULE_NAME = 'test_app'
_XCTEST_PATH = '/PlugIns/boringssl_ssl_tests_module.xctest'
class GetKIFTestFilterTest(test_runner_test.TestCase):
"""Tests for test_runner.get_kif_test_filter."""
......@@ -58,5 +66,82 @@ class GetGTestFilterTest(test_runner_test.TestCase):
self.assertEqual(test_apps.get_gtest_filter(tests, invert=True), expected)
class DeviceXCTestUnitTestsAppTest(test_runner_test.TestCase):
"""Tests to test methods of SimulatorXCTestUnitTestsApp."""
@mock.patch('test_apps.get_bundle_id', return_value=_BUNDLE_ID)
@mock.patch(
'test_apps.DeviceXCTestUnitTestsApp._xctest_path',
return_value=_XCTEST_PATH)
@mock.patch('os.path.exists', return_value=True)
def test_fill_xctestrun_node(self, *args):
"""Tests fill_xctestrun_node method."""
test_app = test_apps.DeviceXCTestUnitTestsApp(_TEST_APP_PATH)
expected_xctestrun_node = {
'TestTargetName': {
'CommandLineArguments': [
'--enable-run-ios-unittests-with-xctest',
'--gmock_verbose=error'
],
'IsAppHostedTestBundle': True,
'TestBundlePath': '__TESTHOST__/%s' % _XCTEST_PATH,
'TestHostBundleIdentifier': _BUNDLE_ID,
'TestHostPath': '%s' % _TEST_APP_PATH,
'TestingEnvironmentVariables': {
'DYLD_INSERT_LIBRARIES':
'__TESTHOST__/Frameworks/libXCTestBundleInject.dylib',
'DYLD_LIBRARY_PATH':
'__PLATFORMS__/iPhoneOS.platform/Developer/Library',
'DYLD_FRAMEWORK_PATH':
'__PLATFORMS__/iPhoneOS.platform/Developer/'
'Library/Frameworks',
'XCInjectBundleInto':
'__TESTHOST__/%s' % _MODULE_NAME
}
}
}
xctestrun_node = test_app.fill_xctestrun_node()
self.assertEqual(xctestrun_node, expected_xctestrun_node)
class SimulatorXCTestUnitTestsAppTest(test_runner_test.TestCase):
"""Tests to test methods of SimulatorXCTestUnitTestsApp."""
@mock.patch('test_apps.get_bundle_id', return_value=_BUNDLE_ID)
@mock.patch(
'test_apps.SimulatorXCTestUnitTestsApp._xctest_path',
return_value=_XCTEST_PATH)
@mock.patch('os.path.exists', return_value=True)
def test_fill_xctestrun_node(self, *args):
"""Tests fill_xctestrun_node method."""
test_app = test_apps.SimulatorXCTestUnitTestsApp(_TEST_APP_PATH)
expected_xctestrun_node = {
'TestTargetName': {
'CommandLineArguments': [
'--enable-run-ios-unittests-with-xctest',
'--gmock_verbose=error'
],
'IsAppHostedTestBundle': True,
'TestBundlePath': '__TESTHOST__/%s' % _XCTEST_PATH,
'TestHostBundleIdentifier': _BUNDLE_ID,
'TestHostPath': '%s' % _TEST_APP_PATH,
'TestingEnvironmentVariables': {
'DYLD_INSERT_LIBRARIES':
'__PLATFORMS__/iPhoneSimulator.platform/Developer/usr/lib/'
'libXCTestBundleInject.dylib',
'DYLD_LIBRARY_PATH':
'__PLATFORMS__/iPhoneSimulator.platform/Developer/Library',
'DYLD_FRAMEWORK_PATH':
'__PLATFORMS__/iPhoneSimulator.platform/Developer/'
'Library/Frameworks',
'XCInjectBundleInto':
'__TESTHOST__/%s' % _MODULE_NAME
}
}
}
xctestrun_node = test_app.fill_xctestrun_node()
self.assertEqual(xctestrun_node, expected_xctestrun_node)
if __name__ == '__main__':
unittest.main()
\ No newline at end of file
unittest.main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment