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-sparse.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-sparse.c')
| -rw-r--r-- | tests/filesys/extended/grow-sparse.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/filesys/extended/grow-sparse.c b/tests/filesys/extended/grow-sparse.c new file mode 100644 index 0000000..6eab210 --- /dev/null +++ b/tests/filesys/extended/grow-sparse.c | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | /* Tests that seeking past the end of a file and writing will | ||
| 2 | properly zero out the region in between. */ | ||
| 3 | |||
| 4 | #include <syscall.h> | ||
| 5 | #include "tests/lib.h" | ||
| 6 | #include "tests/main.h" | ||
| 7 | |||
| 8 | static char buf[76543]; | ||
| 9 | |||
| 10 | void | ||
| 11 | test_main (void) | ||
| 12 | { | ||
| 13 | const char *file_name = "testfile"; | ||
| 14 | char zero = 0; | ||
| 15 | int fd; | ||
| 16 | |||
| 17 | CHECK (create (file_name, 0), "create \"%s\"", file_name); | ||
| 18 | CHECK ((fd = open (file_name)) > 1, "open \"%s\"", file_name); | ||
| 19 | msg ("seek \"%s\"", file_name); | ||
| 20 | seek (fd, sizeof buf - 1); | ||
| 21 | CHECK (write (fd, &zero, 1) > 0, "write \"%s\"", file_name); | ||
| 22 | msg ("close \"%s\"", file_name); | ||
| 23 | close (fd); | ||
| 24 | check_file (file_name, buf, sizeof buf); | ||
| 25 | } | ||
