[Lldb-commits] [lldb] [lldb][test] Fix TestUseSourceCache for readonly source trees (PR #113251)

Jordan Rupprecht via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 21 19:32:59 PDT 2024


https://github.com/rupprecht created https://github.com/llvm/llvm-project/pull/113251

TestUseSourceCache attempts to write to a build artifact copied from the source tree, and asserts the write succeeded. If the source tree is read only, the copy will also be read only, causing it to fail. When producing the build artifact, ensure that it is writable.

I use `chmod` as a build step to do this, but I believe that is linuxish-only thing, so I excluded this extra command for Windows.

>From 0d27f7643007805bc2b1f2965edbd71d6563dae3 Mon Sep 17 00:00:00 2001
From: Jordan Rupprecht <rupprecht at google.com>
Date: Mon, 21 Oct 2024 19:29:50 -0700
Subject: [PATCH] [lldb][test] Fix TestUseSourceCache for readonly source trees

TestUseSourceCache attempts to write to a build artifact copied from the source tree, and asserts the write succeeded. If the source tree is read only, the copy will also be read only, causing it to fail. When producing the build artifact, ensure that it is writable.

I use `chmod` as a build step to do this, but I believe that is linuxish-only thing, so I excluded this extra command for Windows.
---
 lldb/test/API/commands/settings/use_source_cache/Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lldb/test/API/commands/settings/use_source_cache/Makefile b/lldb/test/API/commands/settings/use_source_cache/Makefile
index 791cb7d868d87e..0090acf5591daa 100644
--- a/lldb/test/API/commands/settings/use_source_cache/Makefile
+++ b/lldb/test/API/commands/settings/use_source_cache/Makefile
@@ -6,3 +6,6 @@ include Makefile.rules
 # Copy file into the build folder to enable the test to modify it.
 main-copy.cpp: main.cpp
 	cp -f $< $@
+ifneq "$(OS)" "Windows_NT"  # chmod is not available on Windows
+	chmod u+w $@
+endif



More information about the lldb-commits mailing list