PKUOS - Pintos
Pintos source browser for PKU Operating System course
src
tests
filesys
extended
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>
5
#include "
tests/filesys/seq-test.h
"
6
#include "
tests/lib.h
"
7
#include "
tests/main.h
"
8
9
static
char
buf
[2134];
10
11
static
size_t
12
return_block_size
(
void
)
13
{
14
return
37;
15
}
16
17
static
void
18
check_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
26
void
27
test_main
(
void
)
28
{
29
seq_test
(
"foobar"
,
30
buf
,
sizeof
buf
, 0,
31
return_block_size
,
check_tell
);
32
}
buf
static char buf[2134]
Checks that growing a file updates the file position correctly.
Definition:
grow-tell.c:9
check_tell
static void check_tell(int fd, long ofs)
Definition:
grow-tell.c:18
test_main
void test_main(void)
tests/main.h
Definition:
grow-tell.c:27
return_block_size
static size_t return_block_size(void)
Definition:
grow-tell.c:12
tell
unsigned tell(int fd)
Definition:
syscall.c:133
fail
void fail(const char *format,...)
Definition:
lib.c:40
lib.h
main.h
seq_test
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
seq-test.h
Generated on Thu Nov 4 2021 19:31:01 for PKUOS - Pintos by
1.9.2