From: Benjamin Berg Date: Wed, 11 Jun 2025 08:47:27 +0000 (+0200) Subject: tests: Generate proper dependencies for all tests X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6b9ffc6a93362703782a769234b48f416383da9f;p=thirdparty%2Fhostap.git tests: Generate proper dependencies for all tests 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 Reviewed-by: Andrei Otcheretianski --- diff --git a/tests/Makefile b/tests/Makefile index 8ec154bb3..ea2fa843f 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 000000000..9c3cc2cd8 --- /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))