mariadb/freebsd/tests/test-pwrite4g.c
Bradley C. Kuszmaul 7176886212 Change main's second argument to {{{char *const*argv}}}. Fixes #2228. close[t:2228]
git-svn-id: file:///svn/toku/tokudb@18184 c7de825b-a66e-492c-adef-691d508d4ae1
2013-04-16 23:59:01 -04:00

23 lines
682 B
C

/* Verify that toku_os_pwrite does the right thing when writing beyond 4GB. */
#include <fcntl.h>
#include <test.h>
#include <toku_assert.h>
int test_main(int argc, char *const argv[]) {
char fname[] = "pwrite4g.data";
int r;
unlink(fname);
int fd = open(fname, O_RDWR | O_CREAT | O_BINARY, S_IRWXU|S_IRWXG|S_IRWXO);
assert(fd>=0);
char buf[] = "hello";
int64_t offset = (1LL<<32) + 100;
r = toku_os_pwrite(fd, buf, sizeof(buf), offset);
assert(r==sizeof(buf));
int64_t fsize;
r = toku_os_get_file_size(fd, &fsize);
assert(r == 0);
assert(fsize > 100 + (signed)sizeof(buf));
r = close(fd);
assert(r==0);
return 0;
}