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

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

Issue 2142243003: Add support for new iossim in Xcode 8. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build@master
Patch Set: Created 4 years, 5 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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 '-c', 'Print:CFBundleIdentifier', 480 '-c', 'Print:CFBundleIdentifier',
481 os.path.join(self.app_path, 'Info.plist'), 481 os.path.join(self.app_path, 'Info.plist'),
482 ).stdout[0] 482 ).stdout[0]
483 483
484 self.iossim_path = iossim_path 484 self.iossim_path = iossim_path
485 self.platform = platform 485 self.platform = platform
486 self.version = version 486 self.version = version
487 self.timeout = '120' 487 self.timeout = '120'
488 self.homedir = '' 488 self.homedir = ''
489 self.start_time = None 489 self.start_time = None
490 self.xcode_version = xcode_version
smut 2016/07/12 23:58:59 Can probably set this in the base class.
justincohen 2016/07/14 19:59:50 Done.
490 491
491 def SetStartTime(self): 492 def SetStartTime(self):
492 """Sets the start time, for finding crash reports during this run.""" 493 """Sets the start time, for finding crash reports during this run."""
493 # Crash reports have a timestamp in their filename, formatted as 494 # Crash reports have a timestamp in their filename, formatted as
494 # YYYY-MM-DD-HHMMSS. 495 # YYYY-MM-DD-HHMMSS.
495 self.start_time = time.strftime('%Y-%m-%d-%H%M%S', time.localtime()) 496 self.start_time = time.strftime('%Y-%m-%d-%H%M%S', time.localtime())
496 497
497 def CreateNewHomeDirectory(self): 498 def CreateNewHomeDirectory(self):
498 """Creates a new home directory for the simulator.""" 499 """Creates a new home directory for the simulator."""
499 self.homedir = tempfile.mkdtemp() 500 if self.xcode_version == '8.0':
501 cmd = [
502 self.iossim_path,
503 '-d', self.platform,
504 '-s', self.version,
505 '-p'
506 ]
smut 2016/07/12 23:58:59 Can we use -w to wipe the simulator here, so that
justincohen 2016/07/14 19:59:50 See below.
smut 2016/07/14 21:25:54 I think it should wipe here as well. This call tha
justincohen 2016/07/14 22:24:32 Wipe is very fast, this SGTM, done.
507 self.homedir = subprocess.check_output(cmd)
508 else:
509 self.homedir = tempfile.mkdtemp()
510
500 511
501 def RemoveHomeDirectory(self): 512 def RemoveHomeDirectory(self):
502 """Recursively removes the home directory being used by the simulator.""" 513 """Recursively removes the home directory being used by the simulator."""
503 if os.path.exists(self.homedir): 514 if self.xcode_version == '8.0':
504 shutil.rmtree(self.homedir, ignore_errors=True)
505 self.homedir = '' 515 self.homedir = ''
smut 2016/07/12 23:58:59 I think it should shutil.rmtree even on Xcode 8 so
justincohen 2016/07/14 19:59:50 Xcode seems to freak out. How about we just call
smut 2016/07/14 21:25:54 Ok seems fine. -w should wipe the installed app an
justincohen 2016/07/14 22:24:32 yes/
516 else:
517 if os.path.exists(self.homedir):
518 shutil.rmtree(self.homedir, ignore_errors=True)
519 self.homedir = ''
506 520
507 def KillSimulators(self): 521 def KillSimulators(self):
508 """Forcibly kills any running iOS simulator instances.""" 522 """Forcibly kills any running iOS simulator instances."""
509 kill_cmd = [ 523 kill_cmd = [
510 'pkill', 524 'pkill',
511 '-9', 525 '-9',
512 '-x', 526 '-x',
513 # The iOS simulator has a different name depending on the Xcode version. 527 # The iOS simulator has a different name depending on the Xcode version.
514 'iPhone Simulator', # Xcode 5 528 'iPhone Simulator', # Xcode 5
515 'iOS Simulator', # Xcode 6 529 'iOS Simulator', # Xcode 6
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 blacklist: Whether to blacklist the elements of test_filter or not. Only 689 blacklist: Whether to blacklist the elements of test_filter or not. Only
676 works when test_filter is not None. 690 works when test_filter is not None.
677 691
678 Returns: 692 Returns:
679 A list whose elements are the args representing the command. 693 A list whose elements are the args representing the command.
680 """ 694 """
681 cmd = [ 695 cmd = [
682 self.iossim_path, 696 self.iossim_path,
683 '-d', self.platform, 697 '-d', self.platform,
684 '-s', self.version, 698 '-s', self.version,
685 '-t', self.timeout,
686 '-u', self.homedir,
687 ] 699 ]
700
688 args = [] 701 args = []
689 702
703 if self.xcode_version == '8.0':
704 cmd.extend(['-w'])
smut 2016/07/12 23:58:59 I don't think it should include -w here. GetLaunch
justincohen 2016/07/14 19:59:50 Removed.
705 else:
706 cmd.extend([
707 '-t', self.timeout,
708 '-u', self.homedir
709 ])
710
690 if test_filter is not None: 711 if test_filter is not None:
691 kif_filter = self.GetKIFTestFilter(test_filter, blacklist) 712 kif_filter = self.GetKIFTestFilter(test_filter, blacklist)
692 gtest_filter = self.GetGTestFilter(test_filter, blacklist) 713 gtest_filter = self.GetGTestFilter(test_filter, blacklist)
693 714
694 cmd.extend([ 715 cmd.extend([
695 '-e', 'GKIF_SCENARIO_FILTER=%s' % kif_filter, 716 '-e', 'GKIF_SCENARIO_FILTER=%s' % kif_filter,
696 ]) 717 ])
697 args.append('--gtest_filter=%s' % gtest_filter) 718
719 if self.xcode_version == '8.0':
720 cmd.extend([
721 '-c', '--gtest_filter=%s' % gtest_filter,
722 ])
723 else:
724 args.append('--gtest_filter=%s' % gtest_filter)
698 725
699 cmd.append(self.app_path) 726 cmd.append(self.app_path)
700 cmd.extend(self.test_args) 727 cmd.extend(self.test_args)
701 cmd.extend(args) 728 cmd.extend(args)
702 return cmd 729 return cmd
703 730
704 @TestRunner.RequireTearDown 731 @TestRunner.RequireTearDown
705 def Launch(self, *args, **kwargs): 732 def Launch(self, *args, **kwargs):
706 """Launches the test.""" 733 """Launches the test."""
707 self.SetUp() 734 self.SetUp()
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
1389 ) 1416 )
1390 1417
1391 # Uninstall and re-install the app. 1418 # Uninstall and re-install the app.
1392 self.UninstallApp() 1419 self.UninstallApp()
1393 self.InstallApp() 1420 self.InstallApp()
1394 1421
1395 result = self._Run( 1422 result = self._Run(
1396 self.GetLaunchCommand(), self.GetLaunchEnvironment(), *args, **kwargs) 1423 self.GetLaunchCommand(), self.GetLaunchEnvironment(), *args, **kwargs)
1397 1424
1398 return self.RunAllTests(result, *args, **kwargs) 1425 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