From 7bde59183f40fe7540ab87a03429453b76e286c3 Mon Sep 17 00:00:00 2001 From: aqua Date: Tue, 27 Dec 2022 13:42:58 +0200 Subject: Add test and valgrind targets to rules.mk --- lib/Makefile | 8 ++------ rules.mk | 8 ++++++++ src/Makefile | 9 ++------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/lib/Makefile b/lib/Makefile index b82d773..9b34c20 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -4,11 +4,7 @@ libk.SRCS = stdio/printf.c stdio/fprintf.c stdio/vfprintf.cpp \ stdlib/memcpy.c stdlib/memset.c stdlib/linked_list_allocator.c \ string/itoa.c -include ../rules.mk +TESTS += tst/test_mem tst/test_string tst/test_linked_list_allocator -.PHONY: test valgrind -test: tst/test_mem tst/test_string tst/test_linked_list_allocator - $(foreach f,$^,./$f;) +include ../rules.mk -valgrind: tst/test_mem tst/test_string tst/test_linked_list_allocator - $(foreach f,$^,valgrind --leak-check=full ./$f;) diff --git a/rules.mk b/rules.mk index 14023da..eebc8b0 100644 --- a/rules.mk +++ b/rules.mk @@ -40,6 +40,14 @@ tst/test_%: tst/%.cc @echo ' CXX TEST $@' @$(TEST_CXX) $< -o $@ $(GTEST) $(GMOCK) +.PHONY: test valgrind +test: $(TESTS) + $(foreach f,$^,./$f;) + +valgrind: $(TESTS) + $(foreach f,$^,valgrind --leak-check=full ./$f;) + + # clean target .PHONY: clean FORCE clean: diff --git a/src/Makefile b/src/Makefile index df59f24..c3e4931 100644 --- a/src/Makefile +++ b/src/Makefile @@ -3,14 +3,9 @@ include ../Makefile.config kernel.SRCS := multiboot2.c mmap.c kernel.cpp mem/vmm.c kernel.OBJS := include conf.h -include ../rules.mk - -.PHONY: test valgrind -test: tst/test_taskqueue tst/test_roundrobin - $(foreach f,$^,./$f;) +TESTS += tst/test_taskqueue tst/test_roundrobin -valgrind: tst/test_taskqueue tst/test_roundrobin - $(foreach f,$^,valgrind --leak-check=full ./$f;) +include ../rules.mk conf.h: conf.h.in @echo ' GEN $@' -- cgit v1.2.1