00001 /* Grows a file from 0 bytes to 2,134 bytes, 37 bytes at a time, 00002 and checks that the file's size is reported correctly at each 00003 step. */ 00004 00005 #include <syscall.h> 00006 #include "tests/filesys/seq-test.h" 00007 #include "tests/lib.h" 00008 #include "tests/main.h" 00009 00010 static char buf[2134]; 00011 00012 static size_t 00013 return_block_size (void) 00014 { 00015 return 37; 00016 } 00017 00018 static void 00019 check_file_size (int fd, long ofs) 00020 { 00021 long size = filesize (fd); 00022 if (size != ofs) 00023 fail ("filesize not updated properly: should be %ld, actually %ld", 00024 ofs, size); 00025 } 00026 00027 void 00028 test_main (void) 00029 { 00030 seq_test ("testfile", 00031 buf, sizeof buf, 0, 00032 return_block_size, check_file_size); 00033 }