2021-10-23 22:29:53

This commit is contained in:
marvin
2021-10-23 22:29:53 +02:00
parent 161279c3f5
commit e02dc43f7b
2 changed files with 43 additions and 29 deletions

View File

@@ -6,7 +6,7 @@
# By: <gbaconni@student.42lausanne.ch> +#+ +:+ +#+ # # By: <gbaconni@student.42lausanne.ch> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ # # +#+#+#+#+#+ +#+ #
# Created: 2021/10/22 09:10:00 by gbaconni #+# #+# # # Created: 2021/10/22 09:10:00 by gbaconni #+# #+# #
# Updated: 2021/10/23 16:40:01 by gbaconni ### lausanne.ch # # Updated: 2021/10/23 22:24:08 by gbaconni ### lausanne.ch #
# # # #
# **************************************************************************** # # **************************************************************************** #
# #
@@ -20,16 +20,15 @@
OUT = munit.out OUT = munit.out
LIBDIR = libft LIBRARY = libft
LIB = ft LIBS = -lft
HDRDIR = munit INCLUDE = munit
HDR = $(HDRDIR)/munit.h HDR = munit.h
SRCDIR = .
SRC = \ SRC = \
$(SRCDIR)/munit.c \ munit.c \
$(HDRDIR)/munit.c $(INCLUDE)/munit.c
CC = gcc CC = gcc
CFLAGS = -Wall -Wextra -Werror CFLAGS = -Wall -Wextra -Werror
@@ -57,51 +56,65 @@ help:
@echo "a: nemequ/µnit" @echo "a: nemequ/µnit"
@echo "b: Tripouille/libftTester" @echo "b: Tripouille/libftTester"
@echo "c: jtoty/Libftest" @echo "c: jtoty/Libftest"
@echo "d: alelievr/libft-unit-test" @echo "d: alelievr/libft-unit-test (tests)"
@echo "test: a b c d" @echo "e: alelievr/libft-unit-test (bench)"
@echo "test: a b c d e"
@echo "update: git pull" @echo "update: git pull"
a: update compile _munit:
@./$(OUT) || true @./$(OUT) || true
a: update compile _munit
@echo "" @echo ""
@echo "Summary:" @echo "Summary:"
@./$(OUT) 2>&1 | grep -i -e 'error' -e 'tests successful'|| true @./$(OUT) 2>&1 | grep -i -e 'error' -e 'tests successful'|| true
b: compile _libftTester:
@grep -q 'update message' libftTester/Makefile && sed -i'.orig' -e 's/update \(message\)/\1/g' libftTester/Makefile || true @grep -q 'update message' libftTester/Makefile && sed -i'.orig' -e 's/update \(message\)/\1/g' libftTester/Makefile || true
@grep -q '/libft$$' libftTester/Makefile || sed -i'.orig' -e 's/^\(PARENT_DIR.*\)/\1\/libft/' libftTester/Makefile || true @grep -q '/libft$$' libftTester/Makefile || sed -i'.orig' -e 's/^\(PARENT_DIR.*\)/\1\/libft/' libftTester/Makefile || true
b: compile _libftTester
@make -C libftTester m || true @make -C libftTester m || true
@make -C libftTester b || true @make -C libftTester b || true
c: compile _Libftest:
@test -f Libftest/my_config.sh || (cd Libftest && ./grademe.sh >/dev/null 2>&1) || true @test -f Libftest/my_config.sh || (cd Libftest && ./grademe.sh >/dev/null 2>&1) || true
@grep -q '^PATH_LIBFT=\.\./libft' Libftest/my_config.sh || sed -i'.orig' -e 's/^\(PATH_LIBFT\)=.*/\1=..\/libft/' Libftest/my_config.sh || true @grep -q '^PATH_LIBFT=\.\./libft' Libftest/my_config.sh || sed -i'.orig' -e 's/^\(PATH_LIBFT\)=.*/\1=..\/libft/' Libftest/my_config.sh || true
@grep -q "'ft_memccpy'" Libftest/srcs/variables/functions/part_1.sh && sed -i'.orig' -e "/'ft_memccpy'/d" Libftest/srcs/variables/functions/part_1.sh || true @grep -q "'ft_memccpy'" Libftest/srcs/variables/functions/part_1.sh && sed -i'.orig' -e "/'ft_memccpy'/d" Libftest/srcs/variables/functions/part_1.sh || true
@rm -fr Libftest/tests/Part1_functions/ft_memccpy || true @rm -fr Libftest/tests/Part1_functions/ft_memccpy || true
@cd Libftest && ./grademe.sh || true
d: compile c: compile _Libftest
@make -C libft-unit-test all || true @cd Libftest && ./grademe.sh -u || true
@cd libft-unit-test && ./run_test || true
_libft-unit-test:
@grep -q 'ft_memccpy' libft-unit-test/src/init.c && sed -i'.orig' -e '/ft_memccpy/d' libft-unit-test/src/init.c || true
@grep -q 'ft_memccpy' libft-unit-test/hardcore-mode/hardcore-main.c && sed -i'.orig' -e '/ft_memccpy/d' libft-unit-test/hardcore-mode/hardcore-main.c || true
@grep -q 'test-memccpy' libft-unit-test/Makefile && sed -i'.orig' -e '/test-memccpy/d' libft-unit-test/Makefile || true
@rm -f libft-unit-test/hardcore-mode/test-memccpy.c || true
d: compile _libft-unit-test
@make -C libft-unit-test f || true
e: compile _libft-unit-test
@make -C libft-unit-test b || true
test: a b c d test: a b c d
@echo "done."
update: update:
@git pull @git pull
compile: compile:
@make -C $(LIBDIR) all @make -C $(LIBRARY) all
@$(CC) $(CFLAGS) $(SRC) -I${LIBDIR} -I$(HDRDIR) -L${LIBDIR} -l${LIB} -o $(OUT) @$(CC) $(CFLAGS) $(SRC) -I${LIBRARY} -I$(INCLUDE) -L${LIBRARY} ${LIBS} -o $(OUT)
clean: clean:
@make -C $(LIBDIR) clean @make -C $(LIBRARY) clean
@$(RM) $(RMFLAGS) $(OUT) @$(RM) $(RMFLAGS) $(OUT)
fclean: clean fclean: clean
@make -C libftTester clean || true @make -C libftTester clean || true
@make -C libft-unit-test clean || true @make -C libft-unit-test clean || true
@make -C $(LIBDIR) fclean @make -C $(LIBRARY) fclean
@$(RM) $(RMFLAGS) $(OUT) @$(RM) $(RMFLAGS) $(OUT)
re: fclean all re: fclean all

View File

@@ -35,20 +35,20 @@ cd 42test/libft
# Display various options # Display various options
make help make help
# Tripouille/libftTester (Very Good) # Tripouille/libftTester (straight to the point)
make b make b
# jtoty/Libftest (Also Nice) # jtoty/Libftest (cool layout)
make c make c
# nemequ/µnit w/ my own Unit Testing (Alpha software not working well) # nemequ/µnit w/ my own Unit Testing (beta software not complete)
make a make a
# work on MacOS X # works on MacOS X (and Linux if libbsd-dev installed and so: in libft/Makefile)
# alelievr/libft-unit-test (Not sure that is a good idea to use it) # alelievr/libft-unit-test (mind the protect == NULL)
make d make d
# launch a b c d (All you can eat) # launch a b c d e (All you can eat)
make test make test
``` ```
@@ -57,7 +57,8 @@ make test
- a: [nemequ/µnit](https://nemequ.github.io/munit/) - a: [nemequ/µnit](https://nemequ.github.io/munit/)
- b: [Tripouille/libftTester](https://github.com/Tripouille/libftTester) - b: [Tripouille/libftTester](https://github.com/Tripouille/libftTester)
- c: [jtoty/Libftest](https://github.com/jtoty/Libftest) - c: [jtoty/Libftest](https://github.com/jtoty/Libftest)
- d: [alelievr/libft-unit-test](https://github.com/alelievr/libft-unit-test) - d: [alelievr/libft-unit-test (tests)](https://github.com/alelievr/libft-unit-test)
- e: [alelievr/libft-unit-test (bench)](https://github.com/alelievr/libft-unit-test)
Create subprojects Create subprojects
``` ```