[Box Backup-dev] COMMIT r583 - in box/chris/general: . bin/bbstored test/backupstore test/backupstore/testfiles

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Tue May 23 02:24:53 BST 2006


Author: chris
Date: 2006-05-23 01:24:17 +0000 (Tue, 23 May 2006)
New Revision: 583

Modified:
   box/chris/general/bin/bbstored/BBStoreDHousekeeping.cpp
   box/chris/general/bin/bbstored/BackupCommands.cpp
   box/chris/general/bin/bbstored/BackupStoreDaemon.cpp
   box/chris/general/modules.txt
   box/chris/general/test/backupstore/testbackupstore.cpp
   box/chris/general/test/backupstore/testfiles/bbstored.conf
   box/chris/general/test/backupstore/testfiles/bbstored_multi.conf
   box/chris/general/test/backupstore/testfiles/query.conf
   box/chris/general/test/backupstore/testfiles/raidfile.conf
Log:
* modules.txt
- Compile lib/backupstore, bin/bbstored, bin/bbstoreaccounts, test/backupstore 
  on Win32

* bin/bbstored/BackupStoreDaemon.cpp
- Disable housekeeping daemon on Win32 (temporary hack)

* bin/bbstored/BackupCommands.cpp
* bin/bbstored/BBStoreDHousekeeping.cpp
- Don't include syslog.h unless we have one

* test/backupstore/testfiles/bbstored.conf
* test/backupstore/testfiles/query.conf
* test/backupstore/testfiles/bbstored_multi.conf
* test/backupstore/testfiles/raidfile.conf
- Hacked to work on Windows (broken on Unix)

* test/backupstore/testbackupstore.cpp
- Fixed some paths to work on Windows


Modified: box/chris/general/bin/bbstored/BBStoreDHousekeeping.cpp
===================================================================
--- box/chris/general/bin/bbstored/BBStoreDHousekeeping.cpp	2006-05-23 00:31:58 UTC (rev 582)
+++ box/chris/general/bin/bbstored/BBStoreDHousekeeping.cpp	2006-05-23 01:24:17 UTC (rev 583)
@@ -10,7 +10,10 @@
 #include "Box.h"
 
 #include <stdio.h>
+
+#ifdef HAVE_SYSLOG_H
 #include <syslog.h>
+#endif
 
 #include "BackupStoreDaemon.h"
 #include "BackupStoreAccountDatabase.h"

Modified: box/chris/general/bin/bbstored/BackupCommands.cpp
===================================================================
--- box/chris/general/bin/bbstored/BackupCommands.cpp	2006-05-23 00:31:58 UTC (rev 582)
+++ box/chris/general/bin/bbstored/BackupCommands.cpp	2006-05-23 01:24:17 UTC (rev 583)
@@ -9,7 +9,9 @@
 
 #include "Box.h"
 
+#ifdef HAVE_SYSLOG_H
 #include <syslog.h>
+#endif
 
 #include "autogen_BackupProtocolServer.h"
 #include "BackupConstants.h"

Modified: box/chris/general/bin/bbstored/BackupStoreDaemon.cpp
===================================================================
--- box/chris/general/bin/bbstored/BackupStoreDaemon.cpp	2006-05-23 00:31:58 UTC (rev 582)
+++ box/chris/general/bin/bbstored/BackupStoreDaemon.cpp	2006-05-23 01:24:17 UTC (rev 583)
@@ -11,9 +11,12 @@
 
 #include <stdlib.h>
 #include <stdio.h>
-#include <syslog.h>
 #include <signal.h>
 
+#ifdef HAVE_SYSLOG_H
+#include <syslog.h>
+#endif
+
 #include "BackupContext.h"
 #include "BackupStoreDaemon.h"
 #include "BackupStoreConfigVerify.h"
@@ -155,7 +158,8 @@
 	mExtendedLogging = false;
 	const Configuration &config(GetConfiguration());
 	mExtendedLogging = config.GetKeyValueBool("ExtendedLogging");
-	
+
+#ifndef WIN32	
 	// Fork off housekeeping daemon -- must only do this the first time Run() is called
 	if(!mHaveForkedHousekeeping)
 	{
@@ -211,6 +215,7 @@
 			THROW_EXCEPTION(ServerException, SocketCloseError)
 		}
 	}
+#endif // !WIN32
 
 	if(mIsHousekeepingProcess)
 	{

Modified: box/chris/general/modules.txt
===================================================================
--- box/chris/general/modules.txt	2006-05-23 00:31:58 UTC (rev 582)
+++ box/chris/general/modules.txt	2006-05-23 01:24:17 UTC (rev 583)
@@ -25,24 +25,25 @@
 # Backup system
 
 lib/backupclient	lib/server	lib/crypto	lib/compress
+lib/backupstore		lib/server	lib/raidfile	lib/backupclient
 
 OMIT:mingw32
 OMIT:mingw32msvc
 OMIT:CYGWIN
-lib/backupstore		lib/server	lib/raidfile	lib/backupclient
-bin/bbstored		lib/raidfile	lib/server	lib/backupstore	lib/backupclient	lib/win32
-bin/bbstoreaccounts	lib/raidfile	lib/backupstore	lib/win32
 bin/bbackupobjdump	lib/backupclient lib/backupstore	lib/win32
 END-OMIT
 
+bin/bbstored		lib/raidfile	lib/server	lib/backupstore	lib/backupclient	lib/win32
+bin/bbstoreaccounts	lib/raidfile	lib/backupstore	lib/win32
 bin/bbackupd		lib/server	lib/backupclient	lib/win32
 bin/bbackupquery	lib/server	lib/backupclient	lib/win32
 bin/bbackupctl		lib/server	lib/backupclient	lib/win32
 
+test/backupstore	bin/bbstored	bin/bbstoreaccounts lib/server lib/backupstore lib/backupclient lib/raidfile
+
 OMIT:mingw32
 OMIT:mingw32msvc
 OMIT:CYGWIN
-test/backupstore	bin/bbstored	bin/bbstoreaccounts lib/server lib/backupstore lib/backupclient lib/raidfile
 test/backupstorefix	bin/bbstored	bin/bbstoreaccounts	lib/backupstore	lib/raidfile	bin/bbackupquery	bin/bbackupd
 test/backupstorepatch	bin/bbstored	bin/bbstoreaccounts	lib/backupstore	lib/raidfile
 test/backupdiff		lib/backupclient

Modified: box/chris/general/test/backupstore/testbackupstore.cpp
===================================================================
--- box/chris/general/test/backupstore/testbackupstore.cpp	2006-05-23 00:31:58 UTC (rev 582)
+++ box/chris/general/test/backupstore/testbackupstore.cpp	2006-05-23 01:24:17 UTC (rev 583)
@@ -1520,35 +1520,48 @@
 		
 		// The test block to a file
 		{
-			FileStream f("testfiles/testenc1", O_WRONLY | O_CREAT | O_EXCL);
+			FileStream f("testfiles" DIRECTORY_SEPARATOR 
+				"testenc1", O_WRONLY | O_CREAT | O_EXCL);
 			f.Write(encfile, sizeof(encfile));
 		}
 		
 		// Encode it
 		{
-			FileStream out("testfiles/testenc1_enc", O_WRONLY | O_CREAT | O_EXCL);
-			BackupStoreFilenameClear name("testfiles/testenc1");
+			FileStream out("testfiles" DIRECTORY_SEPARATOR 
+				"testenc1_enc", O_WRONLY | O_CREAT | O_EXCL);
+			BackupStoreFilenameClear name("testfiles"
+				DIRECTORY_SEPARATOR "testenc1");
 
-			std::auto_ptr<IOStream> encoded(BackupStoreFile::EncodeFile("testfiles/testenc1", 32, name));
+			std::auto_ptr<IOStream> encoded(
+				BackupStoreFile::EncodeFile(
+					"testfiles" DIRECTORY_SEPARATOR
+					"testenc1", 32, name));
 			encoded->CopyStreamTo(out);
 		}
 		
 		// Verify it
 		{
-			FileStream enc("testfiles/testenc1_enc");
+			FileStream enc("testfiles" DIRECTORY_SEPARATOR 
+				"testenc1_enc");
 			TEST_THAT(BackupStoreFile::VerifyEncodedFileFormat(enc) == true);
 		}
 		
 		// Decode it
 		{
-			FileStream enc("testfiles/testenc1_enc");
-			BackupStoreFile::DecodeFile(enc, "testfiles/testenc1_orig", IOStream::TimeOutInfinite);
+			FileStream enc("testfiles" DIRECTORY_SEPARATOR 
+				"testenc1_enc");
+			BackupStoreFile::DecodeFile(enc, "testfiles"
+				DIRECTORY_SEPARATOR "testenc1_orig", 
+				IOStream::TimeOutInfinite);
 		}
 		
 		// Read in rebuilt original, and compare contents
 		{
-			TEST_THAT(TestGetFileSize("testfiles/testenc1_orig") == sizeof(encfile));
-			FileStream in("testfiles/testenc1_orig");
+			TEST_THAT(TestGetFileSize("testfiles" 
+				DIRECTORY_SEPARATOR "testenc1_orig") 
+				== sizeof(encfile));
+			FileStream in("testfiles" DIRECTORY_SEPARATOR 
+				"testenc1_orig");
 			int encfile_i[ENCFILE_SIZE];
 			in.Read(encfile_i, sizeof(encfile_i));
 			TEST_THAT(memcmp(encfile, encfile_i, sizeof(encfile)) == 0);
@@ -1556,7 +1569,8 @@
 		
 		// Check how many blocks it had, and test the stream based interface
 		{
-			FileStream enc("testfiles/testenc1_enc");
+			FileStream enc("testfiles" DIRECTORY_SEPARATOR 
+				"testenc1_enc");
 			std::auto_ptr<BackupStoreFile::DecodedStream> decoded(BackupStoreFile::DecodeFileStream(enc, IOStream::TimeOutInfinite));
 			CollectInBufferStream d;
 			decoded->CopyStreamTo(d, IOStream::TimeOutInfinite, 971 /* buffer block size */);
@@ -1570,10 +1584,14 @@
 		// Test that the last block in a file, if less than 256 bytes, gets put into the last block
 		{
 			#define FILE_SIZE_JUST_OVER	((4096*2)+58)
-			FileStream f("testfiles/testenc2", O_WRONLY | O_CREAT | O_EXCL);
+			FileStream f("testfiles" DIRECTORY_SEPARATOR 
+				"testenc2", O_WRONLY | O_CREAT | O_EXCL);
 			f.Write(encfile + 2, FILE_SIZE_JUST_OVER);
 			BackupStoreFilenameClear name("testenc2");
-			std::auto_ptr<IOStream> encoded(BackupStoreFile::EncodeFile("testfiles/testenc2", 32, name));
+			std::auto_ptr<IOStream> encoded(
+				BackupStoreFile::EncodeFile(
+					"testfiles" DIRECTORY_SEPARATOR
+					"testenc2", 32, name));
 			CollectInBufferStream e;
 			encoded->CopyStreamTo(e);
 			e.SetForReading();
@@ -1589,7 +1607,8 @@
 		
 		// Test that reordered streams work too
 		{
-			FileStream enc("testfiles/testenc1_enc");
+			FileStream enc("testfiles" DIRECTORY_SEPARATOR 
+				"testenc1_enc");
 			std::auto_ptr<IOStream> reordered(BackupStoreFile::ReorderFileToStreamOrder(&enc, false));
 			std::auto_ptr<BackupStoreFile::DecodedStream> decoded(BackupStoreFile::DecodeFileStream(*reordered, IOStream::TimeOutInfinite));
 			CollectInBufferStream d;
@@ -1600,7 +1619,8 @@
 
 			TEST_THAT(decoded->GetNumBlocks() == 3);
 		}
-		
+
+#ifndef WIN32		
 		// Try out doing this on a symlink
 		{
 			TEST_THAT(::symlink("does/not/exist", "testfiles/testsymlink") == 0);
@@ -1614,6 +1634,7 @@
 			// Decode it
 			BackupStoreFile::DecodeFile(b, "testfiles/testsymlink_2", IOStream::TimeOutInfinite);
 		}
+#endif
 	}
 
 	// Store info
@@ -1666,9 +1687,9 @@
 	// Context
 	TLSContext context;
 	context.Initialise(false /* client */,
-			"testfiles/clientCerts.pem",
-			"testfiles/clientPrivKey.pem",
-			"testfiles/clientTrustedCAs.pem");
+			"testfiles" DIRECTORY_SEPARATOR "clientCerts.pem",
+			"testfiles" DIRECTORY_SEPARATOR "clientPrivKey.pem",
+			"testfiles" DIRECTORY_SEPARATOR "clientTrustedCAs.pem");
 
 	// First, try logging in without an account having been created... just make sure login fails.
 	int pid = LaunchServer("../../bin/bbstored/bbstored testfiles/bbstored.conf", "testfiles/bbstored.pid");
@@ -1865,7 +1886,11 @@
 
 	// Use the setup crypto command to set up all these keys, so that the bbackupquery command can be used
 	// for seeing what's going on.
+#ifdef WIN32
+	BackupClientCryptoKeys_Setup("testfiles\\bbackupd.keys");	
+#else
 	BackupClientCryptoKeys_Setup("testfiles/bbackupd.keys");	
+#endif
 	
 	// encode in some filenames -- can't do static initialisation because the key won't be set up when these are initialised
 	for(unsigned int l = 0; l < sizeof(ens_filenames) / sizeof(ens_filenames[0]); ++l)

Modified: box/chris/general/test/backupstore/testfiles/bbstored.conf
===================================================================
--- box/chris/general/test/backupstore/testfiles/bbstored.conf	2006-05-23 00:31:58 UTC (rev 582)
+++ box/chris/general/test/backupstore/testfiles/bbstored.conf	2006-05-23 01:24:17 UTC (rev 583)
@@ -1,6 +1,6 @@
 
-RaidFileConf = testfiles/raidfile.conf
-AccountDatabase = testfiles/accounts.txt
+RaidFileConf = testfiles\raidfile.conf
+AccountDatabase = testfiles\accounts.txt
 
 ExtendedLogging = yes
 
@@ -8,10 +8,10 @@
 
 Server
 {
-	PidFile = testfiles/bbstored.pid
+	PidFile = testfiles\bbstored.pid
 	ListenAddresses = inet:localhost
-	CertificateFile = testfiles/serverCerts.pem
-	PrivateKeyFile = testfiles/serverPrivKey.pem
-	TrustedCAsFile = testfiles/serverTrustedCAs.pem
+	CertificateFile = testfiles\serverCerts.pem
+	PrivateKeyFile = testfiles\serverPrivKey.pem
+	TrustedCAsFile = testfiles\serverTrustedCAs.pem
 }
 

Modified: box/chris/general/test/backupstore/testfiles/bbstored_multi.conf
===================================================================
--- box/chris/general/test/backupstore/testfiles/bbstored_multi.conf	2006-05-23 00:31:58 UTC (rev 582)
+++ box/chris/general/test/backupstore/testfiles/bbstored_multi.conf	2006-05-23 01:24:17 UTC (rev 583)
@@ -1,16 +1,16 @@
 
-RaidFileConf = testfiles/raidfile.conf
-AccountDatabase = testfiles/accounts.txt
+RaidFileConf = testfiles\raidfile.conf
+AccountDatabase = testfiles\accounts.txt
 
 TimeBetweenHousekeeping = 5
 
 Server
 {
-	PidFile = testfiles/bbstored.pid
+	PidFile = testfiles\bbstored.pid
 	# 0.0.0.0 is the 'any' address, allowing connections from things other than localhost
 	ListenAddresses = inet:0.0.0.0
-	CertificateFile = testfiles/serverCerts.pem
-	PrivateKeyFile = testfiles/serverPrivKey.pem
-	TrustedCAsFile = testfiles/serverTrustedCAs.pem
+	CertificateFile = testfiles\serverCerts.pem
+	PrivateKeyFile = testfiles\serverPrivKey.pem
+	TrustedCAsFile = testfiles\serverTrustedCAs.pem
 }
 

Modified: box/chris/general/test/backupstore/testfiles/query.conf
===================================================================
--- box/chris/general/test/backupstore/testfiles/query.conf	2006-05-23 00:31:58 UTC (rev 582)
+++ box/chris/general/test/backupstore/testfiles/query.conf	2006-05-23 01:24:17 UTC (rev 583)
@@ -2,13 +2,13 @@
 # this is a dummy config file so that bbackupquery can be used
 
 
-CertificateFile = testfiles/clientCerts.pem
-PrivateKeyFile = testfiles/clientPrivKey.pem
-TrustedCAsFile = testfiles/clientTrustedCAs.pem
+CertificateFile = testfiles\clientCerts.pem
+PrivateKeyFile = testfiles\clientPrivKey.pem
+TrustedCAsFile = testfiles\clientTrustedCAs.pem
 
-KeysFile = testfiles/bbackupd.keys
+KeysFile = testfiles\bbackupd.keys
 
-DataDirectory = testfiles/bbackupd-data
+DataDirectory = testfiles\bbackupd-data
 
 StoreHostname = localhost
 AccountNumber = 0x01234567
@@ -20,7 +20,7 @@
 
 Server
 {
-	PidFile = testfiles/bbackupd.pid
+	PidFile = testfiles\bbackupd.pid
 }
 
 # this is just a dummy entry
@@ -28,7 +28,7 @@
 {
 	test_delete
 	{
-		Path = testfiles/test_delete
+		Path = testfiles\test_delete
 	}
 }
 

Modified: box/chris/general/test/backupstore/testfiles/raidfile.conf
===================================================================
--- box/chris/general/test/backupstore/testfiles/raidfile.conf	2006-05-23 00:31:58 UTC (rev 582)
+++ box/chris/general/test/backupstore/testfiles/raidfile.conf	2006-05-23 01:24:17 UTC (rev 583)
@@ -3,8 +3,8 @@
 {
 	SetNumber = 0
 	BlockSize = 2048
-	Dir0 = testfiles/0_0
-	Dir1 = testfiles/0_1
-	Dir2 = testfiles/0_2
+	Dir0 = testfiles\0_0
+	Dir1 = testfiles\0_1
+	Dir2 = testfiles\0_2
 }
 




More information about the Boxbackup-dev mailing list