Adds a test for the silent error fixing.

This commit is contained in:
Andrea Mazzoleni 2013-08-18 20:30:10 +02:00
parent a774b62448
commit 9a57dd6dc8
2 changed files with 18 additions and 2 deletions

View file

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

View file

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