valgrind tests

This commit is contained in:
Timo Schmidt 2023-04-01 16:35:32 +02:00
parent 1f049159f5
commit 9f4413439d
1 changed files with 15 additions and 5 deletions

View File

@ -1,10 +1,12 @@
SRC = main.c \
ft_lib.c \
ft_io.c
ft_io.c \
argparse.c
HEADERS = main.h \
ft_lib.h \
ft_io.h \
colors.h
colors.h \
argparse.h
OBJDIR = obj
INCDIR = include
@ -47,7 +49,7 @@ $(NAME): $(OBJ)
$(OBJ): | $(OBJDIR)
$(OBJDIR)/%.o: %.c $(DEPS)
@#norminette $< >/dev/null || { printf '\033[107;41m%s\033[m\n' "!Norminette Failed>>>"; norminette $<; printf '\033[107;41m%s\033[m\n' "<<<Norminette Failed!"; exit 1; }
@#norminette $< >/dev/null || { printf '\033[102;97m%s\033[m\n' "!Norminette Failed>>>"; norminette $<; printf '\033[101;97m%s\033[m\n' "<<<Norminette Failed!"; exit 1; }
@$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR):
@ -57,10 +59,14 @@ tests: test
test: re run fclean
SUCCESS_MSG=printf '\n\033[32m --- %s --- \033[m\n\n' "Test passed!"
FAIL_MSG=printf '\n\033[31m --- %s --- \033[m\n\n' "Test failed!"
SUCCESS_MSG=printf '\n\033[102;30m --- %s --- \033[m\n\n' "Test passed!"
FAIL_MSG=printf '\n\033[101;30m --- %s --- \033[m\n\n' "Test failed!"
SUCCESS_MSG_VALG=printf '\n\033[102;97m --- %s --- \033[m\n\n' "Valgrind ran without errors!"
FAIL_MSG_VALG=printf '\n\033[101;97m --- %s --- \033[m\n\n' "Valgrind Failed!"
SUCCESS=&& $(SUCCESS_MSG) || $(FAIL_MSG)
SUCCESS_VALG=&& $(SUCCESS_MSG_VALG) || $(FAIL_MSG_VALG)
FAIL=&& $(FAIL_MSG) || $(SUCCESS_MSG)
VALGRIND=valgrind --leak-check=full --error-exitcode=1
run:
@clear
./$(NAME) $(SUCCESS)
@ -69,3 +75,7 @@ run:
./$(NAME) 1 "./dicts/numbers2.dict" $(FAIL)
./$(NAME) 1 "./dicts/numb.dict" $(FAIL)
./$(NAME) 1 2 3 $(FAIL)
valgrind:
$(VALGRIND) ./$(NAME) 1 $(SUCCESS_VALG)
$(VALGRIND) ./$(NAME) "./dicts/numbers2.dict" 1 $(SUCCESS_VALG)