diff --git a/Makefile.am b/Makefile.am index 9a932768..a7647d0e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -139,7 +139,6 @@ clean-local: rm -f cmdline/*.gcda cmdline/*.gcno cmdline/*.gcov rm -f raid/*.gcda raid/*.gcno raid/*.gcov rm -f tommyds/*.gcda tommyds/*.gcno tommyds/*.gcov - rm -rf cov rm -f lcov.info rm -f gmon.out @@ -338,6 +337,9 @@ endif rm bench/disk1/INVA1 touch bench/disk1/INVA2 $(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) --test-kill-after-sync sync +# Diff should report the need of a sync for invalid parity + $(FAILENV) ./snapraid$(EXEEXT) $(CHECKFLAGS_VERBOSE) -c $(PAR1) --test-expect-need-sync diff + $(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) status mv bench/disk2/MOVE2 bench/disk4/MOVE4 mv bench/disk3/MOVE3 bench/disk5/MOVE5 mv bench/disk4/MOVE4 bench/disk6/MOVE6 @@ -435,8 +437,8 @@ endif $(FAILENV) ./snapraid$(EXEEXT) $(CHECKFLAGS_VERBOSE) -c $(PAR1) --test-expect-need-sync diff > output.log $(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) --test-skip-fallocate -c $(PAR1) sync $(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) -c $(CONF) status - $(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) --test-io-advise-none -c $(PAR1) sync -F - $(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) --test-io-advise-sequential -c $(PAR1) sync -F + $(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) --test-io-advise-none -c $(PAR1) sync -F --test-io-cache 1 + $(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) --test-io-advise-sequential -c $(PAR1) sync -F --test-io-stats $(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) --test-io-advise-flush-window -c $(PAR1) sync -F $(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) --test-io-advise-discard-window -c $(PAR1) sync -F #### CHANGE LINKS #### diff --git a/cmdline/check.c b/cmdline/check.c index b2d120e1..835f94fc 100644 --- a/cmdline/check.c +++ b/cmdline/check.c @@ -909,9 +909,11 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna /* post process the files */ ret = file_post(state, fix, i, handle, diskmax); if (ret == -1) { + /* LCOV_EXCL_START */ log_fatal("Stopping at block %u\n", i); ++unrecoverable_error; goto bail; + /* LCOV_EXCL_STOP */ } /* and now continue with the next block */ @@ -1384,9 +1386,11 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna /* post process the files */ ret = file_post(state, fix, i, handle, diskmax); if (ret == -1) { + /* LCOV_EXCL_START */ log_fatal("Stopping at block %u\n", i); ++unrecoverable_error; goto bail; + /* LCOV_EXCL_STOP */ } /* count the number of processed block */ diff --git a/cmdline/dry.c b/cmdline/dry.c index 57e642b8..54720e8a 100644 --- a/cmdline/dry.c +++ b/cmdline/dry.c @@ -254,12 +254,16 @@ static int state_dry_process(struct snapraid_state* state, struct snapraid_parit /* handle error conditions */ if (task->state == TASK_STATE_IOERROR) { + /* LCOV_EXCL_START */ ++io_error; goto bail; + /* LCOV_EXCL_STOP */ } if (task->state == TASK_STATE_ERROR) { + /* LCOV_EXCL_START */ ++error; goto bail; + /* LCOV_EXCL_STOP */ } if (task->state == TASK_STATE_ERROR_CONTINUE) { ++error; @@ -304,12 +308,16 @@ static int state_dry_process(struct snapraid_state* state, struct snapraid_parit /* handle error conditions */ if (task->state == TASK_STATE_IOERROR) { + /* LCOV_EXCL_START */ ++io_error; goto bail; + /* LCOV_EXCL_STOP */ } if (task->state == TASK_STATE_ERROR) { + /* LCOV_EXCL_START */ ++error; goto bail; + /* LCOV_EXCL_STOP */ } if (task->state == TASK_STATE_ERROR_CONTINUE) { ++error; diff --git a/cmdline/parity.c b/cmdline/parity.c index 29329eb1..aa431355 100644 --- a/cmdline/parity.c +++ b/cmdline/parity.c @@ -530,8 +530,11 @@ int parity_chsize(struct snapraid_parity_handle* handle, struct snapraid_parity* /* mask of bits used by the block size */ block_mask = ((data_off_t)block_size) - 1; - if (size < 0) + if (size < 0) { + /* LCOV_EXCL_START */ return -1; + /* LCOV_EXCL_STOP */ + } for (s = 0;s < handle->split_mac;++s) { struct snapraid_split_handle* split = &handle->split_map[s]; @@ -563,8 +566,11 @@ int parity_chsize(struct snapraid_parity_handle* handle, struct snapraid_parity* } ret = parity_handle_chsize(split, run, block_size, skip_fallocate, skip_space_holder); - if (ret != 0) + if (ret != 0) { + /* LCOV_EXCL_START */ return -1; + /* LCOV_EXCL_STOP */ + } if (split->st.st_size > run) { /* LCOV_EXCL_START */ @@ -597,8 +603,10 @@ int parity_chsize(struct snapraid_parity_handle* handle, struct snapraid_parity* /* if we cannot allocate all the space */ if (size != 0) { + /* LCOV_EXCL_START */ log_fatal("Failed to allocate all the required parity space. You miss %" PRIu64 " bytes.\n", size); return -1; + /* LCOV_EXCL_STOP */ } /* now copy the new size in the parity data */ diff --git a/cmdline/scrub.c b/cmdline/scrub.c index 1936a845..742c6dad 100644 --- a/cmdline/scrub.c +++ b/cmdline/scrub.c @@ -414,12 +414,16 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par /* handle error conditions */ if (task->state == TASK_STATE_IOERROR) { + /* LCOV_EXCL_START */ ++io_error; goto bail; + /* LCOV_EXCL_STOP */ } if (task->state == TASK_STATE_ERROR) { + /* LCOV_EXCL_START */ ++error; goto bail; + /* LCOV_EXCL_STOP */ } if (task->state == TASK_STATE_ERROR_CONTINUE) { ++error; @@ -506,12 +510,16 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par /* handle error conditions */ if (task->state == TASK_STATE_IOERROR) { + /* LCOV_EXCL_START */ ++io_error; goto bail; + /* LCOV_EXCL_STOP */ } if (task->state == TASK_STATE_ERROR) { + /* LCOV_EXCL_START */ ++error; goto bail; + /* LCOV_EXCL_STOP */ } if (task->state == TASK_STATE_ERROR_CONTINUE) { ++error; diff --git a/cmdline/selftest.c b/cmdline/selftest.c index 99b6a94f..26a95999 100644 --- a/cmdline/selftest.c +++ b/cmdline/selftest.c @@ -406,6 +406,14 @@ static void test_tommy(void) /* LCOV_EXCL_STOP */ } + tommy_list_insert_tail(&list, &node[0], &node[0]); + + if (tommy_list_tail(&list) != tommy_list_head(&list)) { + /* LCOV_EXCL_START */ + goto bail; + /* LCOV_EXCL_STOP */ + } + tommy_hashdyn_init(&hashdyn); for (i = 0; i < TOMMY_SIZE; ++i) diff --git a/cmdline/sync.c b/cmdline/sync.c index bababec1..1d59c10a 100644 --- a/cmdline/sync.c +++ b/cmdline/sync.c @@ -884,12 +884,16 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari /* handle error conditions */ if (task->state == TASK_STATE_IOERROR) { + /* LCOV_EXCL_START */ ++io_error; goto bail; + /* LCOV_EXCL_STOP */ } if (task->state == TASK_STATE_ERROR) { + /* LCOV_EXCL_START */ ++error; goto bail; + /* LCOV_EXCL_STOP */ } if (task->state == TASK_STATE_ERROR_CONTINUE) { ++error; @@ -899,10 +903,12 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari if (task->state == TASK_STATE_IOERROR_CONTINUE) { ++io_error; if (io_error >= state->opt.io_error_limit) { + /* LCOV_EXCL_START */ log_fatal("DANGER! Unexpected input/output read error in a data disk, it isn't possible to sync.\n"); log_fatal("Ensure that disk '%s' is sane and that file '%s' can be read.\n", disk->dir, task->path); log_fatal("Stopping at block %u\n", blockcur); goto bail; + /* LCOV_EXCL_STOP */ } /* otherwise continue */ @@ -1245,20 +1251,26 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari case TASK_STATE_IOERROR_CONTINUE : ++io_error; if (io_error >= state->opt.io_error_limit) { + /* LCOV_EXCL_START */ log_fatal("DANGER! Unexpected input/output write error in a parity disk, it isn't possible to sync.\n"); log_fatal("Stopping at block %u\n", blockcur); goto bail; + /* LCOV_EXCL_STOP */ } break; case TASK_STATE_ERROR_CONTINUE : ++error; break; case TASK_STATE_IOERROR : + /* LCOV_EXCL_START */ ++io_error; goto bail; + /* LCOV_EXCL_STOP */ case TASK_STATE_ERROR : + /* LCOV_EXCL_START */ ++error; goto bail; + /* LCOV_EXCL_STOP */ } } } diff --git a/makecov.sh b/makecov.sh index f030361e..4a0bbd99 100755 --- a/makecov.sh +++ b/makecov.sh @@ -5,7 +5,7 @@ make distclean -if ! ./configure --enable-coverage; then +if ! ./configure --enable-coverage --enable-sde; then exit 1 fi diff --git a/maketest.sh b/maketest.sh index 63f7d239..75c746cf 100755 --- a/maketest.sh +++ b/maketest.sh @@ -14,10 +14,6 @@ if ! make lcov_reset check lcov_capture lcov_html; then exit 1 fi -# Keep a copy of the coverage results -rm -rf cov_release -mv cov cov_release - if ! make distclean; then exit 1 fi