Skip to content

Commit

Permalink
Threads and sanitizers are broken on kernel >=v6.6.
Browse files Browse the repository at this point in the history
  • Loading branch information
gitrj95 committed Mar 16, 2024
1 parent 412c285 commit 8357572
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion test.h
Expand Up @@ -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)
Expand Down
15 changes: 7 additions & 8 deletions test/Makefile
Expand Up @@ -8,20 +8,19 @@ 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
check: test_arena test_msi

test_arena: arena
@$(DELIM)
@./arena
@$(DELIM)

arena: arena.c .force
$(CC) -o $@ $(CFLAGS) $(ASAN) $(UBSAN) $< $(LDFLAGS)
$(CC) -o $@ $(CFLAGS) $(ASAN) $(UBSAN) $<

test_spinlock: spinlock_tsan spinlock_asan
test_spinlock: spinlock_asan
@$(DELIM)
@echo "[Under TSan]"
@./spinlock_tsan
Expand All @@ -30,15 +29,15 @@ test_spinlock: spinlock_tsan spinlock_asan
@$(DELIM)

spinlock_tsan: spinlock.c .force
$(CC) -o $@ $(CFLAGS) $(TSAN) $< $(LDFLAGS) -lpthread
$(CC) -o $@ $(CFLAGS) $(TSAN) $< -lpthread

spinlock_asan: spinlock.c .force
$(CC) -o $@ $(CFLAGS) $(ASAN) $(UBSAN) $< $(LDFLAGS) -lpthread
$(CC) -o $@ $(CFLAGS) $(ASAN) $(UBSAN) $< -lpthread

test_msi: msi
@$(DELIM)
@./msi
@$(DELIM)

msi: msi.c .force
$(CC) -o $@ $(CFLAGS) $(ASAN) $(UBSAN) $< $(LDFLAGS)
$(CC) -o $@ $(CFLAGS) $(ASAN) $(UBSAN) $<

0 comments on commit 8357572

Please sign in to comment.