diff --git a/test/setup_transfer.cpp b/test/setup_transfer.cpp index e19ed1886..45986eca0 100644 --- a/test/setup_transfer.cpp +++ b/test/setup_transfer.cpp @@ -493,7 +493,14 @@ void create_random_files(std::string const& path, const int file_sizes[], int nu std::generate(random_data, random_data + 300000, random_byte); char filename[200]; snprintf(filename, sizeof(filename), "test%d", i); - std::string full_path = combine_path(path, filename); + char dirname[200]; + snprintf(dirname, sizeof(dirname), "test_dir%d", i / 5); + + std::string full_path = combine_path(path, dirname); + error_code ec; + create_directory(full_path, ec); + full_path = combine_path(full_path, filename); + int to_write = file_sizes[i]; file f(full_path, file::write_only, ec); if (ec) fprintf(stderr, "failed to create file \"%s\": (%d) %s\n" diff --git a/test/test_checking.cpp b/test/test_checking.cpp index 4031703b2..2edbc615e 100644 --- a/test/test_checking.cpp +++ b/test/test_checking.cpp @@ -114,8 +114,12 @@ void test_checking(bool read_only_files, bool corrupt_files = false) { char name[1024]; snprintf(name, sizeof(name), "test%d", i); - std::string path = combine_path("tmp1_checking", "test_torrent_dir"); + char dirname[200]; + snprintf(dirname, sizeof(dirname), "test_dir%d", i / 5); + + std::string path = combine_path(combine_path("tmp1_checking", "test_torrent_dir"), dirname); path = combine_path(path, name); + #ifdef TORRENT_WINDOWS SetFileAttributesA(path.c_str(), FILE_ATTRIBUTE_READONLY); #else @@ -173,7 +177,10 @@ void test_checking(bool read_only_files, bool corrupt_files = false) { char name[1024]; snprintf(name, sizeof(name), "test%d", i); - std::string path = combine_path("tmp1_checking", "test_torrent_dir"); + char dirname[200]; + snprintf(dirname, sizeof(dirname), "test_dir%d", i / 5); + + std::string path = combine_path(combine_path("tmp1_checking", "test_torrent_dir"), dirname); path = combine_path(path, name); #ifdef TORRENT_WINDOWS SetFileAttributesA(path.c_str(), FILE_ATTRIBUTE_NORMAL);