From 96cd0558bcd69481ccc42e1b392f0c0b36fce2b0 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Wed, 28 Nov 2018 19:59:45 +0100 Subject: support: Add signal support to support_capture_subprocess_check Signal zero does not terminate a process, so it is safe to use negative values for signal numbers. Adjust libio/tst-vtables-common.c to use this new functionality, instead of determining the termination status for a signal indirectly. --- support/tst-support_capture_subprocess.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'support/tst-support_capture_subprocess.c') diff --git a/support/tst-support_capture_subprocess.c b/support/tst-support_capture_subprocess.c index a685256091..5339e85b07 100644 --- a/support/tst-support_capture_subprocess.c +++ b/support/tst-support_capture_subprocess.c @@ -168,15 +168,29 @@ do_test (void) = support_capture_subprocess (callback, &test); check_stream ("stdout", &result.out, test.out); check_stream ("stderr", &result.err, test.err); + + /* Allowed output for support_capture_subprocess_check. */ + int check_allow = 0; + if (lengths[length_idx_stdout] > 0) + check_allow |= sc_allow_stdout; + if (lengths[length_idx_stderr] > 0) + check_allow |= sc_allow_stderr; + if (check_allow == 0) + check_allow = sc_allow_none; + if (test.signal != 0) { TEST_VERIFY (WIFSIGNALED (result.status)); TEST_VERIFY (WTERMSIG (result.status) == test.signal); + support_capture_subprocess_check (&result, "signal", + -SIGTERM, check_allow); } else { TEST_VERIFY (WIFEXITED (result.status)); TEST_VERIFY (WEXITSTATUS (result.status) == test.status); + support_capture_subprocess_check (&result, "exit", + test.status, check_allow); } support_capture_subprocess_free (&result); free (test.out); -- cgit v1.2.3