Make tests public. Rewrite most tests. Add tests.
[pintos-anon] / src / tests / userprog / write-boundary.c
1 #include <string.h>
2 #include <syscall.h>
3 #include "tests/userprog/boundary.h"
4 #include "tests/userprog/sample.inc"
5 #include "tests/lib.h"
6 #include "tests/main.h"
7
8 void
9 test_main (void) 
10 {
11   int handle;
12   int byte_cnt;
13   char *sample_p;
14
15   sample_p = copy_string_across_boundary (sample);
16
17   CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\"");
18
19   byte_cnt = write (handle, sample_p, sizeof sample - 1);
20   if (byte_cnt != sizeof sample - 1)
21     fail ("write() returned %d instead of %zu", byte_cnt, sizeof sample - 1);
22 }