Bug 1478050 - [moztest] Clean up broken symlinks when setting up test_harness_root r=gbrown
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Wed, 25 Jul 2018 19:05:50 +0000
changeset 428405 dc2c0589597ac48331473183b823604d1c29621e
parent 428404 aeb7d06d9638afe252109dc4a848fcf5371cd039
child 428406 010c910436fe42d4e734d0f91f810662063d61eb
push id66871
push userahalberstadt@mozilla.com
push dateWed, 25 Jul 2018 19:08:38 +0000
treeherderautoland@dc2c0589597a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgbrown
bugs1478050
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1478050 - [moztest] Clean up broken symlinks when setting up test_harness_root r=gbrown It's unclear how this situation can actually happen, but it has caused a couple of intermittents. Differential Revision: https://phabricator.services.mozilla.com/D2355
testing/mozbase/moztest/moztest/selftest/fixtures.py
--- a/testing/mozbase/moztest/moztest/selftest/fixtures.py
+++ b/testing/mozbase/moztest/moztest/selftest/fixtures.py
@@ -54,16 +54,19 @@ def setup_test_harness(request):
         if harness_root:
             sys.path.insert(0, harness_root)
 
             # Link the test files to the test package so updates are automatically
             # picked up. Fallback to copy on Windows.
             if files_dir:
                 test_root = os.path.join(harness_root, 'tests', 'selftests')
                 if not os.path.exists(test_root):
+                    if os.path.lexists(test_root):
+                        os.remove(test_root)
+
                     if hasattr(os, 'symlink'):
                         os.symlink(files_dir, test_root)
                     else:
                         shutil.copytree(files_dir, test_root)
 
         elif 'TEST_HARNESS_ROOT' in os.environ:
             # The mochitest tests will run regardless of whether a build exists or not.
             # In a local environment, they should simply be skipped if setup fails. But