Initial file system tests.
[pintos-anon] / grading / filesys / grow-sparse.c
1 /* -*- c -*- */
2
3 #include <syscall.h>
4 #include "fslib.h"
5
6 const char test_name[] = "grow-sparse";
7 static char buf[76543];
8
9 int
10 main (void) 
11 {
12   char zero = 0;
13   int fd;
14   
15   msg ("begin");
16   check (create ("testfile", 0), "create \"testfile\"");
17   check ((fd = open ("testfile")) > 1, "open \"testfile\"");
18   msg ("seek \"testfile\"");
19   seek (fd, sizeof buf - 1);
20   check (write (fd, &zero, 1) > 0, "write \"testfile\"");
21   msg ("close \"testfile\"");
22   close (fd);
23   check_file ("testfile", buf, sizeof buf);
24   msg ("end");
25   return 0;
26 }