From 41df9b3725e8a115f6d2e6cda7f505c257003a25 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 20 Nov 2015 17:02:14 +1030 Subject: [PATCH] pipecmd: test can't-exec case. Signed-off-by: Rusty Russell --- ccan/pipecmd/test/run.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ccan/pipecmd/test/run.c b/ccan/pipecmd/test/run.c index b08d194d..425e7d00 100644 --- a/ccan/pipecmd/test/run.c +++ b/ccan/pipecmd/test/run.c @@ -34,7 +34,7 @@ int main(int argc, char *argv[]) } /* This is how many tests you plan to run */ - plan_tests(26); + plan_tests(28); child = pipecmd(&outfd, &infd, argv[0], "inout", NULL); if (!ok1(child > 0)) exit(1); @@ -79,6 +79,11 @@ int main(int argc, char *argv[]) ok1(WIFEXITED(status)); 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 */ return exit_status(); } -- 2.39.2