summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/backupstore/testbackupstore.cpp24
-rwxr-xr-xtest/common/testcommon.cpp2
-rwxr-xr-xtest/raidfile/intercept.cpp10
-rwxr-xr-xtest/raidfile/testraidfile.cpp2
4 files changed, 23 insertions, 15 deletions
diff --git a/test/backupstore/testbackupstore.cpp b/test/backupstore/testbackupstore.cpp
index 3757bc60..1d297f16 100755
--- a/test/backupstore/testbackupstore.cpp
+++ b/test/backupstore/testbackupstore.cpp
@@ -584,9 +584,9 @@ typedef struct
int objectsNotDel;
int deleted;
int old;
-} recusive_count_objects_results;
+} recursive_count_objects_results;
-void recusive_count_objects_r(BackupProtocolClient &protocol, int64_t id, recusive_count_objects_results &results)
+void recursive_count_objects_r(BackupProtocolClient &protocol, int64_t id, recursive_count_objects_results &results)
{
// Command
std::auto_ptr<BackupProtocolClientSuccess> dirreply(protocol.QueryListDirectory(
@@ -611,12 +611,12 @@ void recusive_count_objects_r(BackupProtocolClient &protocol, int64_t id, recusi
if(en->GetFlags() & BackupStoreDirectory::Entry::Flags_Dir)
{
- recusive_count_objects_r(protocol, en->GetObjectID(), results);
+ recursive_count_objects_r(protocol, en->GetObjectID(), results);
}
}
}
-void recusive_count_objects(const char *hostname, int64_t id, recusive_count_objects_results &results)
+void recursive_count_objects(const char *hostname, int64_t id, recursive_count_objects_results &results)
{
// Context
TLSContext context;
@@ -637,7 +637,7 @@ void recusive_count_objects(const char *hostname, int64_t id, recusive_count_obj
}
// Count objects
- recusive_count_objects_r(protocolReadOnly, id, results);
+ recursive_count_objects_r(protocolReadOnly, id, results);
// Close it
protocolReadOnly.QueryFinished();
@@ -1706,9 +1706,9 @@ int test3(int argc, const char *argv[])
// Test the deletion of objects by the housekeeping system
// First, things as they are now.
- recusive_count_objects_results before = {0,0,0};
+ recursive_count_objects_results before = {0,0,0};
- recusive_count_objects("localhost", BackupProtocolClientListDirectory::RootDirectory, before);
+ recursive_count_objects("localhost", BackupProtocolClientListDirectory::RootDirectory, before);
TEST_THAT(before.objectsNotDel != 0);
TEST_THAT(before.deleted != 0);
@@ -1732,7 +1732,7 @@ int test3(int argc, const char *argv[])
// wait for housekeeping to happen
printf("waiting for housekeeping:\n");
- for(int l = 0; l < 12; ++l)
+ for(int l = 0; l < 30; ++l)
{
::sleep(1);
printf(".");
@@ -1741,9 +1741,11 @@ int test3(int argc, const char *argv[])
printf("\n");
// Count the objects again
- recusive_count_objects_results after = {0,0,0};
- recusive_count_objects("localhost", BackupProtocolClientListDirectory::RootDirectory, after);
-
+ recursive_count_objects_results after = {0,0,0};
+ recursive_count_objects("localhost", BackupProtocolClientListDirectory::RootDirectory, after);
+printf("after.objectsNotDel=%i, deleted=%i, old=%i\n",after.objectsNotDel, after.deleted, after.old);
+
+ // If these tests fail then try increasing the timeout above
TEST_THAT(after.objectsNotDel == before.objectsNotDel);
TEST_THAT(after.deleted == 0);
TEST_THAT(after.old == 0);
diff --git a/test/common/testcommon.cpp b/test/common/testcommon.cpp
index c6d0e52f..b00ee281 100755
--- a/test/common/testcommon.cpp
+++ b/test/common/testcommon.cpp
@@ -397,9 +397,11 @@ int test(int argc, const char *argv[])
TEST_THAT(lock1.TryAndGetLock("testfiles/lock1") == true);
// Try to lock something using the same lock
TEST_CHECK_THROWS(lock1.TryAndGetLock("testfiles/non-exist/lock2"), CommonException, NamedLockAlreadyLockingSomething);
+#ifndef PLATFORM_open_USE_fcntl
// And again on that name
NamedLock lock2;
TEST_THAT(lock2.TryAndGetLock("testfiles/lock1") == false);
+#endif
}
{
// Check that it unlocked when it went out of scope
diff --git a/test/raidfile/intercept.cpp b/test/raidfile/intercept.cpp
index 4f20ba0a..60c0ca1e 100755
--- a/test/raidfile/intercept.cpp
+++ b/test/raidfile/intercept.cpp
@@ -34,7 +34,7 @@
extern "C" off_t
TEST_lseek(int fildes, off_t offset, int whence);
#else
- #ifdef PLATFORM_LINUX
+ #if defined(PLATFORM_LINUX) || defined(PLATFORM_SUNOS)
#undef __syscall
#define __syscall syscall
#else
@@ -51,7 +51,7 @@
bool intercept_enabled = false;
const char *intercept_filename = 0;
int intercept_filedes = -1;
-unsigned int intercept_errorafter = 0;
+off_t intercept_errorafter = 0;
int intercept_errno = 0;
int intercept_syscall = 0;
off_t intercept_filepos = 0;
@@ -97,7 +97,7 @@ bool intercept_errornow(int d, int size, int syscallnum)
return true;
}
// where are we in the file?
- if(intercept_filepos >= intercept_errorafter || intercept_filepos >= ((int)intercept_errorafter - size))
+ if(intercept_filepos >= intercept_errorafter || intercept_filepos >= ((off_t)intercept_errorafter - size))
{
TRACE3("Returning error %d for syscall %d, file pos %d\n", intercept_errno, syscallnum, (int)intercept_filepos);
return true;
@@ -236,9 +236,11 @@ lseek(int fildes, off_t offset, int whence)
#ifdef PLATFORM_DARWIN
int r = TEST_lseek(fildes, offset, whence);
#else
- #ifdef PLATFORM_LINUX
+ #if defined(PLATFORM_LINUX) || defined(PLATFORM_SUNOS)
off_t r = __syscall(SYS_lseek, fildes, offset, whence);
#else
+ // Should swap this condition round. No reason to assume that most OS
+ // do this syscall wierdness, default should be the sensible way
off_t r = __syscall(SYS_lseek, fildes, 0 /* extra 0 required here! */, offset, whence);
#endif
#endif
diff --git a/test/raidfile/testraidfile.cpp b/test/raidfile/testraidfile.cpp
index 13ae9083..9803d44d 100755
--- a/test/raidfile/testraidfile.cpp
+++ b/test/raidfile/testraidfile.cpp
@@ -525,8 +525,10 @@ void test_overwrites()
writeA.Write("TESTTEST", 8);
{
+#ifndef PLATFORM_open_USE_fcntl
RaidFileWrite writeA2(0, "overwrite_A");
TEST_CHECK_THROWS(writeA2.Open(), RaidFileException, FileIsCurrentlyOpenForWriting);
+#endif
}
}