about summary refs log tree commit diff homepage
path: root/test/Feature/Envp.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/Feature/Envp.c')
-rw-r--r--test/Feature/Envp.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/Feature/Envp.c b/test/Feature/Envp.c
new file mode 100644
index 00000000..f1f62a72
--- /dev/null
+++ b/test/Feature/Envp.c
@@ -0,0 +1,18 @@
+// RUN: %llvmgcc %s -emit-llvm -g -c -o %t1.bc
+// RUN: %klee --exit-on-error %t1.bc
+
+#include <assert.h>
+
+int main(int argc, char **argv, char **envp) {
+  unsigned i;
+  assert(argv[argc] == 0);
+  printf("argc: %d, argv: %p, envp: %p\n", argc, argv, envp);
+  printf("--environ--\n");
+  int haspwd = 0;
+  for (i=0; envp[i]; i++) {
+    printf("%d: %s\n", i, envp[i]);
+    haspwd |= strncmp(envp[i], "PWD=", 4)==0;
+  }
+  assert(haspwd);
+  return 0;
+}