regression: execle test
authorSzabolcs Nagy <nsz@port70.net>
Thu, 3 Oct 2013 15:46:55 +0000 (15:46 +0000)
committerSzabolcs Nagy <nsz@port70.net>
Thu, 3 Oct 2013 15:46:55 +0000 (15:46 +0000)
src/regression/execle-env.c [new file with mode: 0644]

diff --git a/src/regression/execle-env.c b/src/regression/execle-env.c
new file mode 100644 (file)
index 0000000..d3a8b4e
--- /dev/null
@@ -0,0 +1,17 @@
+// execle should pass env properly
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include "test.h"
+
+int main(void)
+{
+       char *env[] = {"VAR=abc", 0};
+
+       execle("/bin/sh", "sh", "-c",
+               "[ \"$VAR\" = abc ] || { echo '"__FILE__": env is not passed'; exit 1; }",
+               (char*)0, env);
+
+       t_error("execle failed: %s\n", strerror(errno));
+       return 1;
+}