Simple test so we can try to find out what's wrong with directory reading
authorRonald G. Minnich <rminnich@google.com>
Sat, 19 Jul 2014 02:26:07 +0000 (02:26 +0000)
committerRonald G. Minnich <rminnich@google.com>
Sat, 19 Jul 2014 02:26:07 +0000 (02:26 +0000)
Opens 1000 files in /net/tcp by opening clone,

or
<arg1 files> in /net/tcp
or
<arg1 files> in <arg2>

Signed-off-by: Ronald G. Minnich <rminnich@google.com>
tests/testclone.c [new file with mode: 0644]

diff --git a/tests/testclone.c b/tests/testclone.c
new file mode 100644 (file)
index 0000000..b79a0b7
--- /dev/null
@@ -0,0 +1,32 @@
+/* Copyright (c) 2014 The Regents of the University of California
+ * Barret Rhoden <brho@cs.berkeley.edu>
+ * See LICENSE for details.
+ *
+ * Send in the clones. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <fcntl.h>
+
+#include <sys/types.h>
+#include <unistd.h>
+       
+int main(int argc, char** argv) 
+{
+       int iter = 1000;
+       char *name = "/net/tcp/clone";
+       if (argc > 1)
+               iter = atoi(argv[1]);
+       if (argc > 2)
+               name = argv[2];
+       while (iter--) {
+               int fd;
+               fd = open(name, O_RDWR, 0666);
+               if (fd < 0) {
+                       perror(name);
+                       exit(-1);
+               }
+       }
+}