From bd856d7f73f583b7ce304272ccf99b18fa0daabb Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Thu, 5 May 2022 15:10:14 +0200 Subject: [PATCH] test_mx_util: Add test for mx_call_external --- test_mx_util.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test_mx_util.c b/test_mx_util.c index 387db1f6..9ecf5343 100644 --- a/test_mx_util.c +++ b/test_mx_util.c @@ -576,6 +576,19 @@ static void test_mx_pipe_external(void) { } } +static void test_mx_call_external(void) { + int sts; + errno = 999; + + sts = mx_call_external("/usr/bin/true", NULL); + assert(sts == 0); + assert(errno == 999); + + sts = mx_call_external("/usr/bin/false", NULL); + assert(sts == -1); + assert(errno == EPROTO); +} + int main(void) { test_mx_strskipwhitespaces(); @@ -597,5 +610,6 @@ int main(void) test_listsort(); test_mx_df(); test_mx_pipe_external(); + test_mx_call_external(); return 0; }