[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] tools/tests: Fix newly introduced Makefile



commit a5d0e9c901044055c1c412d0825b434f21ec273e
Author:     Anthony PERARD <anthony.perard@xxxxxxxxxx>
AuthorDate: Mon Apr 14 16:17:14 2025 +0200
Commit:     Anthony PERARD <anthony.perard@xxxxxxxxxx>
CommitDate: Fri Apr 25 11:44:03 2025 +0200

    tools/tests: Fix newly introduced Makefile
    
    Fix few issue with this new directory:
    - clean generated files
    - and ignore those generated files
    - include the dependency files generated by `gcc`.
    - rework prerequisites:
      "test-rangeset.o" also needs the generated files "list.h" and
      "rangeset.h". Technically, both only needs "harness.h" which needs
      the generated headers, but that's a bit simpler and the previous
      point will add the dependency on "harness.h" automatically.
    
    This last point fix an issue where `make` might decide to build
    "test-rangeset.o" before the other files are ready.
    
    Fixes: 7bf777b42cad ("tootls/tests: introduce unit tests for rangesets")
    Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
    Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
---
 tools/tests/rangeset/.gitignore | 4 ++++
 tools/tests/rangeset/Makefile   | 8 ++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/tools/tests/rangeset/.gitignore b/tools/tests/rangeset/.gitignore
new file mode 100644
index 0000000000..cdeb778535
--- /dev/null
+++ b/tools/tests/rangeset/.gitignore
@@ -0,0 +1,4 @@
+/list.h
+/rangeset.c
+/rangeset.h
+/test-rangeset
diff --git a/tools/tests/rangeset/Makefile b/tools/tests/rangeset/Makefile
index 70076eff34..3dafcbd054 100644
--- a/tools/tests/rangeset/Makefile
+++ b/tools/tests/rangeset/Makefile
@@ -12,7 +12,7 @@ run: $(TARGET)
 
 .PHONY: clean
 clean:
-       $(RM) -- *.o $(TARGET) $(DEPS_RM)
+       $(RM) -- *.o $(TARGET) $(DEPS_RM) list.h rangeset.h rangeset.c
 
 .PHONY: distclean
 distclean: clean
@@ -32,7 +32,7 @@ rangeset.h: $(XEN_ROOT)/xen/include/xen/rangeset.h
 list.h rangeset.h:
        sed -e '/#include/d' <$< >$@
 
-rangeset.c: $(XEN_ROOT)/xen/common/rangeset.c list.h rangeset.h
+rangeset.c: $(XEN_ROOT)/xen/common/rangeset.c
        # Remove includes and add the test harness header
        sed -e '/#include/d' -e '1s/^/#include "harness.h"/' <$< >$@
 
@@ -42,5 +42,9 @@ CFLAGS += $(CFLAGS_xeninclude)
 
 LDFLAGS += $(APPEND_LDFLAGS)
 
+test-rangeset.o rangeset.o: list.h rangeset.h
+
 test-rangeset: rangeset.o test-rangeset.o
        $(CC) $^ -o $@ $(LDFLAGS)
+
+-include $(DEPS_INCLUDE)
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.