Testcase for BZ 28519
Joe Simmons-Talbott
joetalbott@gmail.com
Mon Mar 20 18:10:21 GMT 2023
Hi,
I'm trying to write a testcase for BZ 28519 but not having much luck.
My testcase is below. For a simple application that calls
'system("-echo")' I get the same behavior as the BZ but for the testcase
I get the expected behavior where sh fails to find "-echo".
Does anyone have any thought on what I might be missing?
Thanks,
Joe
My testcase looks like this:
diff --git a/stdlib/tst-system.c b/stdlib/tst-system.c
index 47a0afe6bf..6f3329c08e 100644
--- a/stdlib/tst-system.c
+++ b/stdlib/tst-system.c
@@ -146,6 +146,20 @@ do_test (void)
TEST_COMPARE_STRING (result.out.buffer, "...\n");
}
+ {
+ struct support_capture_subprocess result;
+ const char *cmd = "-echo";
+ result = support_capture_subprocess (call_system,
+ &(struct args) { cmd, 127, 0 });
+ support_capture_subprocess_check (&result, "system", 0, sc_allow_stderr);
+ printf("JOE: %s\n", result.err.buffer);
+ char *returnerr = xasprintf ("%s: execing %s failed: "
+ "No such file or directory",
+ basename(_PATH_BSHELL), cmd);
+ TEST_COMPARE_STRING (result.err.buffer, returnerr);
+ free (returnerr);
+ }
+
{
struct support_capture_subprocess result;
result = support_capture_subprocess (call_system,
More information about the Libc-help
mailing list