aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-03-25 01:40:33 +1300
committerTom Ryder <tom@sanctum.geek.nz>2016-03-25 01:40:33 +1300
commit71e73ac3b4063efeb847781e144b01b49fc9dc98 (patch)
tree2e3f68035071fc5a9aac4f271d899106452444b2
parentAdd some test C files (diff)
downloaddoomsh-71e73ac3b4063efeb847781e144b01b49fc9dc98.tar.gz
doomsh-71e73ac3b4063efeb847781e144b01b49fc9dc98.zip
Add files test
-rw-r--r--.gitignore1
-rw-r--r--tests/Makefile2
-rw-r--r--tests/files.c17
3 files changed, 19 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index a23ca02..804eaa0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
+tests/files
tests/mem
tests/stack
diff --git a/tests/Makefile b/tests/Makefile
index 8dff5a0..abc4fc5 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -2,5 +2,5 @@
CC = clang
-all : mem stack
+all : files mem stack
diff --git a/tests/files.c b/tests/files.c
new file mode 100644
index 0000000..ff5eaaf
--- /dev/null
+++ b/tests/files.c
@@ -0,0 +1,17 @@
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+/* files.c -- Open as many files as we can */
+int main(void) {
+ FILE *fp = NULL;
+ int i = 0;
+ for (;;i++) {
+ if ((fp = tmpfile()) == NULL) {
+ fprintf(stderr, "Created %u files\n", i);
+ perror("tmpfile");
+ raise(SIGABRT);
+ }
+ }
+}
+