Commit 128c1c23 authored by Yoni Fogel's avatar Yoni Fogel

closes[t:2530] Windows port of (non-fork()) diskfull test

git-svn-id: file:///svn/toku/tokudb@19623 c7de825b-a66e-492c-adef-691d508d4ae1
parent e70b9ac0
...@@ -510,17 +510,13 @@ checkpoint_stress.tdbrun: checkpoint_stress.tdb$(BINSUF) $(PTHREAD_LOCAL) ...@@ -510,17 +510,13 @@ checkpoint_stress.tdbrun: checkpoint_stress.tdb$(BINSUF) $(PTHREAD_LOCAL)
test `grep -l 'HAPPY CRASH' dir.checkpoint_stress.c.tdb/error.* |wc -l` = $$(($(STRESS_RUNS)-1)) \ test `grep -l 'HAPPY CRASH' dir.checkpoint_stress.c.tdb/error.* |wc -l` = $$(($(STRESS_RUNS)-1)) \
) $(MAYBEINVERTER) $(SUMMARIZE_CMD) ) $(MAYBEINVERTER) $(SUMMARIZE_CMD)
ifeq ($(OS_CHOICE),windows)
DISKFULL_ABORTCODE=137
else
DISKFULL_ABORTCODE=134 DISKFULL_ABORTCODE=134
endif
diskfull.tdbrun: SHELL=/bin/bash diskfull.tdbrun: SHELL=/bin/bash
diskfull.tdbrun: diskfull.tdb$(BINSUF) $(PTHREAD_LOCAL) diskfull.tdbrun: diskfull.tdb$(BINSUF) $(PTHREAD_LOCAL)
NUM_WRITES=$$($(VGRIND) ./$< -q) && \ NUM_WRITES=$$($(VGRIND) ./$< -q) && \
(for (( i = 0; i < $$NUM_WRITES; i++ )); do \ (for (( i = 0; i < $$NUM_WRITES; i++ )); do \
{ ./$< -C $$i 2>/dev/null; } 2>/dev/null; \ { ./$< -C $$i $(VERBVERBOSE) 2>/dev/null; } 2>/dev/null; \
if [ $$? -ne $(DISKFULL_ABORTCODE) ] ; then \ if [ $$? -ne $(DISKFULL_ABORTCODE) ] ; then \
echo "Diskfull (iteration $$i) did not abort" ; \ echo "Diskfull (iteration $$i) did not abort" ; \
exit 1; \ exit 1; \
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
#include <sys/wait.h>
#define DOERR(r) do { if (r!=0) { did_fail=1; fprintf(error_file, "%s:%d error %d (%s)\n", __FILE__, __LINE__, r, db_strerror(r)); }} while (0) #define DOERR(r) do { if (r!=0) { did_fail=1; fprintf(error_file, "%s:%d error %d (%s)\n", __FILE__, __LINE__, r, db_strerror(r)); }} while (0)
...@@ -142,7 +141,7 @@ pwrite_counting_and_failing (int fd, const void *buf, size_t size, toku_off_t of ...@@ -142,7 +141,7 @@ pwrite_counting_and_failing (int fd, const void *buf, size_t size, toku_off_t of
{ {
write_count++; write_count++;
if (write_count>fail_at) { if (write_count>fail_at) {
if (verbose) fprintf(stderr, "Failure imminent at %d:\n", fail_at); if (verbose>1) { printf("Failure imminent at %d:\n", fail_at); fflush(stdout); }
errno = ENOSPC; errno = ENOSPC;
return -1; return -1;
} else { } else {
...@@ -155,7 +154,7 @@ write_counting_and_failing (int fd, const void *buf, size_t size) ...@@ -155,7 +154,7 @@ write_counting_and_failing (int fd, const void *buf, size_t size)
{ {
write_count++; write_count++;
if (write_count>fail_at) { if (write_count>fail_at) {
if (verbose) fprintf(stderr, "Failure imminent at %d:\n", fail_at); if (verbose>1) { printf("Failure imminent at %d:\n", fail_at); fflush(stdout); }
errno = ENOSPC; errno = ENOSPC;
return -1; return -1;
} else { } else {
...@@ -165,13 +164,13 @@ write_counting_and_failing (int fd, const void *buf, size_t size) ...@@ -165,13 +164,13 @@ write_counting_and_failing (int fd, const void *buf, size_t size)
static void static void
do_writes_that_fail (void) { do_writes_that_fail (void) {
if (verbose) fprintf(stderr, "About to fail at %d:\n", fail_at); if (verbose) { printf("About to fail at %d:\n", fail_at); fflush(stdout); }
toku_set_assert_on_write_enospc(TRUE); toku_set_assert_on_write_enospc(TRUE);
db_env_set_func_pwrite(pwrite_counting_and_failing); db_env_set_func_pwrite(pwrite_counting_and_failing);
db_env_set_func_write (write_counting_and_failing); db_env_set_func_write (write_counting_and_failing);
write_count=0; write_count=0;
do_db_work(); do_db_work();
printf("%d\n", write_count); printf("%d", write_count);
} }
static void static void
......
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