tests Makefile: add rules to run C tests iwth specific sanitizer

This commit is contained in:
Khaïs COLIN 2025-02-14 13:32:21 +01:00
parent c7a86eecfd
commit a6ce45ca87
Signed by: logistic-bot
SSH key fingerprint: SHA256:RlpiqKeXpcPFZZ4y9Ou4xi2M8OhRJovIwDlbCaMsuAo

View file

@ -25,7 +25,7 @@ minishell_objs = $(addsuffix .o,src/$(NAME)) $(objs)
all_objs = $(minishell_objs)
deps = $(all_objs:.o=.d)
.PHONY: all clean fclean re norm tests ctests
.PHONY: all clean fclean re norm tests ctests ctestsa ctestsub ctestst
all: $(NAME)
@ -62,19 +62,26 @@ tests:
@echo "Running tests with AddressSanitizer..."
+CFLAGS="$(CFLAGS) $(ASAN)" make re
shellspec
+CFLAGS="$(CFLAGS) $(ASAN)" make ctests
+make ctestsa
@echo "Running tests with UndefinedBehaviourSanitizer..."
+CFLAGS="$(CFLAGS) $(UBSAN)" make re
shellspec
+CFLAGS="$(CFLAGS) $(UBTSAN)" make ctests
+make ctestsub
@echo "Running tests with ThreadSanitizer..."
+CFLAGS="$(CFLAGS) $(TSAN)" make re
shellspec
+CFLAGS="$(CFLAGS) $(TSAN)" make ctests
+make ctestst
@echo "All tests passed!"
ctests: $(LIBFT)
+make -C tests
ctestsa: CFLAGS += $(ASAN)
ctestsa: ctests
ctestsub: CFLAGS += $(UBSAN)
ctestsub: ctests
ctestst: CFLAGS += $(TSAN)
ctestst: ctests