On Mon, May 11 2026, Vipin Sharma wrote: > Move luo_test_utils.[ch] into a lib/ directory and pull the rules to > build them out into a separate make script. This will enable these > utilities to be also built by and used within other selftests (such as > VFIO). > > No functional change intended. > > Signed-off-by: Vipin Sharma <[email protected]> > Co-developed-by: David Matlack <[email protected]> > Signed-off-by: David Matlack <[email protected]> > Signed-off-by: Vipin Sharma <[email protected]> > --- > tools/testing/selftests/liveupdate/.gitignore | 1 + > tools/testing/selftests/liveupdate/Makefile | 14 ++++--------- > .../include/libliveupdate.h} | 8 ++++----
Nit: perhaps libluo is a bit less wordy? No strong opinions on it though, so I am fine with anything. [...] > diff --git a/tools/testing/selftests/liveupdate/lib/libliveupdate.mk > b/tools/testing/selftests/liveupdate/lib/libliveupdate.mk > new file mode 100644 > index 000000000000..fffd95b085b6 > --- /dev/null > +++ b/tools/testing/selftests/liveupdate/lib/libliveupdate.mk > @@ -0,0 +1,20 @@ > +include $(top_srcdir)/scripts/subarch.include > +ARCH ?= $(SUBARCH) > + > +LIBLIVEUPDATE_SRCDIR := $(selfdir)/liveupdate/lib > + > +LIBLIVEUPDATE_C := liveupdate.c > + > +LIBLIVEUPDATE_OUTPUT := $(OUTPUT)/libliveupdate > + > +LIBLIVEUPDATE_O := $(patsubst %.c, $(LIBLIVEUPDATE_OUTPUT)/%.o, > $(LIBLIVEUPDATE_C)) > + > +LIBLIVEUPDATE_O_DIRS := $(shell dirname $(LIBLIVEUPDATE_O) | uniq) > +$(shell mkdir -p $(LIBLIVEUPDATE_O_DIRS)) Sashiko complains about this: https://sashiko.dev/#/patchset/20260511201155.1488670-1-vipinsh%40google.com Does this execute the directory creation unconditionally during Make parsing? Because it uses the shell function at the top level, this directory creation will run on every Make invocation, including utility targets like make clean or make help. Could the shell dirname command also be fragile if LIBLIVEUPDATE_O ever expands to multiple files? Strictly POSIX-compliant systems only accept a single argument for dirname. Would it be better to use GNU Make's built-in $(dir ...) function and move the directory creation into the compilation recipe below (e.g., @mkdir -p $(dir $@)), or use an order-only prerequisite? The first one seems to make sense. The second one not so much. The third I have no idea. I don't know Makefiles well enough. Perhaps worth a look? With these comments addressed, feel free to add Acked-by: Pratyush Yadav (Google) <[email protected]> > + > +CFLAGS += -I$(LIBLIVEUPDATE_SRCDIR)/include > + > +$(LIBLIVEUPDATE_O): $(LIBLIVEUPDATE_OUTPUT)/%.o : $(LIBLIVEUPDATE_SRCDIR)/%.c > + $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@ > + > +EXTRA_CLEAN += $(LIBLIVEUPDATE_OUTPUT) [...] -- Regards, Pratyush Yadav

