Make tests public. Rewrite most tests. Add tests.
[pintos-anon] / src / tests / userprog / rox-simple.c
diff --git a/src/tests/userprog/rox-simple.c b/src/tests/userprog/rox-simple.c
new file mode 100644 (file)
index 0000000..d024394
--- /dev/null
@@ -0,0 +1,16 @@
+#include <syscall.h>
+#include "tests/lib.h"
+#include "tests/main.h"
+
+void
+test_main (void) 
+{
+  int handle;
+  char buffer[16];
+  
+  CHECK ((handle = open ("rox-simple")) > 1, "open \"rox-simple\"");
+  CHECK (read (handle, buffer, sizeof buffer) == (int) sizeof buffer,
+         "read \"rox-simple\"");
+  CHECK (write (handle, buffer, sizeof buffer) == 0,
+         "try to write \"rox-simple\"");
+}