about summary refs log tree commit diff homepage
path: root/test/Runtime/POSIX/FDNumbers.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/Runtime/POSIX/FDNumbers.c')
-rw-r--r--test/Runtime/POSIX/FDNumbers.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/Runtime/POSIX/FDNumbers.c b/test/Runtime/POSIX/FDNumbers.c
new file mode 100644
index 00000000..e576f9bb
--- /dev/null
+++ b/test/Runtime/POSIX/FDNumbers.c
@@ -0,0 +1,24 @@
+// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc
+// RUN: %klee --init-env --posix-runtime --exit-on-error %t2.bc --sym-files 1 10
+
+#include <assert.h>
+#include <fcntl.h>
+#include <errno.h>
+
+int main(int argc, char **argv) {
+  int fd = open("A", O_TRUNC);
+  assert(fd == 3);
+  assert(!close(0));
+  assert(!close(1));
+  assert(close(0) == -1);
+  assert(close(1) == -1);
+  assert(open("A", O_TRUNC) == 0);  
+  assert(dup(0) == 1);
+  assert(open("A", O_TRUNC) == 4);
+  assert(!close(1));
+  assert(open("A", O_TRUNC) == 1);
+  assert(dup(0) != 1);
+  assert(dup2(0,1) == 1);
+  
+  return 0;
+}