Skip to content

Commit

Permalink
[LLDB] Fix write permission error in TestGlobalModuleCache.py (llvm#7…
Browse files Browse the repository at this point in the history
…6171)

TestGlobalModuleCache.py, a recently added test, tries to update a
source file in the build directory, but it assumes the file is writable.
In our distributed build and test system, this is not always true, so
the test often fails with a write permissions error.

This change fixes that by setting the permissions on the file to be
writable before attempting to write to it.
  • Loading branch information
cmtice authored Dec 21, 2023
1 parent 74a09bd commit 1830fad
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ def copy_to_main(self, src, dst):
# a previous build, so sleep a bit here to ensure that the touch is later.
time.sleep(2)
try:
# Make sure dst is writeable before trying to write to it.
subprocess.run(
["chmod", "777", dst],
stdin=None,
capture_output=False,
encoding="utf-8",
)
shutil.copy(src, dst)
except:
self.fail(f"Could not copy {src} to {dst}")
Expand Down

0 comments on commit 1830fad

Please sign in to comment.