updated build system

This commit is contained in:
2024-08-02 11:14:28 -05:00
parent 1cebaf83e1
commit a383fb405e
27 changed files with 113 additions and 132 deletions

View File

@@ -30,6 +30,7 @@
#include "types/repertory.hpp"
#include "utils/file_utils.hpp"
#include "utils/path.hpp"
#include "utils/time.hpp"
#include "utils/utils.hpp"
namespace repertory {
@@ -67,10 +68,10 @@ public:
dir_item.size = 0;
dir_item.meta = {
{META_ATTRIBUTES, "16"},
{META_MODIFIED, std::to_string(utils::get_file_time_now())},
{META_WRITTEN, std::to_string(utils::get_file_time_now())},
{META_ACCESSED, std::to_string(utils::get_file_time_now())},
{META_CREATION, std::to_string(utils::get_file_time_now())}};
{META_MODIFIED, std::to_string(utils::time::get_file_time_now())},
{META_WRITTEN, std::to_string(utils::time::get_file_time_now())},
{META_ACCESSED, std::to_string(utils::time::get_file_time_now())},
{META_CREATION, std::to_string(utils::time::get_file_time_now())}};
list.emplace_back(dir_item);
dir_item.api_path = "..";

View File

@@ -28,6 +28,7 @@
#include "drives/winfsp/i_winfsp_drive.hpp"
#include "utils/file_utils.hpp"
#include "utils/path.hpp"
#include "utils/time.hpp"
#include "utils/utils.hpp"
namespace repertory {
@@ -53,11 +54,12 @@ public:
di.api_path = ".";
di.directory = true;
di.size = 0u;
di.meta = {{META_ATTRIBUTES, "16"},
{META_MODIFIED, std::to_string(utils::get_file_time_now())},
{META_WRITTEN, std::to_string(utils::get_file_time_now())},
{META_ACCESSED, std::to_string(utils::get_file_time_now())},
{META_CREATION, std::to_string(utils::get_file_time_now())}};
di.meta = {
{META_ATTRIBUTES, "16"},
{META_MODIFIED, std::to_string(utils::time::get_file_time_now())},
{META_WRITTEN, std::to_string(utils::time::get_file_time_now())},
{META_ACCESSED, std::to_string(utils::time::get_file_time_now())},
{META_CREATION, std::to_string(utils::time::get_file_time_now())}};
list.emplace_back(di);
di.api_path = "..";

View File

@@ -22,8 +22,10 @@
#include "test_common.hpp"
#include "types/repertory.hpp"
#include "utils/collection.hpp"
#include "utils/encrypt.hpp"
#include "utils/file_utils.hpp"
#include "utils/string.hpp"
namespace repertory {
static const std::string buffer = "cow moose dog chicken";
@@ -41,7 +43,7 @@ static void test_encrypted_result(const data_buffer &result) {
TEST(encryption, generate_key) {
const auto key = utils::encryption::generate_key(token);
const auto str = utils::to_hex_string(key);
const auto str = utils::collection::to_hex_string(key);
EXPECT_STREQ(
"182072537ada59e4d6b18034a80302ebae935f66adbdf0f271d3d36309c2d481",
str.c_str());

View File

@@ -36,6 +36,7 @@
#include "utils/path.hpp"
#include "utils/polling.hpp"
#include "utils/string.hpp"
#include "utils/time.hpp"
#include "utils/utils.hpp"
namespace repertory {
@@ -115,7 +116,7 @@ TEST(file_manager, can_create_and_close_file) {
{
std::shared_ptr<i_open_file> f;
const auto now = utils::get_file_time_now();
const auto now = utils::time::get_file_time_now();
auto meta = create_meta_attributes(
now, FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_ARCHIVE, now + 1u,
now + 2u, false, 1, "key", 2, now + 3u, 3u, 4u, 0u, source_path, 10,
@@ -230,7 +231,7 @@ TEST(file_manager, can_open_and_close_file) {
std::uint64_t handle{};
{
const auto now = utils::get_file_time_now();
const auto now = utils::time::get_file_time_now();
auto meta = create_meta_attributes(
now, FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_ARCHIVE, now + 1u,
now + 2u, false, 1, "key", 2, now + 3u, 3u, 4u, 0u, source_path, 10,
@@ -337,7 +338,7 @@ TEST(file_manager, can_open_and_close_multiple_handles_for_same_file) {
const auto source_path = utils::path::combine(
cfg.get_cache_directory(), {utils::create_uuid_string()});
const auto now = utils::get_file_time_now();
const auto now = utils::time::get_file_time_now();
auto meta = create_meta_attributes(
now, FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_ARCHIVE, now + 1u,
now + 2u, false, 1, "key", 2, now + 3u, 3u, 4u, 0u, source_path, 10,
@@ -417,7 +418,7 @@ TEST(file_manager, download_is_stored_after_write_if_partially_downloaded) {
event_capture ec({"download_stored"},
{"file_upload_completed", "file_upload_queued"});
const auto now = utils::get_file_time_now();
const auto now = utils::time::get_file_time_now();
auto meta = create_meta_attributes(
now, FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_ARCHIVE, now + 1u, now + 2u,
false, 1, "key", 2, now + 3u, 3u, 4u,
@@ -580,7 +581,7 @@ TEST(file_manager, upload_occurs_after_write_if_fully_downloaded) {
});
event_capture ec({"download_end"});
const auto now = utils::get_file_time_now();
const auto now = utils::time::get_file_time_now();
auto meta = create_meta_attributes(
now, FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_ARCHIVE, now + 1u, now + 2u,
false, 1, "key", 2, now + 3u, 3u, 4u,
@@ -691,7 +692,7 @@ TEST(file_manager, can_evict_file) {
const auto source_path = utils::path::combine(
cfg.get_cache_directory(), {utils::create_uuid_string()});
const auto now = utils::get_file_time_now();
const auto now = utils::time::get_file_time_now();
auto meta = create_meta_attributes(
now, FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_ARCHIVE, now + 1u, now + 2u,
@@ -957,7 +958,7 @@ TEST(file_manager, evict_file_fails_if_file_is_uploading) {
const auto source_path = utils::path::combine(
cfg.get_cache_directory(), {utils::create_uuid_string()});
const auto now = utils::get_file_time_now();
const auto now = utils::time::get_file_time_now();
auto meta = create_meta_attributes(
now, FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_ARCHIVE, now + 1u, now + 2u,
@@ -1189,7 +1190,7 @@ TEST(file_manager, file_is_not_opened_if_provider_create_file_fails) {
EXPECT_CALL(mp, is_direct_only()).WillRepeatedly(Return(false));
const auto now = utils::get_file_time_now();
const auto now = utils::time::get_file_time_now();
auto meta = create_meta_attributes(
now, FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_ARCHIVE, now + 1u, now + 2u,
false, 1, "", 2, now + 3u, 3u, 4u, 0u, "/test_create.src", 10,
@@ -1741,7 +1742,7 @@ TEST(file_manager, file_is_closed_after_download_timeout) {
ee.get_api_path().get<std::string>().c_str());
});
const auto now = utils::get_file_time_now();
const auto now = utils::time::get_file_time_now();
auto meta = create_meta_attributes(
now, FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_ARCHIVE, now + 1u, now + 2u,
false, 1, "key", 2, now + 3u, 3u, 4u,

View File

@@ -33,8 +33,8 @@
#include "utils/file_utils.hpp"
#include "utils/path.hpp"
#include "utils/string.hpp"
#include "utils/time.hpp"
#include "utils/utils.hpp"
#include "gtest/gtest.h"
namespace {
#if defined(_WIN32)
@@ -57,7 +57,7 @@ const auto check_forced_dirs = [](const repertory::directory_item_list &list) {
const auto create_directory = [](repertory::i_provider &provider,
const std::string &api_path) {
auto date = repertory::utils::get_file_time_now();
auto date = repertory::utils::time::get_file_time_now();
auto meta = repertory::create_meta_attributes(
date, 1U, date + 1U, date + 2U, true, getgid(), "", 0700, date + 3U, 2U,
3U, 0U, api_path + "_src", getuid(), date + 4U);
@@ -110,7 +110,7 @@ const auto create_file = [](repertory::i_provider &provider,
auto source_path = repertory::generate_test_file_name(
repertory::get_test_dir(), "providers_test");
auto date = repertory::utils::get_file_time_now();
auto date = repertory::utils::time::get_file_time_now();
auto meta = repertory::create_meta_attributes(
date, 1U, date + 1U, date + 2U, false, getgid(), "", 0700, date + 3U, 2U,
3U, 0U, source_path, getuid(), date + 4U);

View File

@@ -34,6 +34,7 @@
#endif
#include "drives/fuse/remotefuse/remote_client.hpp"
#include "types/repertory.hpp"
#include "utils/time.hpp"
#include "utils/utils.hpp"
using namespace repertory;
@@ -685,7 +686,7 @@ static void setbkuptime_test(repertory::remote_fuse::remote_client &client) {
if (ret == 0) {
EXPECT_EQ(0, client.fuse_release(api_path.c_str(), handle));
remote::file_time ts = utils::get_file_time_now();
remote::file_time ts = utils::time::get_file_time_now();
#if defined(_WIN32)
EXPECT_EQ(NOT_IMPLEMENTED, client.fuse_setbkuptime(api_path.c_str(), ts));
#else
@@ -710,7 +711,7 @@ static void setchgtime_test(repertory::remote_fuse::remote_client &client) {
if (ret == 0) {
EXPECT_EQ(0, client.fuse_release(api_path.c_str(), handle));
remote::file_time ts = utils::get_file_time_now();
remote::file_time ts = utils::time::get_file_time_now();
#if defined(_WIN32)
EXPECT_EQ(NOT_IMPLEMENTED, client.fuse_setchgtime(api_path.c_str(), ts));
#else
@@ -735,7 +736,7 @@ static void setcrtime_test(repertory::remote_fuse::remote_client &client) {
if (ret == 0) {
EXPECT_EQ(0, client.fuse_release(api_path.c_str(), handle));
remote::file_time ts = utils::get_file_time_now();
remote::file_time ts = utils::time::get_file_time_now();
#if defined(_WIN32)
EXPECT_EQ(NOT_IMPLEMENTED, client.fuse_setcrtime(api_path.c_str(), ts));
#else