summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcmtice <cmtice@google.com>2023-12-21 12:05:36 -0800
committerGitHub <noreply@github.com>2023-12-21 12:05:36 -0800
commit1830fadb78be9993cfeeaa7fb6867c3df1a53a8b (patch)
tree4493ac1946fe9a3c04d7471a3ece2836fb97e975
parent74a09bd1ec6066d56880df1ae1a2c0258442cee9 (diff)
[LLDB] Fix write permission error in TestGlobalModuleCache.py (#76171)
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.
-rw-r--r--lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py b/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
index 6bb22c46efb4..5b6e9e8a588a 100644
--- a/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
+++ b/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
@@ -26,6 +26,13 @@ class GlobalModuleCacheTestCase(TestBase):
# 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}")