Avanzando en un Makefile que ejecuta tests comparando salidas, y genera un report final
This commit is contained in:
parent
7f3ea7936f
commit
59382ff4c3
1 changed files with 44 additions and 13 deletions
57
Makefile
57
Makefile
|
|
@ -10,14 +10,42 @@
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
#LIBDIR = ../repo_libft_algarra
|
LIBDIR = ../repo_libft_algarra
|
||||||
LIBDIR = ../repo_algarra
|
#LIBDIR = ../repo_algarra
|
||||||
#CFLAGS += -Wall -Wextra -Werror -g3 -fsanitize=address
|
#CFLAGS += -Wall -Wextra -Werror -g3 -fsanitize=address
|
||||||
CFLAGS += -Wall -Wextra -Werror -g3 -iquote $(LIBDIR) -L$(LIBDIR) -lft
|
CFLAGS += -Wall -Wextra -Werror -g3 -iquote $(LIBDIR) -L$(LIBDIR) -lft
|
||||||
|
|
||||||
TESTS:= isalpha_test isdigit_test isalnum_test isascii_test
|
TESTS:= isalpha_test isdigit_test isalnum_test isascii_test
|
||||||
|
|
||||||
all: $(TESTS)
|
%_actual.output : %_test
|
||||||
|
./$*_test > ./$*_actual.output ;
|
||||||
|
|
||||||
|
#%_report : %_test %_actual.output
|
||||||
|
# $(shell diff -a $*_expected.output $*_actual.output > $*_report )
|
||||||
|
|
||||||
|
%_report : %_test %_actual.output
|
||||||
|
-(diff -a $*_expected.output $*_actual.output && echo "Test OK") > $*_report
|
||||||
|
|
||||||
|
EXES = $(TESTS)
|
||||||
|
|
||||||
|
ACT_OUTPUTS = $(TESTS:_test=_actual.output)
|
||||||
|
|
||||||
|
ACT_REPORTS = $(TESTS:_test=_report)
|
||||||
|
|
||||||
|
.SECONDARY = $(ACT_REPORTS) $(ACT_OUTPUTS)
|
||||||
|
|
||||||
|
report : $(EXES) $(ACT_OUTPUTS) $(ACT_REPORTS)
|
||||||
|
rm -f report ;
|
||||||
|
$(foreach E, $(TESTS), \
|
||||||
|
$(eval T = $(subst _test,,$(E))) \
|
||||||
|
$(eval R = $(subst _test,_report,$(E))) \
|
||||||
|
echo "=== $(T) ===" >> report ; \
|
||||||
|
cat $(R) >> report ; \
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#all: $(TESTS)
|
||||||
|
|
||||||
#build_output: all
|
#build_output: all
|
||||||
# $(foreach E, $(TESTS), \
|
# $(foreach E, $(TESTS), \
|
||||||
|
|
@ -36,11 +64,14 @@ all: $(TESTS)
|
||||||
# echo "$(E) $(.SHELLSTATUS) - $(R) \n" \
|
# echo "$(E) $(.SHELLSTATUS) - $(R) \n" \
|
||||||
# )
|
# )
|
||||||
#
|
#
|
||||||
|
|
||||||
fclean:
|
fclean:
|
||||||
$(foreach E, $(TESTS), \
|
$(foreach E, $(TESTS), \
|
||||||
$(eval A = $(subst _test,_actual.output,$(E))) \
|
$(eval A = $(subst _test,_actual.output,$(E))) \
|
||||||
rm -f $(E) $(A); \
|
$(eval R = $(subst _test,_report,$(E))) \
|
||||||
|
rm -f $(E) $(A) $(R) \
|
||||||
)
|
)
|
||||||
|
rm -f report
|
||||||
|
|
||||||
#runmal:
|
#runmal:
|
||||||
# $(foreach E, $(TESTS), \
|
# $(foreach E, $(TESTS), \
|
||||||
|
|
@ -52,13 +83,13 @@ fclean:
|
||||||
#
|
#
|
||||||
##foo: TESTS
|
##foo: TESTS
|
||||||
|
|
||||||
%_actual.output : %_test
|
#%_actual.output : %_test
|
||||||
./$*_test > ./$*_actual.output
|
# ./$*_test > ./$*_actual.output
|
||||||
echo ha intentado generar actual
|
# echo ha intentado generar actual
|
||||||
|
#
|
||||||
run_%: %_actual.output
|
#run_%: %_actual.output
|
||||||
$(shell diff -a $*_expected.output $*_actual.output )
|
# $(shell diff -a $*_expected.output $*_actual.output )
|
||||||
$(info $(.SHELLSTATUS))
|
# $(info $(.SHELLSTATUS))
|
||||||
$(let R , $(intcmp 0, $(.SHELLSTATUS), ok, nok), $(info $(R)))
|
# $(let R , $(intcmp 0, $(.SHELLSTATUS), ok, nok), $(info $(R)))
|
||||||
|
#
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue