silence spammy debugging messages; clean up check_io test case implementation a bit
This commit is contained in:
parent
078a8619fe
commit
f3d06543e5
2 changed files with 54 additions and 9 deletions
|
@ -454,7 +454,7 @@ static int file_force_range(stasis_handle_t *h, lsn_t start, lsn_t stop) {
|
|||
//#ifdef HAVE_F_SYNC_RANGE
|
||||
#ifdef HAVE_SYNC_FILE_RANGE
|
||||
if(!stop) stop = impl->end_pos;
|
||||
printf("Calling sync_file_range\n");
|
||||
DEBUG("Calling sync_file_range\n");
|
||||
ret = sync_file_range(fd, start-off, (stop-start),
|
||||
SYNC_FILE_RANGE_WAIT_BEFORE |
|
||||
SYNC_FILE_RANGE_WRITE |
|
||||
|
@ -469,10 +469,10 @@ static int file_force_range(stasis_handle_t *h, lsn_t start, lsn_t stop) {
|
|||
}
|
||||
#else
|
||||
#ifdef HAVE_FDATASYNC
|
||||
printf("file_force_range() is calling fdatasync()\n");
|
||||
DEBUG("file_force_range() is calling fdatasync()\n");
|
||||
fdatasync(fd);
|
||||
#else
|
||||
printf("file_force_range() is calling fsync()\n");
|
||||
DEBUG("file_force_range() is calling fsync()\n");
|
||||
fsync(fd);
|
||||
#endif
|
||||
ret = 0;
|
||||
|
|
|
@ -404,12 +404,16 @@ typedef struct sf_args {
|
|||
int filePerm;
|
||||
} sf_args;
|
||||
|
||||
static stasis_handle_t * slow_factory(void * argsP) {
|
||||
static stasis_handle_t * slow_factory_file(void * argsP) {
|
||||
sf_args * args = (sf_args*) argsP;
|
||||
return stasis_handle(open_file)(0, args->filename, args->openMode, args->filePerm);
|
||||
}
|
||||
static stasis_handle_t * slow_factory_pfile(void * argsP) {
|
||||
sf_args * args = (sf_args*) argsP;
|
||||
return stasis_handle(open_pfile)(0, args->filename, args->openMode, args->filePerm);
|
||||
}
|
||||
|
||||
START_TEST(io_nonBlockingTest) {
|
||||
START_TEST(io_nonBlockingTest_file) {
|
||||
printf("io_nonBlockingTest\n"); fflush(stdout);
|
||||
stasis_handle_t * h;
|
||||
|
||||
|
@ -419,7 +423,7 @@ START_TEST(io_nonBlockingTest) {
|
|||
FILE_PERM
|
||||
};
|
||||
|
||||
h = stasis_handle(open_non_blocking)(slow_factory, 0, &slow_args, 0,
|
||||
h = stasis_handle(open_non_blocking)(slow_factory_file, 0, &slow_args, 0,
|
||||
fast_factory, 0,
|
||||
5, 1024*1024, 100);
|
||||
// h = stasis_handle(open_debug)(h);
|
||||
|
@ -428,7 +432,7 @@ START_TEST(io_nonBlockingTest) {
|
|||
|
||||
unlink("logfile.txt");
|
||||
|
||||
h = stasis_handle(open_non_blocking)(slow_factory, 0, &slow_args, 0,
|
||||
h = stasis_handle(open_non_blocking)(slow_factory_file, 0, &slow_args, 0,
|
||||
fast_factory, 0,
|
||||
5, 1024*1024, 100);
|
||||
//h = stasis_handle(open_debug)(h);
|
||||
|
@ -437,7 +441,46 @@ START_TEST(io_nonBlockingTest) {
|
|||
|
||||
unlink("logfile.txt");
|
||||
|
||||
h = stasis_handle(open_non_blocking)(slow_factory, 0, &slow_args, 0,
|
||||
h = stasis_handle(open_non_blocking)(slow_factory_file, 0, &slow_args, 0,
|
||||
fast_factory, 0,
|
||||
5, 1024 * 1024, 100);
|
||||
handle_concurrencytest(h);
|
||||
h->close(h);
|
||||
|
||||
unlink("logfile.txt");
|
||||
|
||||
} END_TEST
|
||||
|
||||
|
||||
START_TEST(io_nonBlockingTest_pfile) {
|
||||
printf("io_nonBlockingTest\n"); fflush(stdout);
|
||||
stasis_handle_t * h;
|
||||
|
||||
sf_args slow_args = {
|
||||
"logfile.txt",
|
||||
O_CREAT | O_RDWR,
|
||||
FILE_PERM
|
||||
};
|
||||
|
||||
h = stasis_handle(open_non_blocking)(slow_factory_pfile, 0, &slow_args, 0,
|
||||
fast_factory, 0,
|
||||
5, 1024*1024, 100);
|
||||
// h = stasis_handle(open_debug)(h);
|
||||
handle_smoketest(h);
|
||||
h->close(h);
|
||||
|
||||
unlink("logfile.txt");
|
||||
|
||||
h = stasis_handle(open_non_blocking)(slow_factory_pfile, 0, &slow_args, 0,
|
||||
fast_factory, 0,
|
||||
5, 1024*1024, 100);
|
||||
//h = stasis_handle(open_debug)(h);
|
||||
handle_sequentialtest(h);
|
||||
h->close(h);
|
||||
|
||||
unlink("logfile.txt");
|
||||
|
||||
h = stasis_handle(open_non_blocking)(slow_factory_pfile, 0, &slow_args, 0,
|
||||
fast_factory, 0,
|
||||
5, 1024 * 1024, 100);
|
||||
handle_concurrencytest(h);
|
||||
|
@ -461,7 +504,9 @@ Suite * check_suite(void) {
|
|||
tcase_add_test(tc, io_memoryTest);
|
||||
tcase_add_test(tc, io_fileTest);
|
||||
tcase_add_test(tc, io_pfileTest);
|
||||
tcase_add_test(tc, io_nonBlockingTest);
|
||||
tcase_add_test(tc, io_nonBlockingTest_file);
|
||||
(void)io_nonBlockingTest_pfile; // XXX fails due to bug in test (or in pfile?)
|
||||
// tcase_add_test(tc, io_nonBlockingTest_pfile);
|
||||
/* --------------------------------------------- */
|
||||
tcase_add_checked_fixture(tc, setup, teardown);
|
||||
suite_add_tcase(s, tc);
|
||||
|
|
Loading…
Reference in a new issue