PKUOS - Pintos
Pintos source browser for PKU Operating System course
grow-tell.c
Go to the documentation of this file.
1/** Checks that growing a file updates the file position
2 correctly. */
3
4#include <syscall.h>
6#include "tests/lib.h"
7#include "tests/main.h"
8
9static char buf[2134];
10
11static size_t
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,
32}
static char buf[2134]
Checks that growing a file updates the file position correctly.
Definition: grow-tell.c:9
static void check_tell(int fd, long ofs)
Definition: grow-tell.c:18
void test_main(void)
tests/main.h
Definition: grow-tell.c:27
static size_t return_block_size(void)
Definition: grow-tell.c:12
unsigned tell(int fd)
Definition: syscall.c:133
void fail(const char *format,...)
Definition: lib.c:40
void seq_test(const char *file_name, void *buf, size_t size, size_t initial_size, size_t(*block_size_func)(void), void(*check_func)(int fd, long ofs))
tests/filesys/seq-test.h
Definition: seq-test.c:7