summaryrefslogtreecommitdiff
path: root/test/MultiFileAllocationIteratorTest.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2007-11-28 14:22:28 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2007-11-28 14:22:28 +0000
commit5a2f398eca68b2b0330ddcec2b222bf76875f82f (patch)
treeeb916885f04126e7e48b56fe02de6b44f0493c17 /test/MultiFileAllocationIteratorTest.cc
parenta022a1826bb573028f264bc6edbc564c0d488bbc (diff)
2007-11-28 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added direct I/O support. The current implementation uses O_DIRECT, which is not posix standard and is tested on linux 2.6.21. Currently only file allocation uses direct I/O. * src/SingleFileAllocationIterator.{h, cc} * test/SingleFileAllocationIteratorTest.cc * src/MultiFileAllocationIterator.{h, cc} * test/MultiFileAllocationIteratorTest.cc * src/BinaryStream.h * src/DiskWriter.h * src/AbstractDiskWriter.{h, cc} * src/ByteArrayDiskWriter.h * src/DiskAdaptor.h * src/AbstractSingleDiskAdaptor.{h, cc} * src/MultiDiskAdaptor.{h, cc} * src/FileAllocationEntry.cc * src/Util.{h, cc} * src/OptionHandlerFactory.cc * src/prefs.h * src/version_usage.cc * src/option_processing.cc Moved FileAllocationMan::markCurrentFileAllocationEntryDone() to handleException. * src/MultiFileAllocationIterator.cc Added EINTR handling * src/SocketCore.cc
Diffstat (limited to 'test/MultiFileAllocationIteratorTest.cc')
-rw-r--r--test/MultiFileAllocationIteratorTest.cc23
1 files changed, 13 insertions, 10 deletions
diff --git a/test/MultiFileAllocationIteratorTest.cc b/test/MultiFileAllocationIteratorTest.cc
index 1ce89acb..9428d84f 100644
--- a/test/MultiFileAllocationIteratorTest.cc
+++ b/test/MultiFileAllocationIteratorTest.cc
@@ -7,7 +7,7 @@ class MultiFileAllocationIteratorTest:public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(MultiFileAllocationIteratorTest);
CPPUNIT_TEST(testAllocate);
- CPPUNIT_TEST(testMakeFileEntries);
+ CPPUNIT_TEST(testMakeDiskWriterEntries);
CPPUNIT_TEST_SUITE_END();
private:
@@ -15,13 +15,13 @@ public:
void setUp() {}
void testAllocate();
- void testMakeFileEntries();
+ void testMakeDiskWriterEntries();
};
CPPUNIT_TEST_SUITE_REGISTRATION( MultiFileAllocationIteratorTest );
-void MultiFileAllocationIteratorTest::testMakeFileEntries()
+void MultiFileAllocationIteratorTest::testMakeDiskWriterEntries()
{
FileEntryHandle fs[] = {
new FileEntry("file1", 1536, 0),
@@ -43,24 +43,27 @@ void MultiFileAllocationIteratorTest::testMakeFileEntries()
fs[8]->setRequested(false);
fs[9]->setRequested(false);
+ string storeDir = "/tmp/aria2_MultiFileAllocationIteratorTest_testMakeDiskWriterEntries";
MultiDiskAdaptorHandle diskAdaptor = new MultiDiskAdaptor();
diskAdaptor->setFileEntries(FileEntries(&fs[0], &fs[10]));
diskAdaptor->setPieceLength(1024);
+ diskAdaptor->setStoreDir(storeDir);
+ diskAdaptor->openFile();
MultiFileAllocationIteratorHandle itr = diskAdaptor->fileAllocationIterator();
- FileEntries entries = itr->getFileEntries();
+ DiskWriterEntries entries = itr->getDiskWriterEntries();
sort(entries.begin(), entries.end());
CPPUNIT_ASSERT_EQUAL((size_t)6, entries.size());
- CPPUNIT_ASSERT_EQUAL(string("file1"), entries[0]->getPath());
- CPPUNIT_ASSERT_EQUAL(string("file2"), entries[1]->getPath());
- CPPUNIT_ASSERT_EQUAL(string("file3"), entries[2]->getPath());
- CPPUNIT_ASSERT_EQUAL(string("file6"), entries[3]->getPath());
- CPPUNIT_ASSERT_EQUAL(string("file7"), entries[4]->getPath());
- CPPUNIT_ASSERT_EQUAL(string("file8"), entries[5]->getPath());
+ CPPUNIT_ASSERT_EQUAL(storeDir+string("/file1"), entries[0]->getFilePath(storeDir));
+ CPPUNIT_ASSERT_EQUAL(storeDir+string("/file2"), entries[1]->getFilePath(storeDir));
+ CPPUNIT_ASSERT_EQUAL(storeDir+string("/file3"), entries[2]->getFilePath(storeDir));
+ CPPUNIT_ASSERT_EQUAL(storeDir+string("/file6"), entries[3]->getFilePath(storeDir));
+ CPPUNIT_ASSERT_EQUAL(storeDir+string("/file7"), entries[4]->getFilePath(storeDir));
+ CPPUNIT_ASSERT_EQUAL(storeDir+string("/file8"), entries[5]->getFilePath(storeDir));
}
void MultiFileAllocationIteratorTest::testAllocate()