From 9a57dd6dc8379a3be93076f234cc5ddb2ef8c3ae Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Sun, 18 Aug 2013 20:30:10 +0200 Subject: [PATCH] Adds a test for the silent error fixing. --- Makefile.am | 11 +++++++++++ scrub.c | 9 +++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 45e94d0a..668c3bf0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -165,6 +165,17 @@ endif $(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) --test-skip-self -c $(srcdir)/test-raid6.conf status $(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) --test-skip-self -c $(srcdir)/test-raid6.conf --test-force-scrub 100000 scrub $(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) --test-skip-self -c $(srcdir)/test-raid6.conf status + echo --- Corrupt one file, scrub and fix filtering for error + rm -f test/disk1/content + cp test/content test/disk1/content + $(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) --test-skip-self -c $(srcdir)/test-raid6.conf sync + $(TESTENV) ./mktest$(EXEEXT) damage 1 10 1 test/disk1/content + $(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) --test-skip-self -c $(srcdir)/test-raid6.conf --test-expect-recoverable --test-force-scrub 100000 scrub + $(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) --test-skip-self -c $(srcdir)/test-raid6.conf status + $(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) --test-skip-self -c $(srcdir)/test-raid6.conf fix -e + $(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) --test-skip-self -c $(srcdir)/test-raid6.conf --test-force-scrub 100000 scrub + rm test/disk1/content + $(TESTENV) ./snapraid$(EXEEXT) $(CHECKFLAGS) --test-skip-self -c $(srcdir)/test-raid6.conf sync echo --- Make a hole in the disk array mv test/disk2 test/disk2.old mkdir test/disk2 diff --git a/scrub.c b/scrub.c index 2d4f8b46..475ae2dd 100644 --- a/scrub.c +++ b/scrub.c @@ -424,8 +424,13 @@ bail: free(buffer); free(rehandle_alloc); - if (error != 0) - return -1; + if (state->opt.expect_recoverable) { + if (error == 0) + return -1; + } else { + if (error != 0) + return -1; + } return 0; }