diff options
| author | manuel <manuel@mausz.at> | 2012-03-27 11:51:08 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2012-03-27 11:51:08 +0200 |
| commit | 4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b (patch) | |
| tree | 868c52e06f207b5ec8a3cc141f4b8b2bdfcc165c /tests/filesys/extended/grow-file-size.c | |
| parent | eae0bd57f0a26314a94785061888d193d186944a (diff) | |
| download | progos-4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b.tar.gz progos-4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b.tar.bz2 progos-4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b.zip | |
reorganize file structure to match the upstream requirements
Diffstat (limited to 'tests/filesys/extended/grow-file-size.c')
| -rw-r--r-- | tests/filesys/extended/grow-file-size.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/filesys/extended/grow-file-size.c b/tests/filesys/extended/grow-file-size.c new file mode 100644 index 0000000..3ce8588 --- /dev/null +++ b/tests/filesys/extended/grow-file-size.c | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | /* Grows a file from 0 bytes to 2,134 bytes, 37 bytes at a time, | ||
| 2 | and checks that the file's size is reported correctly at each | ||
| 3 | step. */ | ||
| 4 | |||
| 5 | #include <syscall.h> | ||
| 6 | #include "tests/filesys/seq-test.h" | ||
| 7 | #include "tests/lib.h" | ||
| 8 | #include "tests/main.h" | ||
| 9 | |||
| 10 | static char buf[2134]; | ||
| 11 | |||
| 12 | static size_t | ||
| 13 | return_block_size (void) | ||
| 14 | { | ||
| 15 | return 37; | ||
| 16 | } | ||
| 17 | |||
| 18 | static void | ||
| 19 | check_file_size (int fd, long ofs) | ||
| 20 | { | ||
| 21 | long size = filesize (fd); | ||
| 22 | if (size != ofs) | ||
| 23 | fail ("filesize not updated properly: should be %ld, actually %ld", | ||
| 24 | ofs, size); | ||
| 25 | } | ||
| 26 | |||
| 27 | void | ||
| 28 | test_main (void) | ||
| 29 | { | ||
| 30 | seq_test ("testfile", | ||
| 31 | buf, sizeof buf, 0, | ||
| 32 | return_block_size, check_file_size); | ||
| 33 | } | ||
