pwtest: if a test expects a signal, skip it under valgrind

Running under valgrind enforces --no-fork so any signal will cause valgrind
to error out, failing the test abnormally. This prevents us from running
our test suite through valgrind, we'd have to mark every test specifically
whether it should run under valgrind or not.

Easier is just to automatically skip tests expecting signals.
This commit is contained in:
Peter Hutterer 2021-07-07 12:18:52 +10:00 committed by Wim Taymans
parent 6600d93d5d
commit 5ebfbccd16

View file

@ -412,6 +412,7 @@ void _pwtest_add(struct pwtest_context *ctx, struct pwtest_suite *suite,
return;
t = calloc(1, sizeof *t);
t->result = PWTEST_SYSTEM_ERROR;
t->name = funcname;
t->func = func;
t->args.range.min = 0;
@ -432,6 +433,8 @@ void _pwtest_add(struct pwtest_context *ctx, struct pwtest_suite *suite,
case PWTEST_NOARG:
break;
case PWTEST_ARG_SIGNAL:
if (RUNNING_ON_VALGRIND)
t->result = PWTEST_SKIP;
t->args.signal = va_arg(args, int);
break;
case PWTEST_ARG_RANGE:
@ -908,6 +911,12 @@ static void run_test(struct pwtest_context *ctx, struct pwtest_suite *c, struct
int read_fds[_FD_LAST], write_fds[_FD_LAST];
int r;
if (t->result == PWTEST_SKIP) {
char *buf = pw_array_add(&t->logs[FD_LOG], 64);
spa_scnprintf(buf, 64, "pwtest: test skipped by pwtest\n");
return;
}
t->result = PWTEST_SYSTEM_ERROR;
r = init_pipes(read_fds, write_fds);