From 1befa196c44d5e6425cb6415ba72b133ecf11412 Mon Sep 17 00:00:00 2001 From: Nathan Fisher Date: Wed, 17 Apr 2024 16:06:42 -0400 Subject: [PATCH] Update test runner --- test/Makefile | 5 +++-- test/runner.c | 36 ++++++++++++++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/test/Makefile b/test/Makefile index 9edb43b..fa72ddc 100644 --- a/test/Makefile +++ b/test/Makefile @@ -78,8 +78,6 @@ tests += extract_file_node tests += extract_symlink_node tests += extract_hardlink_node -total != echo $(tests) | wc -w | awk '{ print $$1 }' - .PHONY: test test: $(tests) runner output ./runner $(tests) @@ -87,6 +85,9 @@ test: $(tests) runner output output: @ [-d $@ ] 2>/dev/null || install -d $@ +runner: runner.c + $(CC) -o runner runner.c + .PHONY: clean clean: rm -rf $(tests) runner output/* diff --git a/test/runner.c b/test/runner.c index e12b11c..47d09ba 100644 --- a/test/runner.c +++ b/test/runner.c @@ -1,3 +1,35 @@ +/* _,.---._ .-._ .--.-. ,--.--------. + * _,..---._ ,-.' , - `. /==/ \ .-._/==/ //==/, - , -\ + * /==/, - \ /==/_, , - \|==|, \/ /, |==\ -\\==\.-. - ,-./ + * |==| _ _\==| .=. |==|- \| | \==\- \`--`\==\- \ + * |==| .=. |==|_ : ;=: - |==| , | -| `--`-' \==\_ \ + * |==|,| | -|==| , '=' |==| - _ | |==|- | + * |==| '=' /\==\ - ,_ /|==| /\ , | |==|, | + * |==|-, _`/ '.='. - .' /==/, | |- | /==/ -/ + * `-.`.____.' `--`--'' `--`./ `--` `--`--` + * _ __ ,---. .-._ .=-.-. _,.----. + * .-`.' ,`..--.' \ /==/ \ .-._ /==/_ /.' .' - \ + * /==/, - \==\-/\ \ |==|, \/ /, /==|, |/==/ , ,-' + * |==| _ .=. /==/-|_\ | |==|- \| ||==| ||==|- | . + * |==| , '=',\==\, - \ |==| , | -||==|- ||==|_ `-' \ + * |==|- '..'/==/ - ,| |==| - _ ||==| ,||==| _ , | + * |==|, | /==/- /\ - \|==| /\ , ||==|- |\==\. / + * /==/ - | \==\ _.\=\.-'/==/, | |- |/==/. / `-.`.___.-' + * `--`---' `--` `--`./ `--``--`-` + * + * @(#)Copyright (c) 2024, Nathan D. Fisher. + * + * This is free software. It comes with NO WARRANTY. + * Permission to use, modify and distribute this source code + * is granted subject to the following conditions. + * 1/ that the above copyright notice and this notice + * are preserved in all copies and that due credit be given + * to the author. + * 2/ that any changes to this code are clearly commented + * as such so that the author does not get blamed for bugs + * other than his own. + */ + #include #include @@ -10,7 +42,7 @@ int main(int argc, char *argv[]) { printf("\n\t=== \033[0;33mRunning %i tests\033[0m ===\n\n", total); for (i = 1; i < argc; i++) { snprintf(cmd, 100, "./%s", argv[i]); - printf("%-25s", argv[i]); + printf("\033[0;2m[\033[0m%03i\033[0;2m/\033[0m%03i\033[0;2m]\033[0m %-25s", i, total, argv[i]); pipe = popen(cmd, "w"); read = fread(&output, 1, 500, pipe); ret = pclose(pipe); @@ -41,5 +73,5 @@ int main(int argc, char *argv[]) { printf("\nResults: \033[0;32mOk\033[0m %i succeeded; %i failed; %i skipped\n\n", pass, fail, skip); } - return 0; + return fail; }