refactor tests
This commit is contained in:
parent
7a24cc54f8
commit
4348e89f99
@ -360,9 +360,17 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef REPERTORY_TESTING
|
#ifdef REPERTORY_TESTING
|
||||||
void set_host_config(host_config hc) { hc_ = std::move(hc); }
|
void set_host_config(host_config hc) {
|
||||||
|
config_changed_ = true;
|
||||||
|
hc_ = std::move(hc);
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
|
||||||
void set_s3_config(s3_config s3) { s3_config_ = std::move(s3); }
|
void set_s3_config(s3_config s3) {
|
||||||
|
config_changed_ = true;
|
||||||
|
s3_config_ = std::move(s3);
|
||||||
|
save();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void set_is_remote_mount(bool is_remote_mount);
|
void set_is_remote_mount(bool is_remote_mount);
|
||||||
|
@ -36,12 +36,9 @@ app_config::app_config(const provider_type &prov,
|
|||||||
api_port_(default_rpc_port(prov)),
|
api_port_(default_rpc_port(prov)),
|
||||||
api_user_("repertory"),
|
api_user_("repertory"),
|
||||||
config_changed_(false),
|
config_changed_(false),
|
||||||
data_directory_(
|
data_directory_(data_directory.empty()
|
||||||
data_directory.empty() ? default_data_directory(prov)
|
? default_data_directory(prov)
|
||||||
: ((prov == provider_type::remote) || (prov == provider_type::s3))
|
: utils::path::absolute(data_directory)),
|
||||||
? utils::path::absolute(data_directory)
|
|
||||||
: utils::path::absolute(utils::path::combine(
|
|
||||||
data_directory, {get_provider_name(prov)}))),
|
|
||||||
download_timeout_secs_(30),
|
download_timeout_secs_(30),
|
||||||
enable_chunk_downloader_timeout_(true),
|
enable_chunk_downloader_timeout_(true),
|
||||||
enable_comm_duration_events_(false),
|
enable_comm_duration_events_(false),
|
||||||
@ -639,9 +636,9 @@ auto app_config::load() -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void app_config::save() {
|
void app_config::save() {
|
||||||
const auto configFilePath = get_config_file_path();
|
const auto file_path = get_config_file_path();
|
||||||
recur_mutex_lock lock(read_write_mutex_);
|
recur_mutex_lock lock(read_write_mutex_);
|
||||||
if (config_changed_ || not utils::file::is_file(configFilePath)) {
|
if (config_changed_ || not utils::file::is_file(file_path)) {
|
||||||
if (not utils::file::is_directory(data_directory_)) {
|
if (not utils::file::is_directory(data_directory_)) {
|
||||||
if (not utils::file::create_full_directory_path(data_directory_)) {
|
if (not utils::file::create_full_directory_path(data_directory_)) {
|
||||||
utils::error::raise_error(
|
utils::error::raise_error(
|
||||||
@ -654,7 +651,7 @@ void app_config::save() {
|
|||||||
json data = get_json();
|
json data = get_json();
|
||||||
auto success = false;
|
auto success = false;
|
||||||
for (auto i = 0; not success && (i < 5); i++) {
|
for (auto i = 0; not success && (i < 5); i++) {
|
||||||
if (not(success = utils::file::write_json_file(configFilePath, data))) {
|
if (not(success = utils::file::write_json_file(file_path, data))) {
|
||||||
std::this_thread::sleep_for(1s);
|
std::this_thread::sleep_for(1s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -121,10 +121,11 @@ auto main(int argc, char **argv) -> int {
|
|||||||
std::cerr << "Name of S3 instance not provided" << std::endl;
|
std::cerr << "Name of S3 instance not provided" << std::endl;
|
||||||
res = exit_code::invalid_syntax;
|
res = exit_code::invalid_syntax;
|
||||||
} else {
|
} else {
|
||||||
data_directory = utils::path::combine(
|
data_directory = utils::path::absolute(
|
||||||
data_directory.empty() ? app_config::default_data_directory(prov)
|
data_directory.empty()
|
||||||
: data_directory,
|
? utils::path::combine(app_config::default_data_directory(prov),
|
||||||
{unique_id});
|
{unique_id})
|
||||||
|
: data_directory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,6 +135,9 @@ auto parse_drive_options(int argc, char **argv,
|
|||||||
} else if ((std::string(argv[i]) == options::remote_mount_option[0]) ||
|
} else if ((std::string(argv[i]) == options::remote_mount_option[0]) ||
|
||||||
(std::string(argv[i]) == options::remote_mount_option[1])) {
|
(std::string(argv[i]) == options::remote_mount_option[1])) {
|
||||||
i++;
|
i++;
|
||||||
|
} else if ((std::string(argv[i]) == options::data_directory_option[0]) ||
|
||||||
|
(std::string(argv[i]) == options::data_directory_option[1])) {
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
#ifdef REPERTORY_ENABLE_S3
|
#ifdef REPERTORY_ENABLE_S3
|
||||||
else if ((std::string(argv[i]) == options::name_option[0]) ||
|
else if ((std::string(argv[i]) == options::name_option[0]) ||
|
||||||
|
@ -38,29 +38,33 @@
|
|||||||
#define ACCESSPERMS (S_IRWXU | S_IRWXG | S_IRWXO) /* 0777 */
|
#define ACCESSPERMS (S_IRWXU | S_IRWXG | S_IRWXO) /* 0777 */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static constexpr const auto SLEEP_SECONDS = 1.5s;
|
||||||
|
|
||||||
namespace repertory {
|
namespace repertory {
|
||||||
static void execute_mount(app_config &cfg, lock_data &ld, i_provider &provider,
|
static void execute_mount(const std::string &data_directory,
|
||||||
const std::vector<std::string> &drive_args,
|
const std::vector<std::string> &drive_args,
|
||||||
std::thread &th) {
|
std::thread &mount_thread) {
|
||||||
EXPECT_EQ(0, fuse_drive(cfg, ld, provider).mount(drive_args));
|
auto cmd = "./repertory -dd \"" + data_directory + "\"" + " " +
|
||||||
th.join();
|
utils::string::join(drive_args, ' ');
|
||||||
|
std::cout << cmd << std::endl;
|
||||||
|
EXPECT_EQ(0, system(cmd.c_str()));
|
||||||
|
mount_thread.join();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void execute_unmount(i_provider &provider,
|
static void execute_unmount(const std::string &mount_location) {
|
||||||
const std::string &mount_location) {
|
// filesystem_item fsi{};
|
||||||
filesystem_item fsi{};
|
// EXPECT_EQ(api_error::success, provider.get_filesystem_item("/", true,
|
||||||
EXPECT_EQ(api_error::success, provider.get_filesystem_item("/", true, fsi));
|
// fsi)); EXPECT_STREQ("/", fsi.api_path.c_str());
|
||||||
EXPECT_STREQ("/", fsi.api_path.c_str());
|
// EXPECT_TRUE(fsi.api_parent.empty());
|
||||||
EXPECT_TRUE(fsi.api_parent.empty());
|
// EXPECT_TRUE(fsi.directory);
|
||||||
EXPECT_TRUE(fsi.directory);
|
// EXPECT_EQ(std::uint64_t(0u), fsi.size);
|
||||||
EXPECT_EQ(std::uint64_t(0u), fsi.size);
|
// EXPECT_TRUE(fsi.source_path.empty());
|
||||||
EXPECT_TRUE(fsi.source_path.empty());
|
//
|
||||||
|
// api_meta_map meta{};
|
||||||
api_meta_map meta{};
|
// EXPECT_EQ(api_error::success, provider.get_item_meta("/", meta));
|
||||||
EXPECT_EQ(api_error::success, provider.get_item_meta("/", meta));
|
// for (const auto &kv : meta) {
|
||||||
for (const auto &kv : meta) {
|
// std::cout << kv.first << '=' << kv.second << std::endl;
|
||||||
std::cout << kv.first << '=' << kv.second << std::endl;
|
// }
|
||||||
}
|
|
||||||
|
|
||||||
auto unmounted = false;
|
auto unmounted = false;
|
||||||
for (int i = 0; not unmounted && (i < 50); i++) {
|
for (int i = 0; not unmounted && (i < 50); i++) {
|
||||||
@ -75,6 +79,7 @@ static void execute_unmount(i_provider &provider,
|
|||||||
|
|
||||||
static auto create_file_and_test(const std::string &mount_location,
|
static auto create_file_and_test(const std::string &mount_location,
|
||||||
std::string name) -> std::string {
|
std::string name) -> std::string {
|
||||||
|
std::cout << __FUNCTION__ << std::endl;
|
||||||
auto file_path =
|
auto file_path =
|
||||||
utils::path::absolute(utils::path::combine(mount_location, {name}));
|
utils::path::absolute(utils::path::combine(mount_location, {name}));
|
||||||
|
|
||||||
@ -89,12 +94,13 @@ static auto create_file_and_test(const std::string &mount_location,
|
|||||||
EXPECT_EQ(0u, file_size);
|
EXPECT_EQ(0u, file_size);
|
||||||
|
|
||||||
EXPECT_EQ(0, close(fd));
|
EXPECT_EQ(0, close(fd));
|
||||||
std::this_thread::sleep_for(2s);
|
std::this_thread::sleep_for(SLEEP_SECONDS);
|
||||||
|
|
||||||
return file_path;
|
return file_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rmdir_and_test(const std::string &directory_path) {
|
static void rmdir_and_test(const std::string &directory_path) {
|
||||||
|
std::cout << __FUNCTION__ << std::endl;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
for (auto i = 0; ((ret = rmdir(directory_path.c_str())) != 0) && (i < 20);
|
for (auto i = 0; ((ret = rmdir(directory_path.c_str())) != 0) && (i < 20);
|
||||||
i++) {
|
i++) {
|
||||||
@ -102,13 +108,14 @@ static void rmdir_and_test(const std::string &directory_path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EXPECT_EQ(0, ret);
|
EXPECT_EQ(0, ret);
|
||||||
std::this_thread::sleep_for(2s);
|
std::this_thread::sleep_for(SLEEP_SECONDS);
|
||||||
|
|
||||||
EXPECT_FALSE(utils::file::is_directory(directory_path));
|
EXPECT_FALSE(utils::file::is_directory(directory_path));
|
||||||
EXPECT_FALSE(utils::file::is_file(directory_path));
|
EXPECT_FALSE(utils::file::is_file(directory_path));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void unlink_file_and_test(const std::string &file_path) {
|
static void unlink_file_and_test(const std::string &file_path) {
|
||||||
|
std::cout << __FUNCTION__ << std::endl;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
for (auto i = 0; ((ret = unlink(file_path.c_str())) != 0) && (i < 20); i++) {
|
for (auto i = 0; ((ret = unlink(file_path.c_str())) != 0) && (i < 20); i++) {
|
||||||
std::this_thread::sleep_for(100ms);
|
std::this_thread::sleep_for(100ms);
|
||||||
@ -116,66 +123,63 @@ static void unlink_file_and_test(const std::string &file_path) {
|
|||||||
|
|
||||||
EXPECT_EQ(0, ret);
|
EXPECT_EQ(0, ret);
|
||||||
|
|
||||||
std::this_thread::sleep_for(2s);
|
std::this_thread::sleep_for(SLEEP_SECONDS);
|
||||||
EXPECT_FALSE(utils::file::is_directory(file_path));
|
EXPECT_FALSE(utils::file::is_directory(file_path));
|
||||||
EXPECT_FALSE(utils::file::is_file(file_path));
|
EXPECT_FALSE(utils::file::is_file(file_path));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_chmod(const std::string &api_path,
|
static void test_chmod(const std::string &api_path,
|
||||||
const std::string &file_path, i_provider &provider) {
|
const std::string &file_path) {
|
||||||
|
std::cout << __FUNCTION__ << std::endl;
|
||||||
EXPECT_EQ(0, chmod(file_path.c_str(), S_IRUSR | S_IWUSR));
|
EXPECT_EQ(0, chmod(file_path.c_str(), S_IRUSR | S_IWUSR));
|
||||||
std::string mode;
|
std::this_thread::sleep_for(SLEEP_SECONDS);
|
||||||
EXPECT_EQ(api_error::success,
|
|
||||||
provider.get_item_meta(api_path.c_str(), META_MODE, mode));
|
struct stat64 path_stat {};
|
||||||
|
stat64(file_path.c_str(), &path_stat);
|
||||||
EXPECT_EQ(static_cast<std::uint32_t>(S_IRUSR | S_IWUSR),
|
EXPECT_EQ(static_cast<std::uint32_t>(S_IRUSR | S_IWUSR),
|
||||||
ACCESSPERMS & utils::string::to_uint32(mode));
|
ACCESSPERMS & path_stat.st_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_chown(const std::string &api_path,
|
static void test_chown(const std::string &api_path,
|
||||||
const std::string &file_path, i_provider &provider) {
|
const std::string &file_path) {
|
||||||
|
std::cout << __FUNCTION__ << std::endl;
|
||||||
EXPECT_EQ(0, chown(file_path.c_str(), -1, 0));
|
EXPECT_EQ(0, chown(file_path.c_str(), -1, 0));
|
||||||
std::string gid;
|
std::this_thread::sleep_for(SLEEP_SECONDS);
|
||||||
EXPECT_EQ(api_error::success,
|
|
||||||
provider.get_item_meta(api_path, META_GID, gid));
|
struct stat64 path_stat {};
|
||||||
EXPECT_STREQ("0", gid.c_str());
|
stat64(file_path.c_str(), &path_stat);
|
||||||
|
EXPECT_EQ(0, path_stat.st_gid);
|
||||||
|
|
||||||
EXPECT_EQ(0, chown(file_path.c_str(), 0, -1));
|
EXPECT_EQ(0, chown(file_path.c_str(), 0, -1));
|
||||||
std::string uid;
|
std::this_thread::sleep_for(SLEEP_SECONDS);
|
||||||
EXPECT_EQ(api_error::success,
|
|
||||||
provider.get_item_meta(api_path, META_UID, uid));
|
stat64(file_path.c_str(), &path_stat);
|
||||||
EXPECT_STREQ("0", uid.c_str());
|
EXPECT_EQ(0, path_stat.st_gid);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_mkdir(const std::string &api_path,
|
static void test_mkdir(const std::string &api_path,
|
||||||
const std::string &directory_path,
|
const std::string &directory_path) {
|
||||||
i_provider &provider) {
|
std::cout << __FUNCTION__ << std::endl;
|
||||||
EXPECT_EQ(0, mkdir(directory_path.c_str(),
|
EXPECT_EQ(0, mkdir(directory_path.c_str(),
|
||||||
S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP));
|
S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP));
|
||||||
|
|
||||||
EXPECT_TRUE(utils::file::is_directory(directory_path));
|
EXPECT_TRUE(utils::file::is_directory(directory_path));
|
||||||
EXPECT_FALSE(utils::file::is_file(directory_path));
|
EXPECT_FALSE(utils::file::is_file(directory_path));
|
||||||
|
|
||||||
std::string uid;
|
struct stat64 path_stat {};
|
||||||
EXPECT_EQ(api_error::success,
|
stat64(directory_path.c_str(), &path_stat);
|
||||||
provider.get_item_meta(api_path, META_UID, uid));
|
|
||||||
EXPECT_EQ(getuid(), utils::string::to_uint32(uid));
|
|
||||||
|
|
||||||
std::string gid;
|
EXPECT_EQ(getuid(), path_stat.st_uid);
|
||||||
EXPECT_EQ(api_error::success,
|
EXPECT_EQ(getgid(), path_stat.st_gid);
|
||||||
provider.get_item_meta(api_path, META_GID, gid));
|
|
||||||
EXPECT_EQ(getgid(), utils::string::to_uint32(gid));
|
|
||||||
|
|
||||||
std::string mode;
|
|
||||||
EXPECT_EQ(api_error::success,
|
|
||||||
provider.get_item_meta(api_path, META_MODE, mode));
|
|
||||||
EXPECT_EQ(static_cast<std::uint32_t>(S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP |
|
EXPECT_EQ(static_cast<std::uint32_t>(S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP |
|
||||||
S_IXGRP),
|
S_IXGRP),
|
||||||
ACCESSPERMS & (utils::string::to_uint32(mode)));
|
ACCESSPERMS & path_stat.st_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_write_and_read(const std::string &api_path,
|
static void test_write_and_read(const std::string &api_path,
|
||||||
const std::string &file_path,
|
const std::string &file_path) {
|
||||||
i_provider &provider) {
|
std::cout << __FUNCTION__ << std::endl;
|
||||||
auto fd =
|
auto fd =
|
||||||
open(file_path.c_str(), O_CREAT | O_RDWR, S_IRUSR | S_IWUSR | S_IRGRP);
|
open(file_path.c_str(), O_CREAT | O_RDWR, S_IRUSR | S_IWUSR | S_IRGRP);
|
||||||
EXPECT_LE(1, fd);
|
EXPECT_LE(1, fd);
|
||||||
@ -195,29 +199,30 @@ static void test_write_and_read(const std::string &api_path,
|
|||||||
|
|
||||||
EXPECT_EQ(0, close(fd));
|
EXPECT_EQ(0, close(fd));
|
||||||
|
|
||||||
std::this_thread::sleep_for(2s);
|
std::this_thread::sleep_for(SLEEP_SECONDS);
|
||||||
|
|
||||||
std::uint64_t file_size{};
|
std::uint64_t file_size{};
|
||||||
EXPECT_TRUE(utils::file::get_file_size(file_path, file_size));
|
EXPECT_TRUE(utils::file::get_file_size(file_path, file_size));
|
||||||
EXPECT_EQ(data.size(), file_size);
|
EXPECT_EQ(data.size(), file_size);
|
||||||
|
|
||||||
filesystem_item fsi{};
|
// filesystem_item fsi{};
|
||||||
EXPECT_EQ(api_error::success,
|
// EXPECT_EQ(api_error::success,
|
||||||
provider.get_filesystem_item(api_path, false, fsi));
|
// provider.get_filesystem_item(api_path, false, fsi));
|
||||||
EXPECT_TRUE(utils::file::get_file_size(fsi.source_path, file_size));
|
// EXPECT_TRUE(utils::file::get_file_size(fsi.source_path, file_size));
|
||||||
EXPECT_EQ(data.size(), file_size);
|
// EXPECT_EQ(data.size(), file_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_rename_file(const std::string &from_file_path,
|
static void test_rename_file(const std::string &from_file_path,
|
||||||
const std::string &to_file_path,
|
const std::string &to_file_path,
|
||||||
i_provider &provider) {
|
bool is_rename_supported) {
|
||||||
|
std::cout << __FUNCTION__ << std::endl;
|
||||||
auto fd = open(from_file_path.c_str(), O_RDWR, S_IRUSR | S_IWUSR | S_IRGRP);
|
auto fd = open(from_file_path.c_str(), O_RDWR, S_IRUSR | S_IWUSR | S_IRGRP);
|
||||||
EXPECT_LE(1, fd);
|
EXPECT_LE(1, fd);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
std::this_thread::sleep_for(2s);
|
std::this_thread::sleep_for(SLEEP_SECONDS);
|
||||||
|
|
||||||
if (provider.is_rename_supported()) {
|
if (is_rename_supported) {
|
||||||
EXPECT_EQ(0, rename(from_file_path.c_str(), to_file_path.c_str()));
|
EXPECT_EQ(0, rename(from_file_path.c_str(), to_file_path.c_str()));
|
||||||
EXPECT_FALSE(utils::file::is_file(from_file_path));
|
EXPECT_FALSE(utils::file::is_file(from_file_path));
|
||||||
EXPECT_TRUE(utils::file::is_file(to_file_path));
|
EXPECT_TRUE(utils::file::is_file(to_file_path));
|
||||||
@ -230,13 +235,14 @@ static void test_rename_file(const std::string &from_file_path,
|
|||||||
|
|
||||||
static void test_rename_directory(const std::string &from_dir_path,
|
static void test_rename_directory(const std::string &from_dir_path,
|
||||||
const std::string &to_dir_path,
|
const std::string &to_dir_path,
|
||||||
i_provider &provider) {
|
bool is_rename_supported) {
|
||||||
|
std::cout << __FUNCTION__ << std::endl;
|
||||||
EXPECT_EQ(0, mkdir(from_dir_path.c_str(),
|
EXPECT_EQ(0, mkdir(from_dir_path.c_str(),
|
||||||
S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP));
|
S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP));
|
||||||
std::this_thread::sleep_for(2s);
|
std::this_thread::sleep_for(SLEEP_SECONDS);
|
||||||
|
|
||||||
EXPECT_TRUE(utils::file::is_directory(from_dir_path));
|
EXPECT_TRUE(utils::file::is_directory(from_dir_path));
|
||||||
if (provider.is_rename_supported()) {
|
if (is_rename_supported) {
|
||||||
EXPECT_EQ(0, rename(from_dir_path.c_str(), to_dir_path.c_str()));
|
EXPECT_EQ(0, rename(from_dir_path.c_str(), to_dir_path.c_str()));
|
||||||
EXPECT_FALSE(utils::file::is_directory(from_dir_path));
|
EXPECT_FALSE(utils::file::is_directory(from_dir_path));
|
||||||
EXPECT_TRUE(utils::file::is_directory(to_dir_path));
|
EXPECT_TRUE(utils::file::is_directory(to_dir_path));
|
||||||
@ -248,6 +254,7 @@ static void test_rename_directory(const std::string &from_dir_path,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void test_truncate(const std::string &file_path) {
|
static void test_truncate(const std::string &file_path) {
|
||||||
|
std::cout << __FUNCTION__ << std::endl;
|
||||||
EXPECT_EQ(0, truncate(file_path.c_str(), 10u));
|
EXPECT_EQ(0, truncate(file_path.c_str(), 10u));
|
||||||
|
|
||||||
std::uint64_t file_size{};
|
std::uint64_t file_size{};
|
||||||
@ -257,6 +264,7 @@ static void test_truncate(const std::string &file_path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void test_ftruncate(const std::string &file_path) {
|
static void test_ftruncate(const std::string &file_path) {
|
||||||
|
std::cout << __FUNCTION__ << std::endl;
|
||||||
auto fd = open(file_path.c_str(), O_RDWR, S_IRUSR | S_IWUSR | S_IRGRP);
|
auto fd = open(file_path.c_str(), O_RDWR, S_IRUSR | S_IWUSR | S_IRGRP);
|
||||||
EXPECT_LE(1, fd);
|
EXPECT_LE(1, fd);
|
||||||
|
|
||||||
@ -272,7 +280,8 @@ static void test_ftruncate(const std::string &file_path) {
|
|||||||
|
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
static void test_fallocate(const std::string &api_path,
|
static void test_fallocate(const std::string &api_path,
|
||||||
const std::string &file_path, i_provider &provider) {
|
const std::string &file_path) {
|
||||||
|
std::cout << __FUNCTION__ << std::endl;
|
||||||
auto fd =
|
auto fd =
|
||||||
open(file_path.c_str(), O_CREAT | O_RDWR, S_IRUSR | S_IWUSR | S_IRGRP);
|
open(file_path.c_str(), O_CREAT | O_RDWR, S_IRUSR | S_IWUSR | S_IRGRP);
|
||||||
EXPECT_LE(1, fd);
|
EXPECT_LE(1, fd);
|
||||||
@ -284,19 +293,23 @@ static void test_fallocate(const std::string &api_path,
|
|||||||
|
|
||||||
EXPECT_EQ(0, close(fd));
|
EXPECT_EQ(0, close(fd));
|
||||||
|
|
||||||
filesystem_item fsi{};
|
|
||||||
EXPECT_EQ(api_error::success,
|
|
||||||
provider.get_filesystem_item(api_path, false, fsi));
|
|
||||||
|
|
||||||
file_size = 0u;
|
file_size = 0u;
|
||||||
EXPECT_TRUE(utils::file::get_file_size(fsi.source_path, file_size));
|
EXPECT_TRUE(utils::file::get_file_size(file_path, file_size));
|
||||||
EXPECT_EQ(16u, file_size);
|
EXPECT_EQ(16u, file_size);
|
||||||
|
|
||||||
|
// filesystem_item fsi{};
|
||||||
|
// EXPECT_EQ(api_error::success,
|
||||||
|
// provider.get_filesystem_item(api_path, false, fsi));
|
||||||
|
|
||||||
|
// file_size = 0u;
|
||||||
|
// EXPECT_TRUE(utils::file::get_file_size(fsi.source_path, file_size));
|
||||||
|
// EXPECT_EQ(16u, file_size);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void test_file_getattr(const std::string & /* api_path */,
|
static void test_file_getattr(const std::string & /* api_path */,
|
||||||
const std::string &file_path,
|
const std::string &file_path) {
|
||||||
i_provider & /* provider */) {
|
std::cout << __FUNCTION__ << std::endl;
|
||||||
auto fd =
|
auto fd =
|
||||||
open(file_path.c_str(), O_CREAT | O_RDONLY, S_IRUSR | S_IWUSR | S_IRGRP);
|
open(file_path.c_str(), O_CREAT | O_RDONLY, S_IRUSR | S_IWUSR | S_IRGRP);
|
||||||
EXPECT_LE(1, fd);
|
EXPECT_LE(1, fd);
|
||||||
@ -312,8 +325,8 @@ static void test_file_getattr(const std::string & /* api_path */,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void test_directory_getattr(const std::string & /* api_path */,
|
static void test_directory_getattr(const std::string & /* api_path */,
|
||||||
const std::string &directory_path,
|
const std::string &directory_path) {
|
||||||
i_provider & /* provider */) {
|
std::cout << __FUNCTION__ << std::endl;
|
||||||
EXPECT_EQ(0, mkdir(directory_path.c_str(),
|
EXPECT_EQ(0, mkdir(directory_path.c_str(),
|
||||||
S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP));
|
S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP));
|
||||||
|
|
||||||
@ -328,8 +341,8 @@ static void test_directory_getattr(const std::string & /* api_path */,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
test_write_operations_fail_if_read_only(const std::string &api_path,
|
test_write_operations_fail_if_read_only(const std::string &api_path,
|
||||||
const std::string &file_path,
|
const std::string &file_path) {
|
||||||
i_provider &provider) {
|
std::cout << __FUNCTION__ << std::endl;
|
||||||
auto fd =
|
auto fd =
|
||||||
open(file_path.c_str(), O_CREAT | O_RDONLY, S_IRUSR | S_IWUSR | S_IRGRP);
|
open(file_path.c_str(), O_CREAT | O_RDONLY, S_IRUSR | S_IWUSR | S_IRGRP);
|
||||||
EXPECT_LE(1, fd);
|
EXPECT_LE(1, fd);
|
||||||
@ -345,21 +358,22 @@ test_write_operations_fail_if_read_only(const std::string &api_path,
|
|||||||
|
|
||||||
EXPECT_EQ(0, close(fd));
|
EXPECT_EQ(0, close(fd));
|
||||||
|
|
||||||
std::this_thread::sleep_for(2s);
|
std::this_thread::sleep_for(SLEEP_SECONDS);
|
||||||
|
|
||||||
std::uint64_t file_size{};
|
std::uint64_t file_size{};
|
||||||
EXPECT_TRUE(utils::file::get_file_size(file_path, file_size));
|
EXPECT_TRUE(utils::file::get_file_size(file_path, file_size));
|
||||||
EXPECT_EQ(std::size_t(0u), file_size);
|
EXPECT_EQ(std::size_t(0u), file_size);
|
||||||
|
|
||||||
filesystem_item fsi{};
|
// filesystem_item fsi{};
|
||||||
EXPECT_EQ(api_error::success,
|
// EXPECT_EQ(api_error::success,
|
||||||
provider.get_filesystem_item(api_path, false, fsi));
|
// provider.get_filesystem_item(api_path, false, fsi));
|
||||||
EXPECT_TRUE(utils::file::get_file_size(fsi.source_path, file_size));
|
// EXPECT_TRUE(utils::file::get_file_size(fsi.source_path, file_size));
|
||||||
EXPECT_EQ(std::size_t(0u), file_size);
|
// EXPECT_EQ(std::size_t(0u), file_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !__APPLE__ && HAS_SETXATTR
|
#if !__APPLE__ && HAS_SETXATTR
|
||||||
static void test_xattr_invalid_parameters(const std::string &file_path) {
|
static void test_xattr_invalid_parameters(const std::string &file_path) {
|
||||||
|
std::cout << __FUNCTION__ << std::endl;
|
||||||
std::string attr = "moose";
|
std::string attr = "moose";
|
||||||
EXPECT_EQ(-1, setxattr(nullptr, "user.test_attr", attr.data(), attr.size(),
|
EXPECT_EQ(-1, setxattr(nullptr, "user.test_attr", attr.data(), attr.size(),
|
||||||
XATTR_CREATE));
|
XATTR_CREATE));
|
||||||
@ -375,6 +389,7 @@ static void test_xattr_invalid_parameters(const std::string &file_path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void test_xattr_create_and_get(const std::string &file_path) {
|
static void test_xattr_create_and_get(const std::string &file_path) {
|
||||||
|
std::cout << __FUNCTION__ << std::endl;
|
||||||
std::string attr = "moose";
|
std::string attr = "moose";
|
||||||
EXPECT_EQ(0, setxattr(file_path.c_str(), "user.test_attr", attr.data(),
|
EXPECT_EQ(0, setxattr(file_path.c_str(), "user.test_attr", attr.data(),
|
||||||
attr.size(), XATTR_CREATE));
|
attr.size(), XATTR_CREATE));
|
||||||
@ -388,6 +403,7 @@ static void test_xattr_create_and_get(const std::string &file_path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void test_xattr_listxattr(const std::string &file_path) {
|
static void test_xattr_listxattr(const std::string &file_path) {
|
||||||
|
std::cout << __FUNCTION__ << std::endl;
|
||||||
std::string attr = "moose";
|
std::string attr = "moose";
|
||||||
EXPECT_EQ(0, setxattr(file_path.c_str(), "user.test_attr", attr.data(),
|
EXPECT_EQ(0, setxattr(file_path.c_str(), "user.test_attr", attr.data(),
|
||||||
attr.size(), XATTR_CREATE));
|
attr.size(), XATTR_CREATE));
|
||||||
@ -416,6 +432,7 @@ static void test_xattr_listxattr(const std::string &file_path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void test_xattr_replace(const std::string &file_path) {
|
static void test_xattr_replace(const std::string &file_path) {
|
||||||
|
std::cout << __FUNCTION__ << std::endl;
|
||||||
std::string attr = "moose";
|
std::string attr = "moose";
|
||||||
EXPECT_EQ(0, setxattr(file_path.c_str(), "user.test_attr", attr.data(),
|
EXPECT_EQ(0, setxattr(file_path.c_str(), "user.test_attr", attr.data(),
|
||||||
attr.size(), XATTR_CREATE));
|
attr.size(), XATTR_CREATE));
|
||||||
@ -433,6 +450,7 @@ static void test_xattr_replace(const std::string &file_path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void test_xattr_default_create(const std::string &file_path) {
|
static void test_xattr_default_create(const std::string &file_path) {
|
||||||
|
std::cout << __FUNCTION__ << std::endl;
|
||||||
std::string attr = "moose";
|
std::string attr = "moose";
|
||||||
EXPECT_EQ(0, setxattr(file_path.c_str(), "user.test_attr", attr.data(),
|
EXPECT_EQ(0, setxattr(file_path.c_str(), "user.test_attr", attr.data(),
|
||||||
attr.size(), 0));
|
attr.size(), 0));
|
||||||
@ -446,6 +464,7 @@ static void test_xattr_default_create(const std::string &file_path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void test_xattr_default_replace(const std::string &file_path) {
|
static void test_xattr_default_replace(const std::string &file_path) {
|
||||||
|
std::cout << __FUNCTION__ << std::endl;
|
||||||
std::string attr = "moose";
|
std::string attr = "moose";
|
||||||
EXPECT_EQ(0, setxattr(file_path.c_str(), "user.test_attr", attr.data(),
|
EXPECT_EQ(0, setxattr(file_path.c_str(), "user.test_attr", attr.data(),
|
||||||
attr.size(), 0));
|
attr.size(), 0));
|
||||||
@ -463,6 +482,7 @@ static void test_xattr_default_replace(const std::string &file_path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void test_xattr_create_fails_if_exists(const std::string &file_path) {
|
static void test_xattr_create_fails_if_exists(const std::string &file_path) {
|
||||||
|
std::cout << __FUNCTION__ << std::endl;
|
||||||
std::string attr = "moose";
|
std::string attr = "moose";
|
||||||
EXPECT_EQ(0, setxattr(file_path.c_str(), "user.test_attr", attr.data(),
|
EXPECT_EQ(0, setxattr(file_path.c_str(), "user.test_attr", attr.data(),
|
||||||
attr.size(), 0));
|
attr.size(), 0));
|
||||||
@ -473,6 +493,7 @@ static void test_xattr_create_fails_if_exists(const std::string &file_path) {
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
test_xattr_create_fails_if_not_exists(const std::string &file_path) {
|
test_xattr_create_fails_if_not_exists(const std::string &file_path) {
|
||||||
|
std::cout << __FUNCTION__ << std::endl;
|
||||||
std::string attr = "moose";
|
std::string attr = "moose";
|
||||||
EXPECT_EQ(-1, setxattr(file_path.c_str(), "user.test_attr", attr.data(),
|
EXPECT_EQ(-1, setxattr(file_path.c_str(), "user.test_attr", attr.data(),
|
||||||
attr.size(), XATTR_REPLACE));
|
attr.size(), XATTR_REPLACE));
|
||||||
@ -480,6 +501,7 @@ test_xattr_create_fails_if_not_exists(const std::string &file_path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void test_xattr_removexattr(const std::string &file_path) {
|
static void test_xattr_removexattr(const std::string &file_path) {
|
||||||
|
std::cout << __FUNCTION__ << std::endl;
|
||||||
std::string attr = "moose";
|
std::string attr = "moose";
|
||||||
EXPECT_EQ(0, setxattr(file_path.c_str(), "user.test_attr", attr.data(),
|
EXPECT_EQ(0, setxattr(file_path.c_str(), "user.test_attr", attr.data(),
|
||||||
attr.size(), XATTR_CREATE));
|
attr.size(), XATTR_CREATE));
|
||||||
@ -511,13 +533,14 @@ TEST(fuse_drive, all_tests) {
|
|||||||
std::unique_ptr<app_config> config_ptr{};
|
std::unique_ptr<app_config> config_ptr{};
|
||||||
std::unique_ptr<curl_comm> comm_ptr{};
|
std::unique_ptr<curl_comm> comm_ptr{};
|
||||||
std::unique_ptr<i_provider> provider_ptr{};
|
std::unique_ptr<i_provider> provider_ptr{};
|
||||||
std::unique_ptr<lock_data> lock_data_ptr{};
|
|
||||||
|
|
||||||
const auto cfg_directory = utils::path::absolute(
|
const auto cfg_directory = utils::path::absolute(
|
||||||
utils::path::combine(test_directory, {"cfg", std::to_string(idx)}));
|
utils::path::combine(test_directory, {"cfg", std::to_string(idx)}));
|
||||||
EXPECT_TRUE(utils::file::delete_directory_recursively(cfg_directory));
|
EXPECT_TRUE(utils::file::delete_directory_recursively(cfg_directory));
|
||||||
EXPECT_TRUE(utils::file::create_full_directory_path(cfg_directory));
|
EXPECT_TRUE(utils::file::create_full_directory_path(cfg_directory));
|
||||||
|
|
||||||
|
std::vector<std::string> drive_args{};
|
||||||
|
|
||||||
switch (idx) {
|
switch (idx) {
|
||||||
case 0U: {
|
case 0U: {
|
||||||
#ifdef REPERTORY_ENABLE_S3
|
#ifdef REPERTORY_ENABLE_S3
|
||||||
@ -533,8 +556,7 @@ TEST(fuse_drive, all_tests) {
|
|||||||
|
|
||||||
comm_ptr = std::make_unique<curl_comm>(config_ptr->get_s3_config());
|
comm_ptr = std::make_unique<curl_comm>(config_ptr->get_s3_config());
|
||||||
provider_ptr = std::make_unique<s3_provider>(*config_ptr, *comm_ptr);
|
provider_ptr = std::make_unique<s3_provider>(*config_ptr, *comm_ptr);
|
||||||
lock_data_ptr = std::make_unique<lock_data>(
|
drive_args = std::vector<std::string>({"-s3", "-na", "storj"});
|
||||||
provider_type::s3, "unittests_" + std::to_string(idx));
|
|
||||||
#else
|
#else
|
||||||
continue;
|
continue;
|
||||||
#endif
|
#endif
|
||||||
@ -553,8 +575,6 @@ TEST(fuse_drive, all_tests) {
|
|||||||
|
|
||||||
comm_ptr = std::make_unique<curl_comm>(config_ptr->get_host_config());
|
comm_ptr = std::make_unique<curl_comm>(config_ptr->get_host_config());
|
||||||
provider_ptr = std::make_unique<sia_provider>(*config_ptr, *comm_ptr);
|
provider_ptr = std::make_unique<sia_provider>(*config_ptr, *comm_ptr);
|
||||||
lock_data_ptr = std::make_unique<lock_data>(
|
|
||||||
provider_type::sia, "unittests_" + std::to_string(idx));
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -563,148 +583,126 @@ TEST(fuse_drive, all_tests) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
event_capture ec({
|
|
||||||
"drive_mounted",
|
|
||||||
"drive_unmounted",
|
|
||||||
"drive_unmount_pending",
|
|
||||||
"drive_mount_result",
|
|
||||||
});
|
|
||||||
|
|
||||||
std::thread th([&] {
|
std::thread th([&] {
|
||||||
const auto mounted = ec.wait_for_event("drive_mounted");
|
std::this_thread::sleep_for(5s);
|
||||||
EXPECT_TRUE(mounted);
|
EXPECT_EQ(0, system(("mount|grep \"" + mount_location + "\"").c_str()));
|
||||||
if (mounted) {
|
|
||||||
EXPECT_EQ(0,
|
|
||||||
system(("mount|grep \"" + mount_location + "\"").c_str()));
|
|
||||||
|
|
||||||
auto file_path = create_file_and_test(mount_location, "chmod_test");
|
auto file_path = create_file_and_test(mount_location, "chmod_test");
|
||||||
test_chmod(utils::path::create_api_path("chmod_test"), file_path,
|
test_chmod(utils::path::create_api_path("chmod_test"), file_path);
|
||||||
*provider_ptr);
|
unlink_file_and_test(file_path);
|
||||||
unlink_file_and_test(file_path);
|
|
||||||
|
|
||||||
file_path = create_file_and_test(mount_location, "chown_test");
|
file_path = create_file_and_test(mount_location, "chown_test");
|
||||||
test_chown(utils::path::create_api_path("chown_test"), file_path,
|
test_chown(utils::path::create_api_path("chown_test"), file_path);
|
||||||
*provider_ptr);
|
unlink_file_and_test(file_path);
|
||||||
unlink_file_and_test(file_path);
|
|
||||||
|
|
||||||
file_path = utils::path::combine(mount_location, {"mkdir_test"});
|
file_path = utils::path::combine(mount_location, {"mkdir_test"});
|
||||||
test_mkdir(utils::path::create_api_path("mkdir_test"), file_path,
|
test_mkdir(utils::path::create_api_path("mkdir_test"), file_path);
|
||||||
*provider_ptr);
|
rmdir_and_test(file_path);
|
||||||
rmdir_and_test(file_path);
|
|
||||||
|
|
||||||
file_path = create_file_and_test(mount_location, "write_read_test");
|
file_path = create_file_and_test(mount_location, "write_read_test");
|
||||||
test_write_and_read(utils::path::create_api_path("write_read_test"),
|
test_write_and_read(utils::path::create_api_path("write_read_test"),
|
||||||
file_path, *provider_ptr);
|
file_path);
|
||||||
unlink_file_and_test(file_path);
|
unlink_file_and_test(file_path);
|
||||||
|
|
||||||
file_path =
|
file_path =
|
||||||
create_file_and_test(mount_location, "from_rename_file_test");
|
create_file_and_test(mount_location, "from_rename_file_test");
|
||||||
auto to_file_path = utils::path::absolute(
|
auto to_file_path = utils::path::absolute(
|
||||||
utils::path::combine(mount_location, {"to_rename_file_test"}));
|
utils::path::combine(mount_location, {"to_rename_file_test"}));
|
||||||
test_rename_file(file_path, to_file_path, *provider_ptr);
|
test_rename_file(file_path, to_file_path,
|
||||||
EXPECT_TRUE(utils::file::retry_delete_file(file_path));
|
provider_ptr->is_rename_supported());
|
||||||
EXPECT_TRUE(utils::file::retry_delete_file(to_file_path));
|
EXPECT_TRUE(utils::file::retry_delete_file(file_path));
|
||||||
|
EXPECT_TRUE(utils::file::retry_delete_file(to_file_path));
|
||||||
|
|
||||||
file_path = utils::path::absolute(
|
file_path = utils::path::absolute(
|
||||||
utils::path::combine(mount_location, {"from_rename_dir_test"}));
|
utils::path::combine(mount_location, {"from_rename_dir_test"}));
|
||||||
to_file_path = utils::path::absolute(
|
to_file_path = utils::path::absolute(
|
||||||
utils::path::combine(mount_location, {"to_rename_dir_test"}));
|
utils::path::combine(mount_location, {"to_rename_dir_test"}));
|
||||||
test_rename_directory(file_path, to_file_path, *provider_ptr);
|
test_rename_directory(file_path, to_file_path,
|
||||||
EXPECT_TRUE(utils::file::retry_delete_directory(file_path.c_str()));
|
provider_ptr->is_rename_supported());
|
||||||
EXPECT_TRUE(
|
EXPECT_TRUE(utils::file::retry_delete_directory(file_path.c_str()));
|
||||||
utils::file::retry_delete_directory(to_file_path.c_str()));
|
EXPECT_TRUE(utils::file::retry_delete_directory(to_file_path.c_str()));
|
||||||
|
|
||||||
file_path =
|
file_path = create_file_and_test(mount_location, "truncate_file_test");
|
||||||
create_file_and_test(mount_location, "truncate_file_test");
|
test_truncate(file_path);
|
||||||
test_truncate(file_path);
|
unlink_file_and_test(file_path);
|
||||||
unlink_file_and_test(file_path);
|
|
||||||
|
|
||||||
file_path =
|
file_path = create_file_and_test(mount_location, "ftruncate_file_test");
|
||||||
create_file_and_test(mount_location, "ftruncate_file_test");
|
test_ftruncate(file_path);
|
||||||
test_ftruncate(file_path);
|
unlink_file_and_test(file_path);
|
||||||
unlink_file_and_test(file_path);
|
|
||||||
|
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
file_path =
|
file_path = create_file_and_test(mount_location, "fallocate_file_test");
|
||||||
create_file_and_test(mount_location, "fallocate_file_test");
|
test_fallocate(utils::path::create_api_path("fallocate_file_test"),
|
||||||
test_fallocate(utils::path::create_api_path("fallocate_file_test"),
|
file_path);
|
||||||
file_path, *provider_ptr);
|
unlink_file_and_test(file_path);
|
||||||
unlink_file_and_test(file_path);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
file_path =
|
file_path = create_file_and_test(mount_location, "write_fails_ro_test");
|
||||||
create_file_and_test(mount_location, "write_fails_ro_test");
|
test_write_operations_fail_if_read_only(
|
||||||
test_write_operations_fail_if_read_only(
|
utils::path::create_api_path("write_fails_ro_test"), file_path);
|
||||||
utils::path::create_api_path("write_fails_ro_test"), file_path,
|
unlink_file_and_test(file_path);
|
||||||
*provider_ptr);
|
|
||||||
unlink_file_and_test(file_path);
|
|
||||||
|
|
||||||
file_path = create_file_and_test(mount_location, "getattr.txt");
|
file_path = create_file_and_test(mount_location, "getattr.txt");
|
||||||
test_file_getattr(utils::path::create_api_path("getattr.txt"),
|
test_file_getattr(utils::path::create_api_path("getattr.txt"),
|
||||||
file_path, *provider_ptr);
|
file_path);
|
||||||
unlink_file_and_test(file_path);
|
unlink_file_and_test(file_path);
|
||||||
|
|
||||||
file_path = utils::path::combine(mount_location, {"getattr_dir"});
|
file_path = utils::path::combine(mount_location, {"getattr_dir"});
|
||||||
test_directory_getattr(utils::path::create_api_path("getattr_dir"),
|
test_directory_getattr(utils::path::create_api_path("getattr_dir"),
|
||||||
file_path, *provider_ptr);
|
file_path);
|
||||||
rmdir_and_test(file_path);
|
rmdir_and_test(file_path);
|
||||||
|
|
||||||
#if !__APPLE__ && HAS_SETXATTR
|
#if !__APPLE__ && HAS_SETXATTR
|
||||||
file_path =
|
file_path =
|
||||||
create_file_and_test(mount_location, "xattr_invalid_names_test");
|
create_file_and_test(mount_location, "xattr_invalid_names_test");
|
||||||
test_xattr_invalid_parameters(file_path);
|
test_xattr_invalid_parameters(file_path);
|
||||||
unlink_file_and_test(file_path);
|
unlink_file_and_test(file_path);
|
||||||
|
|
||||||
file_path =
|
file_path =
|
||||||
create_file_and_test(mount_location, "xattr_create_get_test");
|
create_file_and_test(mount_location, "xattr_create_get_test");
|
||||||
test_xattr_create_and_get(file_path);
|
test_xattr_create_and_get(file_path);
|
||||||
unlink_file_and_test(file_path);
|
unlink_file_and_test(file_path);
|
||||||
|
|
||||||
file_path =
|
file_path =
|
||||||
create_file_and_test(mount_location, "xattr_listxattr_test");
|
create_file_and_test(mount_location, "xattr_listxattr_test");
|
||||||
test_xattr_listxattr(file_path);
|
test_xattr_listxattr(file_path);
|
||||||
unlink_file_and_test(file_path);
|
unlink_file_and_test(file_path);
|
||||||
|
|
||||||
file_path =
|
file_path = create_file_and_test(mount_location, "xattr_replace_test");
|
||||||
create_file_and_test(mount_location, "xattr_replace_test");
|
test_xattr_replace(file_path);
|
||||||
test_xattr_replace(file_path);
|
unlink_file_and_test(file_path);
|
||||||
unlink_file_and_test(file_path);
|
|
||||||
|
|
||||||
file_path =
|
file_path =
|
||||||
create_file_and_test(mount_location, "xattr_default_create_test");
|
create_file_and_test(mount_location, "xattr_default_create_test");
|
||||||
test_xattr_default_create(file_path);
|
test_xattr_default_create(file_path);
|
||||||
unlink_file_and_test(file_path);
|
unlink_file_and_test(file_path);
|
||||||
|
|
||||||
file_path = create_file_and_test(mount_location,
|
file_path =
|
||||||
"xattr_default_replace_test");
|
create_file_and_test(mount_location, "xattr_default_replace_test");
|
||||||
test_xattr_default_replace(file_path);
|
test_xattr_default_replace(file_path);
|
||||||
unlink_file_and_test(file_path);
|
unlink_file_and_test(file_path);
|
||||||
|
|
||||||
file_path = create_file_and_test(mount_location,
|
file_path = create_file_and_test(mount_location,
|
||||||
"xattr_create_fails_exists_test");
|
"xattr_create_fails_exists_test");
|
||||||
test_xattr_create_fails_if_exists(file_path);
|
test_xattr_create_fails_if_exists(file_path);
|
||||||
unlink_file_and_test(file_path);
|
unlink_file_and_test(file_path);
|
||||||
|
|
||||||
file_path = create_file_and_test(
|
file_path = create_file_and_test(mount_location,
|
||||||
mount_location, "xattr_create_fails_not_exists_test");
|
"xattr_create_fails_not_exists_test");
|
||||||
test_xattr_create_fails_if_not_exists(file_path);
|
test_xattr_create_fails_if_not_exists(file_path);
|
||||||
unlink_file_and_test(file_path);
|
unlink_file_and_test(file_path);
|
||||||
|
|
||||||
file_path =
|
file_path =
|
||||||
create_file_and_test(mount_location, "xattr_removexattr_test");
|
create_file_and_test(mount_location, "xattr_removexattr_test");
|
||||||
test_xattr_removexattr(file_path);
|
test_xattr_removexattr(file_path);
|
||||||
unlink_file_and_test(file_path);
|
unlink_file_and_test(file_path);
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
execute_unmount(*provider_ptr, mount_location);
|
execute_unmount(mount_location);
|
||||||
});
|
});
|
||||||
|
|
||||||
auto drive_args =
|
drive_args.push_back(mount_location);
|
||||||
std::vector<std::string>({"unittests", "-f", mount_location});
|
execute_mount(config_ptr->get_data_directory(), drive_args, th);
|
||||||
execute_mount(*config_ptr, *lock_data_ptr, *provider_ptr, drive_args, th);
|
|
||||||
|
|
||||||
ec.wait_for_empty();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPECT_TRUE(utils::file::delete_directory_recursively(mount_location));
|
EXPECT_TRUE(utils::file::delete_directory_recursively(mount_location));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user