Make tests public. Rewrite most tests. Add tests.
[pintos-anon] / src / tests / filesys / extended / grow-sparse.c
1 #include <syscall.h>
2 #include "tests/lib.h"
3 #include "tests/main.h"
4
5 static char buf[76543];
6
7 void
8 test_main (void) 
9 {
10   const char *filename = "testfile";
11   char zero = 0;
12   int fd;
13   
14   CHECK (create (filename, 0), "create \"%s\"", filename);
15   CHECK ((fd = open (filename)) > 1, "open \"%s\"", filename);
16   msg ("seek \"%s\"", filename);
17   seek (fd, sizeof buf - 1);
18   CHECK (write (fd, &zero, 1) > 0, "write \"%s\"", filename);
19   msg ("close \"%s\"", filename);
20   close (fd);
21   check_file (filename, buf, sizeof buf);
22 }