mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-02 09:01:39 -05:00
tests: stylish test-runner.c
Fix a typo, add a comment, change the print format, and add a variable that will ease implementing tests that are expected to fail. Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
This commit is contained in:
parent
b1d4eb24c6
commit
56426d8a4a
1 changed files with 16 additions and 6 deletions
|
@ -89,7 +89,7 @@ int main(int argc, char *argv[])
|
||||||
if (argc == 2) {
|
if (argc == 2) {
|
||||||
t = find_test(argv[1]);
|
t = find_test(argv[1]);
|
||||||
if (t == NULL) {
|
if (t == NULL) {
|
||||||
fprintf(stderr, "uknown test: \"%s\"\n", argv[1]);
|
fprintf(stderr, "unknown test: \"%s\"\n", argv[1]);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,27 +98,37 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
pass = 0;
|
pass = 0;
|
||||||
for (t = &__start_test_section; t < &__stop_test_section; t++) {
|
for (t = &__start_test_section; t < &__stop_test_section; t++) {
|
||||||
|
int success = 0;
|
||||||
|
|
||||||
pid = fork();
|
pid = fork();
|
||||||
assert(pid >= 0);
|
assert(pid >= 0);
|
||||||
|
|
||||||
if (pid == 0)
|
if (pid == 0)
|
||||||
run_test(t);
|
run_test(t); /* never returns */
|
||||||
|
|
||||||
if (waitid(P_ALL, 0, &info, WEXITED)) {
|
if (waitid(P_ALL, 0, &info, WEXITED)) {
|
||||||
fprintf(stderr, "waitid failed: %m\n");
|
fprintf(stderr, "waitid failed: %m\n");
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "test \"%s\"... ", t->name);
|
fprintf(stderr, "test \"%s\":\t", t->name);
|
||||||
switch (info.si_code) {
|
switch (info.si_code) {
|
||||||
case CLD_EXITED:
|
case CLD_EXITED:
|
||||||
fprintf(stderr, "exit status %d\n", info.si_status);
|
fprintf(stderr, "exit status %d", info.si_status);
|
||||||
if (info.si_status == EXIT_SUCCESS)
|
if (info.si_status == EXIT_SUCCESS)
|
||||||
pass++;
|
success = 1;
|
||||||
break;
|
break;
|
||||||
case CLD_KILLED:
|
case CLD_KILLED:
|
||||||
case CLD_DUMPED:
|
case CLD_DUMPED:
|
||||||
fprintf(stderr, "signal %d\n", info.si_status);
|
fprintf(stderr, "signal %d", info.si_status);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (success) {
|
||||||
|
pass++;
|
||||||
|
fprintf(stderr, ", pass.\n");
|
||||||
|
} else
|
||||||
|
fprintf(stderr, ", fail.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
total = &__stop_test_section - &__start_test_section;
|
total = &__stop_test_section - &__start_test_section;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue