Extend the coverage test

This commit is contained in:
Andrea Mazzoleni 2016-11-06 18:27:44 +01:00
parent 4d5d1d9947
commit cb84c61d07
9 changed files with 56 additions and 10 deletions

View file

@ -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 ####

View file

@ -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 */

View file

@ -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;

View file

@ -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 */

View file

@ -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;

View file

@ -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)

View file

@ -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 */
}
}
}

View file

@ -5,7 +5,7 @@
make distclean
if ! ./configure --enable-coverage; then
if ! ./configure --enable-coverage --enable-sde; then
exit 1
fi

View file

@ -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