summaryrefslogtreecommitdiffstats
path: root/pintos-progos/tests/filesys/extended/grow-tell.c
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2012-03-26 12:54:45 +0200
committermanuel <manuel@mausz.at>2012-03-26 12:54:45 +0200
commitb5f0874cd96ee2a62aabc645b9626c2749cb6a01 (patch)
tree1262e4bbe0634de6650be130c36e0538240f4cbf /pintos-progos/tests/filesys/extended/grow-tell.c
downloadprogos-b5f0874cd96ee2a62aabc645b9626c2749cb6a01.tar.gz
progos-b5f0874cd96ee2a62aabc645b9626c2749cb6a01.tar.bz2
progos-b5f0874cd96ee2a62aabc645b9626c2749cb6a01.zip
initial pintos checkin
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}