aboutsummaryrefslogtreecommitdiff
path: root/support/tst-support_capture_subprocess.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2018-11-28 19:59:45 +0100
committerFlorian Weimer <fweimer@redhat.com>2018-11-28 20:57:18 +0100
commit96cd0558bcd69481ccc42e1b392f0c0b36fce2b0 (patch)
tree9318349a9edfb5c5e6314c9bb560ff909511bbfc /support/tst-support_capture_subprocess.c
parent530504e3a825a63ad4976f24cd50aa9b15d3b91e (diff)
downloadglibc-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.c14
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);