Changeset 922


Ignore:
Timestamp:
01/09/2006 09:45:50 (5 years ago)
Author:
chris
Message:

(refs #3)

Use correct directory separator everywhere

File:
1 edited

Legend:

Unmodified
Added
Removed
  • box/chris/merge/test/backupstore/testbackupstore.cpp

    r921 r922  
    949949                protocol.QuerySetClientStoreMarker(0x8732523ab23aLL); 
    950950 
    951 #ifndef WIN32 
     951#ifndef WIN32 // can't open more than one connection on Win32 
    952952                // Open a new connection which is read only 
    953953                SocketStreamTLS connReadOnly; 
     
    969969                } 
    970970#else // WIN32 
     971                // we can't open a new connection, so fake it 
    971972                BackupProtocolClient& protocolReadOnly(protocol); 
    972973#endif 
     
    15311532                // The test block to a file 
    15321533                { 
    1533                         FileStream f("testfiles/testenc1", O_WRONLY | O_CREAT | O_EXCL); 
     1534                        FileStream f("testfiles" DIRECTORY_SEPARATOR  
     1535                                "testenc1", O_WRONLY | O_CREAT | O_EXCL); 
    15341536                        f.Write(encfile, sizeof(encfile)); 
    15351537                } 
     
    15371539                // Encode it 
    15381540                { 
    1539                         FileStream out("testfiles/testenc1_enc", O_WRONLY | O_CREAT | O_EXCL); 
    1540                         BackupStoreFilenameClear name("testfiles/testenc1"); 
    1541  
    1542                         std::auto_ptr<IOStream> encoded(BackupStoreFile::EncodeFile("testfiles/testenc1", 32, name)); 
     1541                        FileStream out("testfiles" DIRECTORY_SEPARATOR  
     1542                                "testenc1_enc", O_WRONLY | O_CREAT | O_EXCL); 
     1543                        BackupStoreFilenameClear name("testfiles" 
     1544                                DIRECTORY_SEPARATOR "testenc1"); 
     1545 
     1546                        std::auto_ptr<IOStream> encoded( 
     1547                                BackupStoreFile::EncodeFile( 
     1548                                        "testfiles" DIRECTORY_SEPARATOR 
     1549                                        "testenc1", 32, name)); 
    15431550                        encoded->CopyStreamTo(out); 
    15441551                } 
     
    15461553                // Verify it 
    15471554                { 
    1548                         FileStream enc("testfiles/testenc1_enc"); 
     1555                        FileStream enc("testfiles" DIRECTORY_SEPARATOR  
     1556                                "testenc1_enc"); 
    15491557                        TEST_THAT(BackupStoreFile::VerifyEncodedFileFormat(enc) == true); 
    15501558                } 
     
    15521560                // Decode it 
    15531561                { 
    1554                         FileStream enc("testfiles/testenc1_enc"); 
    1555                         BackupStoreFile::DecodeFile(enc, "testfiles/testenc1_orig", IOStream::TimeOutInfinite); 
     1562                        FileStream enc("testfiles" DIRECTORY_SEPARATOR  
     1563                                "testenc1_enc"); 
     1564                        BackupStoreFile::DecodeFile(enc, "testfiles" 
     1565                                DIRECTORY_SEPARATOR "testenc1_orig",  
     1566                                IOStream::TimeOutInfinite); 
    15561567                } 
    15571568                 
    15581569                // Read in rebuilt original, and compare contents 
    15591570                { 
    1560                         TEST_THAT(TestGetFileSize("testfiles/testenc1_orig") == sizeof(encfile)); 
    1561                         FileStream in("testfiles/testenc1_orig"); 
     1571                        TEST_THAT(TestGetFileSize("testfiles"  
     1572                                DIRECTORY_SEPARATOR "testenc1_orig")  
     1573                                == sizeof(encfile)); 
     1574                        FileStream in("testfiles" DIRECTORY_SEPARATOR  
     1575                                "testenc1_orig"); 
    15621576                        int encfile_i[ENCFILE_SIZE]; 
    15631577                        in.Read(encfile_i, sizeof(encfile_i)); 
     
    15671581                // Check how many blocks it had, and test the stream based interface 
    15681582                { 
    1569                         FileStream enc("testfiles/testenc1_enc"); 
     1583                        FileStream enc("testfiles" DIRECTORY_SEPARATOR  
     1584                                "testenc1_enc"); 
    15701585                        std::auto_ptr<BackupStoreFile::DecodedStream> decoded(BackupStoreFile::DecodeFileStream(enc, IOStream::TimeOutInfinite)); 
    15711586                        CollectInBufferStream d; 
     
    15811596                { 
    15821597                        #define FILE_SIZE_JUST_OVER     ((4096*2)+58) 
    1583                         FileStream f("testfiles/testenc2", O_WRONLY | O_CREAT | O_EXCL); 
     1598                        FileStream f("testfiles" DIRECTORY_SEPARATOR  
     1599                                "testenc2", O_WRONLY | O_CREAT | O_EXCL); 
    15841600                        f.Write(encfile + 2, FILE_SIZE_JUST_OVER); 
     1601                        f.Close(); 
    15851602                        BackupStoreFilenameClear name("testenc2"); 
    1586                         std::auto_ptr<IOStream> encoded(BackupStoreFile::EncodeFile("testfiles/testenc2", 32, name)); 
     1603                        std::auto_ptr<IOStream> encoded( 
     1604                                BackupStoreFile::EncodeFile( 
     1605                                        "testfiles" DIRECTORY_SEPARATOR 
     1606                                        "testenc2", 32, name)); 
    15871607                        CollectInBufferStream e; 
    15881608                        encoded->CopyStreamTo(e); 
     
    16001620                // Test that reordered streams work too 
    16011621                { 
    1602                         FileStream enc("testfiles/testenc1_enc"); 
     1622                        FileStream enc("testfiles" DIRECTORY_SEPARATOR  
     1623                                "testenc1_enc"); 
    16031624                        std::auto_ptr<IOStream> reordered(BackupStoreFile::ReorderFileToStreamOrder(&enc, false)); 
    16041625                        std::auto_ptr<BackupStoreFile::DecodedStream> decoded(BackupStoreFile::DecodeFileStream(*reordered, IOStream::TimeOutInfinite)); 
     
    16301651        { 
    16311652                RaidFileWrite::CreateDirectory(0, "test-info"); 
    1632                 BackupStoreInfo::CreateNew(76, "test-info/", 0, 3461231233455433LL, 2934852487LL); 
    1633                 TEST_CHECK_THROWS(BackupStoreInfo::CreateNew(76, "test-info/", 0, 0, 0), RaidFileException, CannotOverwriteExistingFile); 
    1634                 std::auto_ptr<BackupStoreInfo> info(BackupStoreInfo::Load(76, "test-info/", 0, true)); 
     1653                BackupStoreInfo::CreateNew(76, "test-info" DIRECTORY_SEPARATOR,  
     1654                        0, 3461231233455433LL, 2934852487LL); 
     1655                TEST_CHECK_THROWS(BackupStoreInfo::CreateNew(76,  
     1656                        "test-info" DIRECTORY_SEPARATOR, 0, 0, 0),  
     1657                        RaidFileException, CannotOverwriteExistingFile); 
     1658                std::auto_ptr<BackupStoreInfo> info( 
     1659                        BackupStoreInfo::Load(76,  
     1660                                "test-info" DIRECTORY_SEPARATOR, 0, true)); 
    16351661                TEST_CHECK_THROWS(info->Save(), BackupStoreException, StoreInfoIsReadOnly); 
    16361662                TEST_CHECK_THROWS(info->ChangeBlocksUsed(1), BackupStoreException, StoreInfoIsReadOnly); 
     
    16411667        } 
    16421668        { 
    1643                 std::auto_ptr<BackupStoreInfo> info(BackupStoreInfo::Load(76, "test-info/", 0, false)); 
     1669                std::auto_ptr<BackupStoreInfo> info(BackupStoreInfo::Load(76,  
     1670                        "test-info" DIRECTORY_SEPARATOR, 0, false)); 
    16441671                info->ChangeBlocksUsed(8); 
    16451672                info->ChangeBlocksInOldFiles(9); 
     
    16591686        } 
    16601687        { 
    1661                 std::auto_ptr<BackupStoreInfo> info(BackupStoreInfo::Load(76, "test-info/", 0, true)); 
     1688                std::auto_ptr<BackupStoreInfo> info(BackupStoreInfo::Load(76,  
     1689                        "test-info" DIRECTORY_SEPARATOR, 0, true)); 
    16621690                TEST_THAT(info->GetBlocksUsed() == 7); 
    16631691                TEST_THAT(info->GetBlocksInOldFiles() == 5); 
     
    16771705        TLSContext context; 
    16781706        context.Initialise(false /* client */, 
    1679                         "testfiles/clientCerts.pem", 
    1680                         "testfiles/clientPrivKey.pem", 
    1681                         "testfiles/clientTrustedCAs.pem"); 
     1707                        "testfiles" DIRECTORY_SEPARATOR "clientCerts.pem", 
     1708                        "testfiles" DIRECTORY_SEPARATOR "clientPrivKey.pem", 
     1709                        "testfiles" DIRECTORY_SEPARATOR "clientTrustedCAs.pem"); 
    16821710 
    16831711        // First, try logging in without an account having been created... just make sure login fails. 
Note: See TracChangeset for help on using the changeset viewer.