mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 19:01:57 -04:00
Extend the coverage test
This commit is contained in:
parent
4d5d1d9947
commit
cb84c61d07
9 changed files with 56 additions and 10 deletions
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue