summaryrefslogtreecommitdiffstats
path: root/pintos-progos/tests/filesys/extended/grow-tell.c
diff options
context:
space:
mode:
Diffstat (limited to 'pintos-progos/tests/filesys/extended/grow-tell.c')
-rw-r--r--pintos-progos/tests/filesys/extended/grow-tell.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/pintos-progos/tests/filesys/extended/grow-tell.c b/pintos-progos/tests/filesys/extended/grow-tell.c
new file mode 100644
index 0000000..5f5da5b
--- /dev/null
+++ b/pintos-progos/tests/filesys/extended/grow-tell.c
@@ -0,0 +1,32 @@
1/* Checks that growing a file updates the file position
2 correctly. */
3
4#include <syscall.h>
5#include "tests/filesys/seq-test.h"
6#include "tests/lib.h"
7#include "tests/main.h"
8
9static char buf[2134];
10
11static size_t
12return_block_size (void)
13{
14 return 37;
15}
16
17static void
18check_tell (int fd, long ofs)
19{
20 long pos = tell (fd);
21 if (pos != ofs)
22 fail ("file position not updated properly: should be %ld, actually %ld",
23 ofs, pos);
24}
25
26void
27test_main (void)
28{
29 seq_test ("foobar",
30 buf, sizeof buf, 0,
31 return_block_size, check_tell);
32}