| Index: ios/build/bots/scripts/test_runner.py
|
| diff --git a/ios/build/bots/scripts/test_runner.py b/ios/build/bots/scripts/test_runner.py
|
| index b06cbbbec003d78f2719b11d3a31af3358754df0..6cc4fc4eef4292b7b8f3686404c55cedec4d3327 100644
|
| --- a/ios/build/bots/scripts/test_runner.py
|
| +++ b/ios/build/bots/scripts/test_runner.py
|
| @@ -19,6 +19,9 @@ import gtest_utils
|
| import xctest_utils
|
|
|
|
|
| +DERIVED_DATA = os.path.expanduser('~/Library/Developer/Xcode/DerivedData')
|
| +
|
| +
|
| XCTEST_PROJECT = os.path.abspath(os.path.join(
|
| os.path.dirname(__file__),
|
| 'TestProject',
|
| @@ -230,6 +233,26 @@ class TestRunner(object):
|
| os.path.join(self.out_dir, 'desktop_%s.png' % time.time()),
|
| ])
|
|
|
| + def retrieve_derived_data(self):
|
| + """Retrieves the contents of DerivedData"""
|
| + # DerivedData contains some logs inside workspace-specific directories.
|
| + # Since we don't control the name of the workspace or project, most of
|
| + # the directories are just called "temporary", making it hard to tell
|
| + # which directory we need to retrieve. Instead we just delete the
|
| + # entire contents of this directory before starting and return the
|
| + # entire contents after the test is over.
|
| + if os.path.exists(DERIVED_DATA):
|
| + os.mkdir(os.path.join(self.out_dir, 'DerivedData'))
|
| + derived_data = os.path.join(self.out_dir, 'DerivedData')
|
| + for directory in os.listdir(DERIVED_DATA):
|
| + shutil.move(os.path.join(DERIVED_DATA, directory), derived_data)
|
| +
|
| + def wipe_derived_data(self):
|
| + """Removes the contents of Xcode's DerivedData directory."""
|
| + if os.path.exists(DERIVED_DATA):
|
| + shutil.rmtree(DERIVED_DATA)
|
| + os.mkdir(DERIVED_DATA)
|
| +
|
| def _run(self, cmd):
|
| """Runs the specified command, parsing GTest output.
|
|
|
| @@ -436,6 +459,7 @@ class SimulatorTestRunner(TestRunner):
|
| """Performs setup actions which must occur prior to every test launch."""
|
| self.kill_simulators()
|
| self.wipe_simulator()
|
| + self.wipe_derived_data()
|
| self.homedir = self.get_home_directory()
|
| # Crash reports have a timestamp in their file name, formatted as
|
| # YYYY-MM-DD-HHMMSS. Save the current time in the same format so
|
| @@ -493,6 +517,7 @@ class SimulatorTestRunner(TestRunner):
|
| """Performs cleanup actions which must occur after every test launch."""
|
| self.extract_test_data()
|
| self.retrieve_crash_reports()
|
| + self.retrieve_derived_data()
|
| self.screenshot_desktop()
|
| self.kill_simulators()
|
| self.wipe_simulator()
|
| @@ -603,6 +628,7 @@ class DeviceTestRunner(TestRunner):
|
| def set_up(self):
|
| """Performs setup actions which must occur prior to every test launch."""
|
| self.uninstall_apps()
|
| + self.wipe_derived_data()
|
| self.install_app()
|
|
|
| def extract_test_data(self):
|
| @@ -635,6 +661,7 @@ class DeviceTestRunner(TestRunner):
|
| def tear_down(self):
|
| """Performs cleanup actions which must occur after every test launch."""
|
| self.screenshot_desktop()
|
| + self.retrieve_derived_data()
|
| self.extract_test_data()
|
| self.retrieve_crash_reports()
|
| self.uninstall_apps()
|
|
|