fix bug in recent move_storage patch

This commit is contained in:
Arvid Norberg
2013-05-10 02:18:14 +00:00
parent 982a14c2e9
commit 90a2509d68
2 changed files with 32 additions and 12 deletions

View File

@@ -139,6 +139,15 @@ void on_move_storage(int ret, bool* done, disk_io_job const& j, std::string path
*done = true;
}
void on_move_storage_exist(int ret, bool* done, disk_io_job const& j, std::string path)
{
std::cerr << "on_move_storage_exist ret: " << ret << " path: " << j.str << std::endl;
TEST_EQUAL(ret, piece_manager::file_exist);
TEST_EQUAL(j.str, path);
*done = true;
}
void print_error(int ret, boost::scoped_ptr<storage_interface> const& s)
{
std::cerr << "returned: " << ret
@@ -591,6 +600,15 @@ void run_storage_tests(boost::intrusive_ptr<torrent_info> info
TEST_CHECK(!exists(combine_path(test_path, combine_path("temp_storage2", "temp_storage"))));
TEST_CHECK(!exists(combine_path(test_path, combine_path("temp_storage2", "part0"))));
done = false;
pm->async_move_storage(test_path, fail_if_exist, boost::bind(&on_move_storage_exist, _1, &done, _2, test_path));
run_until(ios, done);
TEST_CHECK(exists(combine_path(test_path, "part0")));
TEST_CHECK(!exists(combine_path(test_path, combine_path("temp_storage2", "temp_storage"))));
TEST_CHECK(!exists(combine_path(test_path, combine_path("temp_storage2", "part0"))));
r.piece = 0;
r.start = 0;
r.length = block_size;