Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(432)

Side by Side Diff: scripts/slave/ios/test_runner.py

Issue 2206633002: Set UNbufferIO env for Earlgrey tests outputs. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Merge branch 'master' of https://chromium.googlesource.com/chromium/tools/build into crash Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Contains test runners for launching tests on simulators and devices.""" 6 """Contains test runners for launching tests on simulators and devices."""
7 7
8 # pylint: disable=relative-import 8 # pylint: disable=relative-import
9 import environment_setup 9 import environment_setup
10 10
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 851
852 def HandleJsonFileWithPath(self, summary): 852 def HandleJsonFileWithPath(self, summary):
853 """Parse data in summarydir and send to perf dashboard.""" 853 """Parse data in summarydir and send to perf dashboard."""
854 with open(summary) as jsonFile: 854 with open(summary) as jsonFile:
855 return json.load(jsonFile) 855 return json.load(jsonFile)
856 856
857 def GetLaunchEnvironment(self): 857 def GetLaunchEnvironment(self):
858 """Returns the environment which is used to run the xctest. 858 """Returns the environment which is used to run the xctest.
859 """ 859 """
860 env = dict(os.environ, APP_TARGET_NAME=self.test_host_name, 860 env = dict(os.environ, APP_TARGET_NAME=self.test_host_name,
861 TEST_TARGET_NAME=self.test_target_name) 861 TEST_TARGET_NAME=self.test_target_name,
862 NSUnbufferedIO='YES')
862 return env 863 return env
863 864
864 def GetLaunchCommand(self, test_filter=None, blacklist=False): 865 def GetLaunchCommand(self, test_filter=None, blacklist=False):
865 """Returns the command which is used to launch the test. 866 """Returns the command which is used to launch the test.
866 867
867 Args: 868 Args:
868 test_filter: A list of tests to filter by, or None to mean all. 869 test_filter: A list of tests to filter by, or None to mean all.
869 blacklist: Whether to blacklist the elements of test_filter or not. Only 870 blacklist: Whether to blacklist the elements of test_filter or not. Only
870 works when test_filter is not None. 871 works when test_filter is not None.
871 872
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
1259 Args: 1260 Args:
1260 test_filter: A list of tests to filter by, or None to mean all. 1261 test_filter: A list of tests to filter by, or None to mean all.
1261 blacklist: Whether to blacklist the elements of test_filter or not. Only 1262 blacklist: Whether to blacklist the elements of test_filter or not. Only
1262 works when test_filter is not None. 1263 works when test_filter is not None.
1263 1264
1264 Returns: 1265 Returns:
1265 A list whose elements are the args representing the command. 1266 A list whose elements are the args representing the command.
1266 """ 1267 """
1267 built_dir = os.path.split(self.app_path)[0] 1268 built_dir = os.path.split(self.app_path)[0]
1268 1269
1269 cmd = ['xcodebuild', 'test', 1270 cmd = [
1270 'BUILT_PRODUCTS_DIR=%s' % built_dir, 1271 'xcodebuild', 'test',
1271 '-project', self.test_project_dir, 1272 'BUILT_PRODUCTS_DIR=%s' % built_dir,
1272 '-scheme','TestProject', 1273 '-project', self.test_project_dir,
1273 '-destination','platform=iOS Simulator,name=%s,OS=%s' 1274 '-scheme','TestProject',
1274 % (self.platform, self.version), 1275 '-destination','platform=iOS Simulator,name=%s,OS=%s'
1275 '-archivePath', self.homedir, 1276 % (self.platform, self.version),
1276 'APP_TARGET_NAME=%s' % self.test_host_name, 1277 '-archivePath', self.homedir,
1277 'TEST_TARGET_NAME=%s' % self.test_target_name] 1278 'APP_TARGET_NAME=%s' % self.test_host_name,
1279 'TEST_TARGET_NAME=%s' % self.test_target_name,
1280 'NSUnbufferedIO=YES'
1281 ]
1278 return cmd 1282 return cmd
1279 1283
1280 @TestRunner.RequireTearDown 1284 @TestRunner.RequireTearDown
1281 def Launch(self, *args, **kwargs): 1285 def Launch(self, *args, **kwargs):
1282 """Launches the test.""" 1286 """Launches the test."""
1283 self.SetUp() 1287 self.SetUp()
1284 1288
1285 result = self._Run( 1289 result = self._Run(
1286 self.GetLaunchCommand(), self.GetLaunchEnvironment(), *args, **kwargs) 1290 self.GetLaunchCommand(), self.GetLaunchEnvironment(), *args, **kwargs)
1287 1291
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1418 Args: 1422 Args:
1419 test_filter: A list of tests to filter by, or None to mean all. 1423 test_filter: A list of tests to filter by, or None to mean all.
1420 blacklist: Whether to blacklist the elements of test_filter or not. Only 1424 blacklist: Whether to blacklist the elements of test_filter or not. Only
1421 works when test_filter is not None. 1425 works when test_filter is not None.
1422 1426
1423 Returns: 1427 Returns:
1424 A list whose elements are the args representing the command. 1428 A list whose elements are the args representing the command.
1425 """ 1429 """
1426 built_dir = os.path.split(self.app_path)[0] 1430 built_dir = os.path.split(self.app_path)[0]
1427 1431
1428 cmd = ['xcodebuild', 'test-without-building', 1432 cmd = [
1429 'BUILT_PRODUCTS_DIR=%s' % built_dir, 1433 'xcodebuild', 'test-without-building',
1430 'CONFIGURATION_BUILD_DIR=%s' % built_dir, 1434 'BUILT_PRODUCTS_DIR=%s' % built_dir,
1431 '-project', self.test_project_dir, 1435 'CONFIGURATION_BUILD_DIR=%s' % built_dir,
1432 '-configuration', 'iphoneos', 1436 '-project', self.test_project_dir,
1433 '-scheme', 'TestProject', 1437 '-configuration', 'iphoneos',
1434 '-destination','id=%s' % self.device_id, 1438 '-scheme', 'TestProject',
1435 'APP_TARGET_NAME=%s' % self.test_host_name, 1439 '-destination','id=%s' % self.device_id,
1436 'TEST_TARGET_NAME=%s' % self.test_target_name] 1440 'APP_TARGET_NAME=%s' % self.test_host_name,
1441 'TEST_TARGET_NAME=%s' % self.test_target_name,
1442 'NSUnbufferedIO=YES'
1443 ]
1437 return cmd 1444 return cmd
1438 1445
1439 @TestRunner.RequireTearDown 1446 @TestRunner.RequireTearDown
1440 def Launch(self, *args, **kwargs): 1447 def Launch(self, *args, **kwargs):
1441 """Launches the test.""" 1448 """Launches the test."""
1442 self.InstallApp() 1449 self.InstallApp()
1443 1450
1444 result = self._Run( 1451 result = self._Run(
1445 self.GetLaunchCommand(), self.GetLaunchEnvironment(), *args, **kwargs) 1452 self.GetLaunchCommand(), self.GetLaunchEnvironment(), *args, **kwargs)
1446 1453
1447 if result.crashed and not result.crashed_test: 1454 if result.crashed and not result.crashed_test:
1448 # If the app crashed, but there is no specific test which crashed, 1455 # If the app crashed, but there is no specific test which crashed,
1449 # then the app must have failed to even start. Try one more time. 1456 # then the app must have failed to even start. Try one more time.
1450 self.Print( 1457 self.Print(
1451 '%s appears to have crashed on startup. Retrying...' % self.app_name, 1458 '%s appears to have crashed on startup. Retrying...' % self.app_name,
1452 blank_lines=2, 1459 blank_lines=2,
1453 time_to_sleep=5, 1460 time_to_sleep=5,
1454 ) 1461 )
1455 1462
1456 # Uninstall and re-install the app. 1463 # Uninstall and re-install the app.
1457 self.UninstallApp() 1464 self.UninstallApp()
1458 self.InstallApp() 1465 self.InstallApp()
1459 1466
1460 result = self._Run( 1467 result = self._Run(
1461 self.GetLaunchCommand(), self.GetLaunchEnvironment(), *args, **kwargs) 1468 self.GetLaunchCommand(), self.GetLaunchEnvironment(), *args, **kwargs)
1462 1469
1463 return self.RunAllTests(result, *args, **kwargs) 1470 return self.RunAllTests(result, *args, **kwargs)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698