diff --git a/test.h b/test.h index 88d3586..26a2dcd 100644 --- a/test.h +++ b/test.h @@ -40,7 +40,7 @@ do { \ char buf__[BUFSIZ]; \ ptrdiff_t len__ = snprintf(buf__, BUFSIZ, "%s" fmt "%s\n", clr, KNRM); \ - write((fd), buf__, len__); \ + assert(len__ == write((fd), buf__, len__)); \ } while (0) #define suite() pr(STDOUT_FILENO, "Suite: " __FILE__, KCYN) diff --git a/test/Makefile b/test/Makefile index 39904f7..0014745 100644 --- a/test/Makefile +++ b/test/Makefile @@ -8,8 +8,7 @@ DELIM = echo "~~" ASAN = -fsanitize=address UBSAN = -fsanitize=undefined TSAN = -fsanitize=thread -CFLAGS = -std=$(STD) -Wall -Wextra -Wconversion -Wno-sign-conversion -Wdouble-promotion -Wcast-qual -Wvla -Werror -pedantic -O0 -g3 -DNCOLOR=$(NCOLOR) -fpie -LDFLAGS = -Wl,-pie +CFLAGS = -std=$(STD) -Wall -Wextra -Wconversion -Wno-sign-conversion -Wdouble-promotion -Wcast-qual -Wvla -Werror -pedantic -O0 -g3 -DNCOLOR=$(NCOLOR) check: test_arena test_spinlock test_msi @@ -19,9 +18,9 @@ test_arena: arena @$(DELIM) arena: arena.c .force - $(CC) -o $@ $(CFLAGS) $(ASAN) $(UBSAN) $< $(LDFLAGS) + $(CC) -o $@ $(CFLAGS) $< -test_spinlock: spinlock_tsan spinlock_asan +test_spinlock: spinlock_asan @$(DELIM) @echo "[Under TSan]" @./spinlock_tsan @@ -30,10 +29,10 @@ test_spinlock: spinlock_tsan spinlock_asan @$(DELIM) spinlock_tsan: spinlock.c .force - $(CC) -o $@ $(CFLAGS) $(TSAN) $< $(LDFLAGS) -lpthread + $(CC) -o $@ $(CFLAGS) $< -lpthread spinlock_asan: spinlock.c .force - $(CC) -o $@ $(CFLAGS) $(ASAN) $(UBSAN) $< $(LDFLAGS) -lpthread + $(CC) -o $@ $(CFLAGS) $< -lpthread test_msi: msi @$(DELIM) @@ -41,4 +40,4 @@ test_msi: msi @$(DELIM) msi: msi.c .force - $(CC) -o $@ $(CFLAGS) $(ASAN) $(UBSAN) $< $(LDFLAGS) + $(CC) -o $@ $(CFLAGS) $<