diff options
author | Ekaitz Zarraga <ekaitz@elenq.tech> | 2025-08-16 21:55:36 +0200 |
---|---|---|
committer | Ekaitz Zarraga <ekaitz@elenq.tech> | 2025-08-16 21:55:36 +0200 |
commit | 9f3874d4549b648f54fb1274cd7ff4505491e6db (patch) | |
tree | 824c9061f8e2a138c57e934745cc748b9d240af2 /Makefile | |
parent | f9611cba7ded5c10419cd92a512e57044340f5e8 (diff) |
Makefile: Add logs for tests and move to assert
This provides a better log system that more clearly states what went
wrong in the test files.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -33,7 +33,14 @@ clean: $(TEST_FILES): $(TARGET) $(TEST_SOURCES) $(HEADERS) @printf "Running %-40s%s " '`$@`' @$(CC) $(CFLAGS) -o $@ $(addsuffix .c, $@) $(OBJ) - @if ./$@ ; then printf "PASS\n";else printf "FAIL: exit value: %d\n" $$?; fi + @result=$$(./$@ 2>&1); \ + ret=$$?; \ + printf "Exit value: %s\n%s" "$$ret" "$$result" >$@.log; \ + if test $$ret -eq 0 ; then \ + printf "\e[0;32mPASS\e[0m\n";\ + else\ + printf "\e[0;31mFAIL\e[0m\n";\ + fi check: test test: $(TEST_FILES) |