summaryrefslogtreecommitdiff
path: root/test/raidfile/testraidfile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/raidfile/testraidfile.cpp')
-rw-r--r--test/raidfile/testraidfile.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/test/raidfile/testraidfile.cpp b/test/raidfile/testraidfile.cpp
index 160de5c9..d771f23d 100644
--- a/test/raidfile/testraidfile.cpp
+++ b/test/raidfile/testraidfile.cpp
@@ -10,7 +10,6 @@
#include "Box.h"
#include <fcntl.h>
-#include <unistd.h>
#include <stdio.h>
#include <errno.h>
@@ -26,6 +25,7 @@
#include "RaidFileException.h"
#include "RaidFileRead.h"
#include "Guards.h"
+#include "intercept.h"
#include "MemLeakFindOn.h"
@@ -38,14 +38,6 @@
#define TRF_CAN_INTERCEPT
#endif
-
-#ifdef TRF_CAN_INTERCEPT
-// function in intercept.cpp for setting up errors
-void intercept_setup_error(const char *filename, unsigned int errorafter, int errortoreturn, int syscalltoerror);
-bool intercept_triggered();
-void intercept_clear_setup();
-#endif
-
// Nice random data for testing written files
class R250 {
public:
@@ -216,6 +208,12 @@ void testReadingFileContents(int set, const char *filename, void *data, int data
// Be nasty, and create some errors for the RAID stuff to recover from...
if(TestRAIDProperties)
{
+ HideCategoryGuard hide(RaidFileRead::OPEN_IN_RECOVERY);
+ hide.Add(RaidFileRead::IO_ERROR);
+ hide.Add(RaidFileRead::RECOVERING_IO_ERROR);
+ HideSpecificExceptionGuard hex(RaidFileException::ExceptionType,
+ RaidFileException::ErrorOpeningFileForRead);
+
char stripe1fn[256], stripe1fnRename[256];
sprintf(stripe1fn, "testfiles" DIRECTORY_SEPARATOR "%d_%d"
DIRECTORY_SEPARATOR "%s.rf", set, startDisc, filename);
@@ -273,7 +271,6 @@ void testReadingFileContents(int set, const char *filename, void *data, int data
DIRECTORY_SEPARATOR ".raidfile-unreadable"
DIRECTORY_SEPARATOR "%s", set,
(startDisc + 1) % RAID_NUMBER_DISCS, mungefilename);
-
#ifdef TRF_CAN_INTERCEPT
// Test I/O errors on opening