make tests not depend on exceptions

This commit is contained in:
Arvid Norberg
2008-11-05 03:17:41 +00:00
parent 19660306e0
commit c6b793021d
10 changed files with 88 additions and 65 deletions

View File

@@ -156,19 +156,20 @@ void run_storage_tests(boost::intrusive_ptr<torrent_info> info
, test_path, fp, io, default_storage_constructor, storage_mode);
boost::mutex lock;
error_code ec;
lazy_entry frd;
pm->async_check_fastresume(&frd, &on_check_resume_data);
ios.reset();
ios.run();
ios.run(ec);
pm->async_check_files(&on_check_files);
for (int i = 0; i < 4; ++i)
{
ios.reset();
ios.run_one();
ios.run_one(ec);
}
ios.reset();
ios.poll();
ios.poll(ec);
// test move_storage
boost::function<void(int, disk_io_job const&)> none;
@@ -177,7 +178,7 @@ void run_storage_tests(boost::intrusive_ptr<torrent_info> info
test_sleep(2000);
ios.reset();
ios.poll();
ios.poll(ec);
TEST_CHECK(!exists(test_path / "temp_storage"));
TEST_CHECK(exists(test_path / "temp_storage2/temp_storage"));
@@ -185,7 +186,7 @@ void run_storage_tests(boost::intrusive_ptr<torrent_info> info
test_sleep(2000);
ios.reset();
ios.poll();
ios.poll(ec);
TEST_CHECK(!exists(test_path / "temp_storage2/temp_storage"));
remove_all(test_path / "temp_storage2");
@@ -198,7 +199,7 @@ void run_storage_tests(boost::intrusive_ptr<torrent_info> info
test_sleep(2000);
ios.reset();
ios.poll();
ios.poll(ec);
TEST_CHECK(!exists(test_path / "temp_storage/test1.tmp"));
TEST_CHECK(exists(test_path / "part0"));
@@ -218,7 +219,7 @@ void run_storage_tests(boost::intrusive_ptr<torrent_info> info
test_sleep(1000);
TEST_CHECK(!exists(test_path / "part0"));
ios.run();
ios.run(ec);
io.join();
}
@@ -312,10 +313,11 @@ void test_check_files(path const& test_path
, test_path, fp, io, default_storage_constructor, storage_mode);
boost::mutex lock;
error_code ec;
lazy_entry frd;
pm->async_check_fastresume(&frd, &on_check_resume_data);
ios.reset();
ios.run();
ios.run(ec);
bool pieces[4] = {false, false, false, false};
bool done = false;
@@ -324,7 +326,7 @@ void test_check_files(path const& test_path
while (!done)
{
ios.reset();
ios.run_one();
ios.run_one(ec);
}
TEST_CHECK(pieces[0] == true);
TEST_CHECK(pieces[1] == false);