[PATCH 5/7] tests: generate proper dependencies for all tests
Benjamin Berg
benjamin at sipsolutions.net
Wed Jun 11 01:47:27 PDT 2025
From: Benjamin Berg <benjamin.berg at intel.com>
The object files were not getting any dependency information as they
were using BUILDOBJ directly. Move the rules into a separate include
file and also generate the proper dependency include so that the tests
are rebuild correctly.
This changes building of some tests slightly as their rules were using
$< instead of $^. However, it should not cause any harm.
Signed-off-by: Benjamin Berg <benjamin.berg at intel.com>
Reviewed-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
tests/Makefile | 54 ++++++++++++++++++++++++++------------------------
tests/test.mk | 6 ++++++
2 files changed, 34 insertions(+), 26 deletions(-)
create mode 100644 tests/test.mk
diff --git a/tests/Makefile b/tests/Makefile
index 8ec154bb3e..ea2fa843ff 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -46,41 +46,41 @@ LLIBS = -Wl,--start-group $(DLIBS) -Wl,--end-group $(SLIBS)
# glibc < 2.17 needs -lrt for clock_gettime()
LLIBS += -lrt
-test-aes: $(call BUILDOBJ,test-aes.o) $(LIBS)
- $(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS)
+TEST=test-aes
+include test.mk
-test-base64: $(call BUILDOBJ,test-base64.o) $(LIBS)
- $(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS)
+TEST=test-base64
+include test.mk
-test-https: $(call BUILDOBJ,test-https.o) $(LIBS)
- $(LDO) $(LDFLAGS) -o $@ $< $(LLIBS)
+TEST=test-https
+include test.mk
-test-https_server: $(call BUILDOBJ,test-https_server.o) $(LIBS)
- $(LDO) $(LDFLAGS) -o $@ $< $(LLIBS)
+TEST=test-https_server
+include test.mk
-test-list: $(call BUILDOBJ,test-list.o) $(LIBS)
- $(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS)
+TEST=test-list
+include test.mk
-test-md4: $(call BUILDOBJ,test-md4.o) $(LIBS)
- $(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS)
+TEST=test-md4
+include test.mk
-test-milenage: $(call BUILDOBJ,test-milenage.o) $(LIBS)
- $(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS)
+TEST=test-milenage
+include test.mk
-test-rc4: $(call BUILDOBJ,test-rc4.o) $(LIBS)
- $(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS)
+TEST=test-rc4
+include test.mk
-test-rsa-sig-ver: $(call BUILDOBJ,test-rsa-sig-ver.o) $(LIBS)
- $(LDO) $(LDFLAGS) -o $@ $< $(LLIBS)
+TEST=test-rsa-sig-ver
+include test.mk
-test-sha1: $(call BUILDOBJ,test-sha1.o) $(LIBS)
- $(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS)
+TEST=test-sha1
+include test.mk
-test-sha256: $(call BUILDOBJ,test-sha256.o) $(LIBS)
- $(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS)
+TEST=test-sha256
+include test.mk
-test-x509v3: $(call BUILDOBJ,test-x509v3.o) $(LIBS)
- $(LDO) $(LDFLAGS) -o $@ $< $(LLIBS)
+TEST=test-x509v3
+include test.mk
# We could cut this down more by enabling fewer options (above)
@@ -137,8 +137,10 @@ include ../src/objs.mk
LIBS=$(SLIBS) $(DLIBS) $(WPA_LIBS) $(ELIBS)
-test-bss: $(call BUILDOBJ,test-bss.o) $(WPA_OBJS) $(LIBS)
- $(LDO) $(LDFLAGS) -o $@ $< $(LLIBS) $(WPA_CFLAGS) $(WPA_OBJS) $(LIBS)
+TEST=test-bss
+CFLAGS_test-bss=$(WPA_CFLAGS)
+OBJS_test-bss=$(WPA_OBJS)
+include test.mk
run-tests: $(ALL)
./test-aes
diff --git a/tests/test.mk b/tests/test.mk
new file mode 100644
index 0000000000..9c3cc2cd8a
--- /dev/null
+++ b/tests/test.mk
@@ -0,0 +1,6 @@
+TEST_OBJ = $(TEST).o
+_OBJS_VAR := TEST_OBJ
+include ../src/objs.mk
+
+$(TEST): $(TEST_OBJ) $(OBJS_$(TEST)) $(LIBS)
+ $(LDO) $(LDFLAGS) -o $@ $^ $(LLIBS) $(CFLAGS_$(TEST))
--
2.49.0
More information about the Hostap
mailing list