tests: implement a better integration test framework than shellspec

(for our usecase at least)
This commit is contained in:
Khaïs COLIN 2025-03-19 15:11:32 +01:00
parent 1f03cbbedb
commit 36c1b72eff
Signed by: logistic-bot
SSH key fingerprint: SHA256:RlpiqKeXpcPFZZ4y9Ou4xi2M8OhRJovIwDlbCaMsuAo
6 changed files with 148 additions and 75 deletions

View file

@ -82,7 +82,8 @@ minishell_objs = $(addsuffix .o,src/$(NAME)) $(objs)
all_objs = $(minishell_objs)
deps = $(all_objs:.o=.d)
.PHONY: all clean fclean re norm tests ctests ctestsa ctestsub ctestst alla allub allt
.PHONY: all clean fclean re norm tests ctests ctestsa ctestsub ctestst alla \
allub allt testsa testsub testst inttests inttestsa inttestsub inttestst
all: $(NAME)
@ -116,24 +117,48 @@ norm:
norminette src libft | grep -v OK || true
tests:
@echo "Running tests with AddressSanitizer..."
+CFLAGS="$(CFLAGS) $(ASAN)" make re
shellspec
+make ctestsa
@echo "Running tests with UndefinedBehaviourSanitizer..."
+CFLAGS="$(CFLAGS) $(UBSAN)" make re
shellspec
+make ctestsub
@echo "Running tests with ThreadSanitizer..."
+CFLAGS="$(CFLAGS) $(TSAN)" make re
shellspec
+make ctestst
+make fclean
+make testsa
+make fclean
+make testsub
+make fclean
+make testst
@echo "All tests passed!"
ctests: $(LIBFT)
testsa: CFLAGS += $(ASAN)
testsa:
@echo "Running tests with AddressSanitizer..."
+make inttests
+make ctests
testsub: CFLAGS += $(UBSAN)
testsub: all
@echo "Running tests with UndefinedBehaviourSanitizer..."
+make inttests
+make ctests
testst: CFLAGS += $(TSAN)
testst: all
@echo "Running tests with ThreadSanitizer..."
+make inttests
+make ctests
inttests: all
./test.sh
inttestsa: CFLAGS += $(ASAN)
inttestsa: all
./test.sh
inttestsub: CFLAGS += $(UBSAN)
inttestsub: all
./test.sh
inttestst: CFLAGS += $(TSAN)
inttestst: all
./test.sh
ctests: $(LIBFT) all
+make -C tests
ctestsa: CFLAGS += $(ASAN)