Commit 41df9b37 authored by Rusty Russell's avatar Rusty Russell

pipecmd: test can't-exec case.

Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent c7e55a16
...@@ -34,7 +34,7 @@ int main(int argc, char *argv[]) ...@@ -34,7 +34,7 @@ int main(int argc, char *argv[])
} }
/* This is how many tests you plan to run */ /* This is how many tests you plan to run */
plan_tests(26); plan_tests(28);
child = pipecmd(&outfd, &infd, argv[0], "inout", NULL); child = pipecmd(&outfd, &infd, argv[0], "inout", NULL);
if (!ok1(child > 0)) if (!ok1(child > 0))
exit(1); exit(1);
...@@ -79,6 +79,11 @@ int main(int argc, char *argv[]) ...@@ -79,6 +79,11 @@ int main(int argc, char *argv[])
ok1(WIFEXITED(status)); ok1(WIFEXITED(status));
ok1(WEXITSTATUS(status) == 1); ok1(WEXITSTATUS(status) == 1);
// Can't run non-existent file, but errno set correctly.
child = pipecmd(NULL, NULL, "/doesnotexist", "in", NULL);
ok1(errno == ENOENT);
ok1(child < 0);
/* This exits depending on whether all tests passed */ /* This exits depending on whether all tests passed */
return exit_status(); return exit_status();
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment