Make tests public. Rewrite most tests. Add tests.
[pintos-anon] / src / tests / userprog / multi-child-fd.c
1 #include <stdio.h>
2 #include <syscall.h>
3 #include "tests/userprog/sample.inc"
4 #include "tests/lib.h"
5 #include "tests/main.h"
6
7 void
8 test_main (void) 
9 {
10   char child_cmd[128];
11   int handle;
12
13   CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\"");
14
15   snprintf (child_cmd, sizeof child_cmd, "child-close %d", handle);
16   
17   msg ("wait(exec()) = %d", wait (exec (child_cmd)));
18
19   check_file_handle (handle, "sample.txt", sample, sizeof sample - 1);
20 }