diff options
author | Florian Weimer <fweimer@redhat.com> | 2018-11-28 19:59:45 +0100 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2018-11-28 20:57:18 +0100 |
commit | 96cd0558bcd69481ccc42e1b392f0c0b36fce2b0 (patch) | |
tree | 9318349a9edfb5c5e6314c9bb560ff909511bbfc /support/tst-support_capture_subprocess.c | |
parent | 530504e3a825a63ad4976f24cd50aa9b15d3b91e (diff) | |
download | glibc-96cd0558bcd69481ccc42e1b392f0c0b36fce2b0.tar.gz glibc-96cd0558bcd69481ccc42e1b392f0c0b36fce2b0.tar.xz glibc-96cd0558bcd69481ccc42e1b392f0c0b36fce2b0.zip |
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.
Diffstat (limited to 'support/tst-support_capture_subprocess.c')
-rw-r--r-- | support/tst-support_capture_subprocess.c | 14 |
1 files changed, 14 insertions, 0 deletions
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); |