From 97ab23ecdf372a0f8eca0471e11d37b089f92b8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorben=20H=C3=B6hne?= Date: Thu, 26 Jun 2025 01:10:32 +0200 Subject: [PATCH] fix: Valgrind doesn't work with static linking. --- Makefile | 41 ----------------------------------------- src/set.c | 2 +- src/utils.c | 1 + testtest.c | 2 +- 4 files changed, 3 insertions(+), 43 deletions(-) delete mode 100644 Makefile diff --git a/Makefile b/Makefile deleted file mode 100644 index d1d26c4..0000000 --- a/Makefile +++ /dev/null @@ -1,41 +0,0 @@ -ifndef verbose - SILENT = @ -endif - -CC := gcc -AR := ar -CFLAGS := -I include/ - -ifeq ($(colorized), y) -CFLAGS += -D COLORIZED -endif - -ifeq ($(no_banner), y) -CFLAGS += -D NO_BANNER -endif - -ifeq ($(testing), y) -CFLAGS += -g2 -O0 -else -CFLAGS += -O2 -endif - -all: create_output_dir libset.a - -clean: - $(SILENT) rm -rf int/ - $(SILENT) rm -f libset.a - -create_output_dir: - $(SILENT) mkdir -p int/ - -libset.a: $(patsubst src/%.c, int/%.o, $(wildcard src/*.c)) - @echo "Archiving $^ to $@" - $(SILENT) $(AR) rcs $@ int/**.o - -# Recipe -int/%.o: src/%.c - @echo "Building $< => $@" - $(SILENT) $(CC) $(CFLAGS) -c $< -o $@ - -.PHONY: all clean test create_output_dir diff --git a/src/set.c b/src/set.c index 50e9529..7d941ca 100644 --- a/src/set.c +++ b/src/set.c @@ -86,7 +86,7 @@ static void dispatch_single_test(struct SETest *test) { test->function(test); log_test_summary(test); - // set_free_all(); + set_free_all(); exit(0); } } diff --git a/src/utils.c b/src/utils.c index 71b37a2..1a693a5 100644 --- a/src/utils.c +++ b/src/utils.c @@ -54,6 +54,7 @@ void *set_malloc(size_t n) if (block_meta_head == NULL) { meta->end = meta; + block_meta_head = meta; } else { diff --git a/testtest.c b/testtest.c index c298d8a..3d875c8 100644 --- a/testtest.c +++ b/testtest.c @@ -73,7 +73,7 @@ TEST(Other_With_Malloc) } fprintf(stdout, ".\n"); - ASSERT_TRUE(true); + ASSERT_TRUE(false); } SUIT_ST(Other, Basic_Setup, EMPTY)