Update test runner

This commit is contained in:
Nathan Fisher 2024-04-17 16:06:42 -04:00
parent 2ae513e228
commit 1befa196c4
2 changed files with 37 additions and 4 deletions

View file

@ -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/*

View file

@ -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 <stdio.h>
#include <stdlib.h>
@ -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;
}