summaryrefslogtreecommitdiff
path: root/tests/test-execl-main.c
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2020-12-26 14:37:54 +0100
committerBruno Haible <bruno@clisp.org>2020-12-26 14:37:54 +0100
commit614b2e6c98172bdcc96ca735f4e14056dc32e59c (patch)
treee66dbaea2076e20d2b6b61990b9346fa390e83d1 /tests/test-execl-main.c
parent7fbf62ebb9e7466a157b5f339d15ff1d11b18d45 (diff)
downloadgnulib-614b2e6c98172bdcc96ca735f4e14056dc32e59c.tar.gz
execl: Add tests.
* tests/test-execl-main.c: New file. * tests/test-execl.sh: New file. * modules/execl-tests: New file.
Diffstat (limited to 'tests/test-execl-main.c')
-rw-r--r--tests/test-execl-main.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/test-execl-main.c b/tests/test-execl-main.c
new file mode 100644
index 0000000000..a16cefaa83
--- /dev/null
+++ b/tests/test-execl-main.c
@@ -0,0 +1,49 @@
+/* Test of execl().
+ Copyright (C) 2020 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <https://www.gnu.org/licenses/>. */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2020. */
+
+#include <config.h>
+
+/* Specification. */
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (execl, int, (const char *, const char *, ...));
+
+#include <stdio.h>
+
+int
+main ()
+{
+ const char *progname = "./test-exec-child";
+ execl (progname,
+ progname,
+ "abc def",
+ "abc\"def\"ghi",
+ "xyz\"",
+ "abc\\def\\ghi",
+ "xyz\\",
+ "???",
+ "***",
+ "",
+ "foo",
+ "",
+ NULL);
+
+ perror ("execl");
+ return 1;
+}