Commit 30f7ebcf authored by Yoni Fogel's avatar Yoni Fogel

Addresses #1305

Port test to windows (took large stack item and made it static)
Added debugging info for verbose mode

git-svn-id: file:///svn/toku/tokudb.1032b@8338 c7de825b-a66e-492c-adef-691d508d4ae1
parent faa303da
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "../brttypes.h" #include "../brttypes.h"
#include "../bread.h" #include "../bread.h"
#include "test.h"
#define FNAME "test1305.data" #define FNAME "test1305.data"
...@@ -30,8 +31,13 @@ test (u_int64_t fsize) { ...@@ -30,8 +31,13 @@ test (u_int64_t fsize) {
{ {
int fd = open(FNAME, O_CREAT+O_RDWR+O_BINARY, 0777); int fd = open(FNAME, O_CREAT+O_RDWR+O_BINARY, 0777);
assert(fd>=0); assert(fd>=0);
u_int64_t buf[N_BIGINTS]; static u_int64_t buf[N_BIGINTS]; //windows cannot handle this on the stack
while (i*BIGINT_SIZE < fsize) { while (i*BIGINT_SIZE < fsize) {
if (verbose>0 && i % (1<<25) == 0) {
printf(" %s:test (%"PRIu64") forwards [%"PRIu64"%%]\n", __FILE__, fsize, 100*BIGINT_SIZE*((u_int64_t)i) / fsize);
fflush(stdout);
}
int j; int j;
for (j=0; j<N_BIGINTS; j++) { for (j=0; j<N_BIGINTS; j++) {
buf[j] = i++; buf[j] = i++;
...@@ -47,6 +53,10 @@ test (u_int64_t fsize) { ...@@ -47,6 +53,10 @@ test (u_int64_t fsize) {
int fd = open(FNAME, O_RDONLY+O_BINARY); assert(fd>=0); int fd = open(FNAME, O_RDONLY+O_BINARY); assert(fd>=0);
BREAD br = create_bread_from_fd_initialize_at(fd, fsize, READBACK_BUFSIZE); BREAD br = create_bread_from_fd_initialize_at(fd, fsize, READBACK_BUFSIZE);
while (bread_has_more(br)) { while (bread_has_more(br)) {
if (verbose>0 && (fsize/BIGINT_SIZE - i) % (1<<25) == 0) {
printf(" %s:test (%"PRIu64") backwards [%"PRIu64"%%]\n", __FILE__, fsize, 100*BIGINT_SIZE*((u_int64_t)i) / fsize);
fflush(stdout);
}
assert(i>0); assert(i>0);
i--; i--;
u_int64_t storedi; u_int64_t storedi;
...@@ -62,7 +72,8 @@ test (u_int64_t fsize) { ...@@ -62,7 +72,8 @@ test (u_int64_t fsize) {
unlink(FNAME); unlink(FNAME);
} }
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) { int main (int argc, const char *argv[]) {
default_parse_args(argc, argv);
test(1LL<<23); test(1LL<<23);
test(1LL<<30); test(1LL<<30);
test(1LL<<31); test(1LL<<31);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment