isolate test directory

This commit is contained in:
Scott E. Graves 2024-07-16 09:46:13 -05:00
parent 7eb793f577
commit bd2dd4035e
3 changed files with 80 additions and 79 deletions

View File

@ -77,10 +77,13 @@ endforeach
endfunction endfunction
eventlib eventlib
fext fext
fgetattr
flac_version flac_version
flarge flarge
fontconfig_version fontconfig_version
freetype2_version freetype2_version
fsetattr_x
getxtimes
glapi glapi
gmock gmock
googletest googletest

View File

@ -44,10 +44,11 @@ using namespace repertory::remote_fuse;
#endif #endif
namespace fuse_test { namespace fuse_test {
static std::string mount_location_; static std::string mount_location_;
static std::string fuse_remote_dir =
utils::path::combine(get_test_dir(), {"fuse_remote_test"});
static void access_test(repertory::remote_fuse::remote_client &client) { static void access_test(repertory::remote_fuse::remote_client &client) {
const auto test_file = const auto test_file = utils::path::combine(fuse_remote_dir, {"access.txt"});
utils::path::absolute("./fuse_remote/fuse_remote_access.txt");
const auto api_path = test_file.substr(mount_location_.size()); const auto api_path = test_file.substr(mount_location_.size());
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));
@ -65,8 +66,7 @@ static void access_test(repertory::remote_fuse::remote_client &client) {
} }
static void chflags_test(repertory::remote_fuse::remote_client &client) { static void chflags_test(repertory::remote_fuse::remote_client &client) {
const auto test_file = const auto test_file = utils::path::combine(fuse_remote_dir, {"chflags.txt"});
utils::path::absolute("./fuse_remote/fuse_remote_chflags.txt");
const auto api_path = test_file.substr(mount_location_.size()); const auto api_path = test_file.substr(mount_location_.size());
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));
@ -88,8 +88,7 @@ static void chflags_test(repertory::remote_fuse::remote_client &client) {
} }
static void chmod_test(repertory::remote_fuse::remote_client &client) { static void chmod_test(repertory::remote_fuse::remote_client &client) {
const auto test_file = const auto test_file = utils::path::combine(fuse_remote_dir, {"chmod.txt"});
utils::path::absolute("./fuse_remote/fuse_remote_chmod.txt");
const auto api_path = test_file.substr(mount_location_.size()); const auto api_path = test_file.substr(mount_location_.size());
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));
@ -111,8 +110,7 @@ static void chmod_test(repertory::remote_fuse::remote_client &client) {
} }
static void chown_test(repertory::remote_fuse::remote_client &client) { static void chown_test(repertory::remote_fuse::remote_client &client) {
const auto test_file = const auto test_file = utils::path::combine(fuse_remote_dir, {"chown.txt"});
utils::path::absolute("./fuse_remote/fuse_remote_chown.txt");
const auto api_path = test_file.substr(mount_location_.size()); const auto api_path = test_file.substr(mount_location_.size());
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));
@ -141,7 +139,7 @@ static void
create_and_release_test(repertory::remote_fuse::remote_client &client, create_and_release_test(repertory::remote_fuse::remote_client &client,
remote_server &server) { remote_server &server) {
const auto test_file = const auto test_file =
utils::path::absolute("./fuse_remote/fuse_remote_create_release.txt"); utils::path::combine(fuse_remote_dir, {"create_and_release.txt"});
const auto api_path = test_file.substr(mount_location_.size()); const auto api_path = test_file.substr(mount_location_.size());
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));
@ -164,9 +162,9 @@ static void destroy_test(repertory::remote_fuse::remote_client &client) {
} }
/*static void fallocate_test(repertory::remote_fuse::remote_client &client) { /*static void fallocate_test(repertory::remote_fuse::remote_client &client) {
const auto test_file = const auto test_file = utils::path::combine(fuse_remote_dir,
utils::path::absolute("./fuse_remote/fuse_remote_fallocate.txt"); const auto {"fallocate.txt"}); const auto api_path =
api_path = test_file.substr(mount_location_.size()); test_file.substr(mount_location_.size());
utils::file::retry_delete_file(test_file); utils::file::retry_delete_file(test_file);
remote::file_handle handle; remote::file_handle handle;
@ -186,7 +184,7 @@ remote::open_flags::ReadWrite, handle); EXPECT_EQ(0, ret); if (ret == 0) {
static void fgetattr_test(repertory::remote_fuse::remote_client &client) { static void fgetattr_test(repertory::remote_fuse::remote_client &client) {
const auto test_file = const auto test_file =
utils::path::absolute("./fuse_remote/fuse_remote_fgetattr.txt"); utils::path::combine(fuse_remote_dir, {"fgetattr.txt"});
const auto api_path = test_file.substr(mount_location_.size()); const auto api_path = test_file.substr(mount_location_.size());
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));
@ -233,7 +231,7 @@ static void fgetattr_test(repertory::remote_fuse::remote_client &client) {
static void fsetattr_x_test(repertory::remote_fuse::remote_client &client) { static void fsetattr_x_test(repertory::remote_fuse::remote_client &client) {
const auto test_file = const auto test_file =
utils::path::absolute("./fuse_remote/fuse_remote_fsetattr_x.txt"); utils::path::combine(fuse_remote_dir, {"fsetattr_x.txt"});
const auto api_path = test_file.substr(mount_location_.size()); const auto api_path = test_file.substr(mount_location_.size());
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));
@ -257,8 +255,7 @@ static void fsetattr_x_test(repertory::remote_fuse::remote_client &client) {
} }
static void fsync_test(repertory::remote_fuse::remote_client &client) { static void fsync_test(repertory::remote_fuse::remote_client &client) {
const auto test_file = const auto test_file = utils::path::combine(fuse_remote_dir, {"fsync.txt"});
utils::path::absolute("./fuse_remote/fuse_remote_fsync.txt");
const auto api_path = test_file.substr(mount_location_.size()); const auto api_path = test_file.substr(mount_location_.size());
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));
@ -277,7 +274,7 @@ static void fsync_test(repertory::remote_fuse::remote_client &client) {
static void ftruncate_test(repertory::remote_fuse::remote_client &client) { static void ftruncate_test(repertory::remote_fuse::remote_client &client) {
const auto test_file = const auto test_file =
utils::path::absolute("./fuse_remote/fuse_remote_ftruncate.txt"); utils::path::combine(fuse_remote_dir, {"ftruncate.txt"});
const auto api_path = test_file.substr(mount_location_.size()); const auto api_path = test_file.substr(mount_location_.size());
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));
@ -299,8 +296,7 @@ static void ftruncate_test(repertory::remote_fuse::remote_client &client) {
} }
static void getattr_test(repertory::remote_fuse::remote_client &client) { static void getattr_test(repertory::remote_fuse::remote_client &client) {
const auto test_file = const auto test_file = utils::path::combine(fuse_remote_dir, {"getattr.txt"});
utils::path::absolute("./fuse_remote/fuse_remote_getattr.txt");
const auto api_path = test_file.substr(mount_location_.size()); const auto api_path = test_file.substr(mount_location_.size());
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));
@ -345,9 +341,9 @@ static void getattr_test(repertory::remote_fuse::remote_client &client) {
} }
/*static void getxattr_test(repertory::remote_fuse::remote_client &client) { /*static void getxattr_test(repertory::remote_fuse::remote_client &client) {
const auto test_file = const auto test_file = utils::path::combine(fuse_remote_dir,
utils::path::absolute("./fuse_remote/fuse_remote_getxattr.txt"); const auto {"getxattr.txt"}); const auto api_path =
api_path = test_file.substr(mount_location_.size()); test_file.substr(mount_location_.size());
utils::file::retry_delete_file(test_file); utils::file::retry_delete_file(test_file);
remote::file_handle handle; remote::file_handle handle;
@ -365,9 +361,9 @@ nullptr, 0)); #else EXPECT_EQ(-EACCES, client.fuse_getxattr(api_path.c_str(),
} }
static void getxattr_osx_test(repertory::remote_fuse::remote_client &client) { static void getxattr_osx_test(repertory::remote_fuse::remote_client &client) {
const auto test_file = const auto test_file = utils::path::combine(fuse_remote_dir,
utils::path::absolute("./fuse_remote/fuse_remote_getxattr_osx.txt"); const auto {"getxattr_osx.txt"}); const auto api_path =
api_path = test_file.substr(mount_location_.size()); test_file.substr(mount_location_.size());
utils::file::retry_delete_file(test_file); utils::file::retry_delete_file(test_file);
remote::file_handle handle; remote::file_handle handle;
@ -384,7 +380,7 @@ remote::open_flags::ReadWrite, handle); EXPECT_EQ(0, ret); if (ret == 0) {
static void getxtimes_test(repertory::remote_fuse::remote_client &client) { static void getxtimes_test(repertory::remote_fuse::remote_client &client) {
const auto test_file = const auto test_file =
utils::path::absolute("./fuse_remote/fuse_remote_getxtimes.txt"); utils::path::combine(fuse_remote_dir, {"getxtimes.txt"});
const auto api_path = test_file.substr(mount_location_.size()); const auto api_path = test_file.substr(mount_location_.size());
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));
@ -413,9 +409,9 @@ static void init_test(repertory::remote_fuse::remote_client &client) {
} }
/*static void listxattr_test(repertory::remote_fuse::remote_client &client) { /*static void listxattr_test(repertory::remote_fuse::remote_client &client) {
const auto test_file = const auto test_file = utils::path::combine(fuse_remote_dir,
utils::path::absolute("./fuse_remote/fuse_remote_listxattr.txt"); const auto {"listxattr.txt"}); const auto api_path =
api_path = test_file.substr(mount_location_.size()); test_file.substr(mount_location_.size());
utils::file::retry_delete_file(test_file); utils::file::retry_delete_file(test_file);
remote::file_handle handle; remote::file_handle handle;
@ -434,7 +430,7 @@ remote::open_flags::ReadWrite, handle); EXPECT_EQ(0, ret); if (ret == 0) {
static void mkdir_test(repertory::remote_fuse::remote_client &client) { static void mkdir_test(repertory::remote_fuse::remote_client &client) {
const auto test_directory = const auto test_directory =
utils::path::absolute("./fuse_remote/fuse_remote_mkdir"); utils::path::combine(fuse_remote_dir, {"mkdir_test"});
const auto api_path = test_directory.substr(mount_location_.size()); const auto api_path = test_directory.substr(mount_location_.size());
EXPECT_TRUE(utils::file::delete_directory(test_directory)); EXPECT_TRUE(utils::file::delete_directory(test_directory));
@ -449,8 +445,7 @@ static void mkdir_test(repertory::remote_fuse::remote_client &client) {
} }
static void open_test(repertory::remote_fuse::remote_client &client) { static void open_test(repertory::remote_fuse::remote_client &client) {
const auto test_file = const auto test_file = utils::path::combine(fuse_remote_dir, {"open.txt"});
utils::path::absolute("./fuse_remote/fuse_remote_open.txt");
const auto api_path = test_file.substr(mount_location_.size()); const auto api_path = test_file.substr(mount_location_.size());
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));
@ -480,7 +475,7 @@ static void open_test(repertory::remote_fuse::remote_client &client) {
static void static void
opendir_and_releasedir_test(repertory::remote_fuse::remote_client &client) { opendir_and_releasedir_test(repertory::remote_fuse::remote_client &client) {
const auto test_directory = const auto test_directory =
utils::path::absolute("./fuse_remote/fuse_remote_opendir"); utils::path::combine(fuse_remote_dir, {"opendir_and_release_dir"});
const auto api_path = test_directory.substr(mount_location_.size()); const auto api_path = test_directory.substr(mount_location_.size());
EXPECT_TRUE(utils::file::delete_directory(test_directory)); EXPECT_TRUE(utils::file::delete_directory(test_directory));
@ -500,7 +495,7 @@ opendir_and_releasedir_test(repertory::remote_fuse::remote_client &client) {
static void read_and_write_test(repertory::remote_fuse::remote_client &client) { static void read_and_write_test(repertory::remote_fuse::remote_client &client) {
const auto test_file = const auto test_file =
utils::path::absolute("./fuse_remote/fuse_remote_read_write.txt"); utils::path::combine(fuse_remote_dir, {"read_and_write.txt"});
const auto api_path = test_file.substr(mount_location_.size()); const auto api_path = test_file.substr(mount_location_.size());
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));
@ -525,7 +520,7 @@ static void read_and_write_test(repertory::remote_fuse::remote_client &client) {
static void static void
read_and_write_base64_test(repertory::remote_fuse::remote_client &client) { read_and_write_base64_test(repertory::remote_fuse::remote_client &client) {
const auto test_file = const auto test_file =
utils::path::absolute("./fuse_remote/fuse_remote_read_write_base64.txt"); utils::path::combine(fuse_remote_dir, {"read_and_write_base64.txt"});
const auto api_path = test_file.substr(mount_location_.size()); const auto api_path = test_file.substr(mount_location_.size());
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));
@ -550,7 +545,7 @@ read_and_write_base64_test(repertory::remote_fuse::remote_client &client) {
static void readdir_test(repertory::remote_fuse::remote_client &client) { static void readdir_test(repertory::remote_fuse::remote_client &client) {
const auto test_directory = const auto test_directory =
utils::path::absolute("./fuse_remote/fuse_remote_readdir"); utils::path::combine(fuse_remote_dir, {"readdir_test"});
const auto api_path = test_directory.substr(mount_location_.size()); const auto api_path = test_directory.substr(mount_location_.size());
EXPECT_TRUE(utils::file::delete_directory(test_directory)); EXPECT_TRUE(utils::file::delete_directory(test_directory));
@ -577,9 +572,9 @@ static void readdir_test(repertory::remote_fuse::remote_client &client) {
} }
/*static void removexattr_test(repertory::remote_fuse::remote_client &client) { /*static void removexattr_test(repertory::remote_fuse::remote_client &client) {
const auto test_file = const auto test_file = utils::path::combine(fuse_remote_dir,
utils::path::absolute("./fuse_remote/fuse_remote_removexattr.txt"); const auto {"removexattr.txt"}); const auto api_path =
api_path = test_file.substr(mount_location_.size()); test_file.substr(mount_location_.size());
utils::file::retry_delete_file(test_file); utils::file::retry_delete_file(test_file);
remote::file_handle handle; remote::file_handle handle;
@ -597,10 +592,9 @@ remote::open_flags::ReadWrite, handle); EXPECT_EQ(0, ret); if (ret == 0) {
}*/ }*/
static void rename_test(repertory::remote_fuse::remote_client &client) { static void rename_test(repertory::remote_fuse::remote_client &client) {
const auto test_file = const auto test_file = utils::path::combine(fuse_remote_dir, {"rename.txt"});
utils::path::absolute("./fuse_remote/fuse_remote_rename.txt");
const auto renamed_test_file = const auto renamed_test_file =
utils::path::absolute("./fuse_remote/fuse_remote_rename2.txt"); utils::path::combine(fuse_remote_dir, {"rename,.txt"});
const auto api_path = test_file.substr(mount_location_.size()); const auto api_path = test_file.substr(mount_location_.size());
const auto renamed_api_path = const auto renamed_api_path =
renamed_test_file.substr(mount_location_.size()); renamed_test_file.substr(mount_location_.size());
@ -633,7 +627,7 @@ static void rename_test(repertory::remote_fuse::remote_client &client) {
static void rmdir_test(repertory::remote_fuse::remote_client &client) { static void rmdir_test(repertory::remote_fuse::remote_client &client) {
const auto test_directory = const auto test_directory =
utils::path::absolute("./fuse_remote/fuse_remote_rmdir"); utils::path::combine(fuse_remote_dir, {"rmdir_test"});
const auto api_path = test_directory.substr(mount_location_.size()); const auto api_path = test_directory.substr(mount_location_.size());
EXPECT_TRUE(utils::file::delete_directory(test_directory)); EXPECT_TRUE(utils::file::delete_directory(test_directory));
@ -652,7 +646,7 @@ static void rmdir_test(repertory::remote_fuse::remote_client &client) {
static void setattr_x_test(repertory::remote_fuse::remote_client &client) { static void setattr_x_test(repertory::remote_fuse::remote_client &client) {
const auto test_file = const auto test_file =
utils::path::absolute("./fuse_remote/fuse_remote_setattr_x.txt"); utils::path::combine(fuse_remote_dir, {"setattr_x.txt"});
const auto api_path = test_file.substr(mount_location_.size()); const auto api_path = test_file.substr(mount_location_.size());
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));
@ -677,7 +671,7 @@ static void setattr_x_test(repertory::remote_fuse::remote_client &client) {
static void setbkuptime_test(repertory::remote_fuse::remote_client &client) { static void setbkuptime_test(repertory::remote_fuse::remote_client &client) {
const auto test_file = const auto test_file =
utils::path::absolute("./fuse_remote/fuse_remote_setbkuptime.txt"); utils::path::combine(fuse_remote_dir, {"setbkuptime.txt"});
const auto api_path = test_file.substr(mount_location_.size()); const auto api_path = test_file.substr(mount_location_.size());
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));
@ -702,7 +696,7 @@ static void setbkuptime_test(repertory::remote_fuse::remote_client &client) {
static void setchgtime_test(repertory::remote_fuse::remote_client &client) { static void setchgtime_test(repertory::remote_fuse::remote_client &client) {
const auto test_file = const auto test_file =
utils::path::absolute("./fuse_remote/fuse_remote_setchgtime.txt"); utils::path::combine(fuse_remote_dir, {"setchgtime.txt"});
const auto api_path = test_file.substr(mount_location_.size()); const auto api_path = test_file.substr(mount_location_.size());
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));
@ -727,7 +721,7 @@ static void setchgtime_test(repertory::remote_fuse::remote_client &client) {
static void setcrtime_test(repertory::remote_fuse::remote_client &client) { static void setcrtime_test(repertory::remote_fuse::remote_client &client) {
const auto test_file = const auto test_file =
utils::path::absolute("./fuse_remote/fuse_remote_setcrtime.txt"); utils::path::combine(fuse_remote_dir, {"setcrtime.txt"});
const auto api_path = test_file.substr(mount_location_.size()); const auto api_path = test_file.substr(mount_location_.size());
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));
@ -755,9 +749,9 @@ static void setvolname_test(repertory::remote_fuse::remote_client &client) {
} }
/*static void setxattr_test(repertory::remote_fuse::remote_client &client) { /*static void setxattr_test(repertory::remote_fuse::remote_client &client) {
const auto test_file = const auto test_file = utils::path::combine(fuse_remote_dir,
utils::path::absolute("./fuse_remote/fuse_remote_setxattr.txt"); const auto {"setxattr.txt"}); const auto api_path =
api_path = test_file.substr(mount_location_.size()); test_file.substr(mount_location_.size());
utils::file::retry_delete_file(test_file); utils::file::retry_delete_file(test_file);
remote::file_handle handle; remote::file_handle handle;
@ -777,9 +771,9 @@ remote::open_flags::ReadWrite, handle); EXPECT_EQ(0, ret); if (ret == 0) {
} }
static void setxattr_osx_test(repertory::remote_fuse::remote_client &client) { static void setxattr_osx_test(repertory::remote_fuse::remote_client &client) {
const auto test_file = const auto test_file = utils::path::combine(fuse_remote_dir,
utils::path::absolute("./fuse_remote/fuse_remote_setxattr_osx.txt"); const auto {"setxattr_osx.txt"}); const auto api_path =
api_path = test_file.substr(mount_location_.size()); test_file.substr(mount_location_.size());
utils::file::retry_delete_file(test_file); utils::file::retry_delete_file(test_file);
remote::file_handle handle; remote::file_handle handle;
@ -803,8 +797,7 @@ static void test_statfs(repertory::remote_fuse::remote_client &client,
static void test_statfs(repertory::remote_fuse::remote_client &client, static void test_statfs(repertory::remote_fuse::remote_client &client,
const i_fuse_drive &drive) { const i_fuse_drive &drive) {
#endif #endif
const auto test_file = utils::path::absolute("./fuse_remote/"); const auto api_path = fuse_remote_dir.substr(mount_location_.size());
const auto api_path = test_file.substr(mount_location_.size());
remote::statfs st{}; remote::statfs st{};
EXPECT_EQ(0, client.fuse_statfs(api_path.c_str(), 4096, st)); EXPECT_EQ(0, client.fuse_statfs(api_path.c_str(), 4096, st));
@ -831,8 +824,7 @@ static void statfs_x_test(repertory::remote_fuse::remote_client &client,
static void statfs_x_test(repertory::remote_fuse::remote_client &client, static void statfs_x_test(repertory::remote_fuse::remote_client &client,
const i_fuse_drive &drive) { const i_fuse_drive &drive) {
#endif #endif
const auto test_file = utils::path::absolute("./fuse_remote/"); const auto api_path = fuse_remote_dir.substr(mount_location_.size());
const auto api_path = test_file.substr(mount_location_.size());
remote::statfs_x st{}; remote::statfs_x st{};
EXPECT_EQ(0, client.fuse_statfs_x(api_path.c_str(), 4096, st)); EXPECT_EQ(0, client.fuse_statfs_x(api_path.c_str(), 4096, st));
@ -855,7 +847,7 @@ static void statfs_x_test(repertory::remote_fuse::remote_client &client,
static void truncate_test(repertory::remote_fuse::remote_client &client) { static void truncate_test(repertory::remote_fuse::remote_client &client) {
const auto test_file = const auto test_file =
utils::path::absolute("./fuse_remote/fuse_remote_truncate.txt"); utils::path::combine(fuse_remote_dir, {"truncate.txt"});
const auto api_path = test_file.substr(mount_location_.size()); const auto api_path = test_file.substr(mount_location_.size());
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));
@ -884,8 +876,7 @@ static void truncate_test(repertory::remote_fuse::remote_client &client) {
} }
static void unlink_test(repertory::remote_fuse::remote_client &client) { static void unlink_test(repertory::remote_fuse::remote_client &client) {
const auto test_file = const auto test_file = utils::path::combine(fuse_remote_dir, {"unlink.txt"});
utils::path::absolute("./fuse_remote/fuse_remote_unlink.txt");
const auto api_path = test_file.substr(mount_location_.size()); const auto api_path = test_file.substr(mount_location_.size());
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));
@ -904,8 +895,7 @@ static void unlink_test(repertory::remote_fuse::remote_client &client) {
} }
static void utimens_test(repertory::remote_fuse::remote_client &client) { static void utimens_test(repertory::remote_fuse::remote_client &client) {
const auto test_file = const auto test_file = utils::path::combine(fuse_remote_dir, {"utimens.txt"});
utils::path::absolute("./fuse_remote/fuse_remote_utimens.txt");
const auto api_path = test_file.substr(mount_location_.size()); const auto api_path = test_file.substr(mount_location_.size());
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));

View File

@ -39,9 +39,12 @@ using namespace repertory::remote_winfsp;
namespace winfsp_test { namespace winfsp_test {
static std::string mount_location_; static std::string mount_location_;
static std::string win_remote_dir =
utils::path::combine(get_test_dir(), {"win_remote_test"});
static void can_delete_test(remote_client &client) { static void can_delete_test(remote_client &client) {
const auto test_file = utils::path::absolute("./win_remote/candelete.txt"); const auto test_file =
utils::path::combine(win_remote_dir, {"candelete.txt"});
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));
auto api_path = auto api_path =
utils::string::from_utf8(test_file).substr(mount_location_.size()); utils::string::from_utf8(test_file).substr(mount_location_.size());
@ -61,7 +64,7 @@ static void can_delete_test(remote_client &client) {
template <typename t> template <typename t>
static void create_and_close_test(remote_client &client, t &server) { static void create_and_close_test(remote_client &client, t &server) {
const auto test_file = utils::path::absolute("./win_remote/create.txt"); const auto test_file = utils::path::combine(win_remote_dir, {"create.txt"});
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));
auto api_path = auto api_path =
utils::string::from_utf8(test_file).substr(mount_location_.size()); utils::string::from_utf8(test_file).substr(mount_location_.size());
@ -84,7 +87,7 @@ static void create_and_close_test(remote_client &client, t &server) {
} }
static void cleanup_test(remote_client &client) { static void cleanup_test(remote_client &client) {
const auto test_file = utils::path::absolute("./win_remote/cleanup.txt"); const auto test_file = utils::path::combine(win_remote_dir, {"cleanup.txt"});
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));
auto api_path = auto api_path =
utils::string::from_utf8(test_file).substr(mount_location_.size()); utils::string::from_utf8(test_file).substr(mount_location_.size());
@ -108,7 +111,7 @@ static void cleanup_test(remote_client &client) {
} }
static void flush_test(remote_client &client) { static void flush_test(remote_client &client) {
const auto test_file = utils::path::absolute("./win_remote/flush.txt"); const auto test_file = utils::path::combine(win_remote_dir, {"flush.txt"});
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));
auto api_path = auto api_path =
utils::string::from_utf8(test_file).substr(mount_location_.size()); utils::string::from_utf8(test_file).substr(mount_location_.size());
@ -130,7 +133,8 @@ static void flush_test(remote_client &client) {
} }
static void get_file_info_test(remote_client &client) { static void get_file_info_test(remote_client &client) {
const auto test_file = utils::path::absolute("./win_remote/getfileinfo.txt"); const auto test_file =
utils::path::combine(win_remote_dir, {"get_file_info.txt"});
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));
auto api_path = auto api_path =
utils::string::from_utf8(test_file).substr(mount_location_.size()); utils::string::from_utf8(test_file).substr(mount_location_.size());
@ -153,7 +157,7 @@ static void get_file_info_test(remote_client &client) {
static void get_security_by_name_test(remote_client &client) { static void get_security_by_name_test(remote_client &client) {
const auto test_file = const auto test_file =
utils::path::absolute("./win_remote/getsecuritybyname.txt"); utils::path::combine(win_remote_dir, {"get_security_by_name.txt"});
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));
auto api_path = auto api_path =
utils::string::from_utf8(test_file).substr(mount_location_.size()); utils::string::from_utf8(test_file).substr(mount_location_.size());
@ -197,7 +201,7 @@ static void mounted_test(remote_client &client) {
} }
static void open_test(remote_client &client) { static void open_test(remote_client &client) {
const auto test_file = utils::path::absolute("./win_remote/open.txt"); const auto test_file = utils::path::combine(win_remote_dir, {"open.txt"});
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));
auto api_path = auto api_path =
utils::string::from_utf8(test_file).substr(mount_location_.size()); utils::string::from_utf8(test_file).substr(mount_location_.size());
@ -229,7 +233,8 @@ static void open_test(remote_client &client) {
} }
static void overwrite_test(remote_client &client) { static void overwrite_test(remote_client &client) {
const auto test_file = utils::path::absolute("./win_remote/overwrite.txt"); const auto test_file =
utils::path::combine(win_remote_dir, {"overwrite.txt"});
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));
auto api_path = auto api_path =
utils::string::from_utf8(test_file).substr(mount_location_.size()); utils::string::from_utf8(test_file).substr(mount_location_.size());
@ -259,7 +264,7 @@ static void overwrite_test(remote_client &client) {
static void create_and_read_directory_test(remote_client &client) { static void create_and_read_directory_test(remote_client &client) {
const auto test_directory = const auto test_directory =
utils::path::absolute("./win_remote/readdirectory"); utils::path::combine(win_remote_dir, {"read_directory"});
EXPECT_TRUE(utils::file::delete_directory(test_directory)); EXPECT_TRUE(utils::file::delete_directory(test_directory));
auto api_path = auto api_path =
utils::string::from_utf8(test_directory).substr(mount_location_.size()); utils::string::from_utf8(test_directory).substr(mount_location_.size());
@ -287,7 +292,7 @@ static void create_and_read_directory_test(remote_client &client) {
static void open_and_read_directory_test(remote_client &client) { static void open_and_read_directory_test(remote_client &client) {
const auto test_directory = const auto test_directory =
utils::path::absolute("./win_remote/openreaddirectory"); utils::path::combine(win_remote_dir, {"open_and_read_directory"});
EXPECT_TRUE(utils::file::delete_directory(test_directory)); EXPECT_TRUE(utils::file::delete_directory(test_directory));
auto api_path = auto api_path =
utils::string::from_utf8(test_directory).substr(mount_location_.size()); utils::string::from_utf8(test_directory).substr(mount_location_.size());
@ -322,7 +327,8 @@ static void open_and_read_directory_test(remote_client &client) {
} }
static void read_and_write_test(remote_client &client) { static void read_and_write_test(remote_client &client) {
const auto test_file = utils::path::absolute("./win_remote/readwrite.txt"); const auto test_file =
utils::path::combine(win_remote_dir, {"read_and_write.txt"});
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));
auto api_path = auto api_path =
utils::string::from_utf8(test_file).substr(mount_location_.size()); utils::string::from_utf8(test_file).substr(mount_location_.size());
@ -363,8 +369,8 @@ static void read_and_write_test(remote_client &client) {
} }
static void rename_test(remote_client &client) { static void rename_test(remote_client &client) {
const auto test_file = utils::path::absolute("./win_remote/rename.txt"); const auto test_file = utils::path::combine(win_remote_dir, {"rename.txt"});
const auto test_file2 = utils::path::absolute("./win_remote/rename2.txt"); const auto test_file2 = utils::path::combine(win_remote_dir, {"rename2.txt"});
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));
EXPECT_TRUE(utils::file::retry_delete_file(test_file2)); EXPECT_TRUE(utils::file::retry_delete_file(test_file2));
auto api_path = auto api_path =
@ -393,7 +399,8 @@ static void rename_test(remote_client &client) {
} }
static void set_basic_info_test(remote_client &client) { static void set_basic_info_test(remote_client &client) {
const auto test_file = utils::path::absolute("./win_remote/setbasicinfo.txt"); const auto test_file =
utils::path::combine(win_remote_dir, {"set_basic_info.txt"});
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));
auto api_path = auto api_path =
@ -444,7 +451,8 @@ static void set_basic_info_test(remote_client &client) {
} }
static void set_file_size_test(remote_client &client) { static void set_file_size_test(remote_client &client) {
const auto test_file = utils::path::absolute("./win_remote/setfilesize.txt"); const auto test_file =
utils::path::combine(win_remote_dir, {"set_file_size.txt"});
EXPECT_TRUE(utils::file::retry_delete_file(test_file)); EXPECT_TRUE(utils::file::retry_delete_file(test_file));
auto api_path = auto api_path =
utils::string::from_utf8(test_file).substr(mount_location_.size()); utils::string::from_utf8(test_file).substr(mount_location_.size());
@ -485,7 +493,7 @@ TEST(remote_winfsp, all_tests) {
if (found_port) { if (found_port) {
console_consumer c; console_consumer c;
app_config config(provider_type::remote, "./win_remote"); app_config config(provider_type::remote, win_remote_dir);
config.set_remote_host_name_or_ip("localhost"); config.set_remote_host_name_or_ip("localhost");
config.set_remote_port(port); config.set_remote_port(port);
config.set_remote_token("testtoken"); config.set_remote_token("testtoken");
@ -528,6 +536,6 @@ TEST(remote_winfsp, all_tests) {
} }
event_system::instance().stop(); event_system::instance().stop();
EXPECT_TRUE(utils::file::delete_directory_recursively("./win_remote")); EXPECT_TRUE(utils::file::delete_directory_recursively(win_remote_dir));
} }
} // namespace winfsp_test } // namespace winfsp_test