Compare commits
17 Commits
v2.0.5-rc
...
c0e720498d
Author | SHA1 | Date | |
---|---|---|---|
c0e720498d | |||
383c3b4be6 | |||
e9b202f5c8 | |||
bc3005a6a4 | |||
8cf19e0594 | |||
b137b57dbc | |||
5dff8927da | |||
197e79dd07 | |||
6262aca761 | |||
c156ae704b | |||
a67979ec40 | |||
54bfc11620 | |||
d33c2cd3a2 | |||
3a5f428fb6 | |||
0331152569 | |||
1b7e854f5f | |||
12a945d863 |
@ -144,6 +144,7 @@ lptr
|
||||
lpwstr
|
||||
lzma
|
||||
makefiles
|
||||
markdownlint
|
||||
mbig
|
||||
mockwinfspdrive
|
||||
mqtt
|
||||
|
@ -6,7 +6,7 @@ pipeline {
|
||||
environment {
|
||||
BUILD_ARGS = '--build . -j 8'
|
||||
CONFIGURE_ARGS = '../.. -DCMAKE_BUILD_TYPE=Release -DREPERTORY_ENABLE_S3=ON'
|
||||
CONFIGURE_MINGW64_ARGS = '../.. -DCMAKE_BUILD_TYPE=Release -DREPERTORY_ENABLE_S3=ON -DCMAKE_TOOLCHAIN_FILE=../../cmake/mingw-w64-x86_64.cmake'
|
||||
CONFIGURE_MINGW64_ARGS = '../.. -DCMAKE_BUILD_TYPE=Release -DREPERTORY_ENABLE_S3=ON -DCMAKE_TOOLCHAIN_FILE=${WORKSPACE}/cmake/mingw-w64-x86_64.cmake'
|
||||
REPERTORY_TEST_DIR = "${HOME}/.ci/cfg"
|
||||
}
|
||||
|
||||
|
@ -1,39 +0,0 @@
|
||||
#!groovy
|
||||
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
environment {
|
||||
REPERTORY_TEST_DIR = "C:\\.ci\\cfg"
|
||||
}
|
||||
|
||||
options {
|
||||
disableConcurrentBuilds()
|
||||
retry(2)
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('clean') {
|
||||
steps {
|
||||
bat 'del /q build\\Release\\librepertory.lib || exit 0'
|
||||
bat 'del /q build\\Release\\unittests.exe || exit 0'
|
||||
bat 'del /q build\\Release\\repertory.exe || exit 0'
|
||||
}
|
||||
}
|
||||
|
||||
stage('configure') {
|
||||
steps {
|
||||
cmake arguments: '.. -DCMAKE_BUILD_TYPE=Release -DREPERTORY_ENABLE_S3=ON', installation: 'InSearchPath', workingDir: 'build'
|
||||
}
|
||||
}
|
||||
|
||||
stage('build') {
|
||||
steps {
|
||||
retry(2) {
|
||||
sleep time: 5, unit: 'SECONDS'
|
||||
cmake arguments: '--build . --target ALL_BUILD --config Release -j 4', installation: 'InSearchPath', workingDir: 'build'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
15
CHANGELOG.md
15
CHANGELOG.md
@ -1,7 +1,22 @@
|
||||
# Changelog
|
||||
|
||||
## 2.0.1-rc
|
||||
|
||||
### Issues
|
||||
|
||||
* \#10 Address compiler warnings
|
||||
|
||||
### Changes from v2.0.0-rc
|
||||
|
||||
* Removed MSVC compilation support (MinGW-64 should be used)
|
||||
* Upgraded `boost` to v1.83.0
|
||||
* Upgraded `curl` to v8.4.0
|
||||
* Upgraded `libsodium` to v1.0.19
|
||||
* Upgraded `rocksdb` to v8.6.7
|
||||
|
||||
## 2.0.0-rc
|
||||
|
||||
<!-- markdownlint-disable-next-line -->
|
||||
### Issues
|
||||
|
||||
* \#1 \[bug\] Unable to mount S3 due to 'item_not_found' exception
|
||||
|
@ -11,7 +11,7 @@ include(ExternalProject)
|
||||
|
||||
set(REPERTORY_MAJOR 2)
|
||||
set(REPERTORY_MINOR 0)
|
||||
set(REPERTORY_REV 0)
|
||||
set(REPERTORY_REV 1)
|
||||
set(REPERTORY_RELEASE_NUM 0)
|
||||
set(REPERTORY_RELEASE_ITER rc)
|
||||
set(REPERTORY_VERSION ${REPERTORY_MAJOR}.${REPERTORY_MINOR}.${REPERTORY_REV}-${REPERTORY_RELEASE_ITER})
|
||||
@ -44,17 +44,6 @@ if (UNIX)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (MSVC OR MINGW)
|
||||
set(WINFSP_LIBRARY_BASENAME winfsp-x64)
|
||||
|
||||
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/3rd_party/winfsp-${WINFSP_VERSION}/inc)
|
||||
link_directories(${CMAKE_SOURCE_DIR}/3rd_party/winfsp-${WINFSP_VERSION}/lib)
|
||||
set(REPERTORY_LINK_LIBRARIES
|
||||
${REPERTORY_LINK_LIBRARIES}
|
||||
${WINFSP_LIBRARY_BASENAME}.lib
|
||||
)
|
||||
endif()
|
||||
|
||||
if (LINUX OR MINGW)
|
||||
if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
|
||||
message(FATAL_ERROR "Require at least gcc-8.0")
|
||||
@ -163,27 +152,20 @@ elseif (MACOS)
|
||||
"-framework SystemConfiguration"
|
||||
)
|
||||
elseif (MSVC)
|
||||
set(OPENSSL_USE_STATIC_LIBS TRUE)
|
||||
if (NOT OPENSSL_ROOT_DIR)
|
||||
set (OPENSSL_ROOT_DIR "$ENV{USERPROFILE}\\scoop\\apps\\openssl\\current")
|
||||
endif()
|
||||
find_package(OpenSSL 1.1.1 REQUIRED)
|
||||
set(OPENSSL_LIBRARIES OpenSSL::SSL OpenSSL::Crypto)
|
||||
set(REPERTORY_DEFINITIONS ${REPERTORY_DEFINITIONS} -D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING)
|
||||
|
||||
if (NOT CMAKE_GENERATOR_LOWER STREQUAL "nmake makefiles")
|
||||
set(REPERTORY_OUTPUT_DIR ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE})
|
||||
endif()
|
||||
message(FATAL_ERROR "MSVC is currently not supported [MinGW-64 should be used]")
|
||||
endif()
|
||||
|
||||
if (MINGW)
|
||||
set(WINFSP_LIBRARY_BASENAME winfsp-x64)
|
||||
|
||||
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/3rd_party/winfsp-${WINFSP_VERSION}/inc)
|
||||
link_directories(${CMAKE_SOURCE_DIR}/3rd_party/winfsp-${WINFSP_VERSION}/lib)
|
||||
set(REPERTORY_LINK_LIBRARIES
|
||||
${REPERTORY_LINK_LIBRARIES}
|
||||
${WINFSP_LIBRARY_BASENAME}.lib
|
||||
mswsock
|
||||
)
|
||||
endif()
|
||||
|
||||
if (MSVC OR MINGW)
|
||||
set(REPERTORY_VER_FILEVERSION ${REPERTORY_MAJOR},${REPERTORY_MINOR},${REPERTORY_REV},${REPERTORY_RELEASE_NUM})
|
||||
set(REPERTORY_VER_FILEVERSION_STR ${REPERTORY_MAJOR}.${REPERTORY_MINOR}.${REPERTORY_REV}.${REPERTORY_RELEASE_NUM})
|
||||
set(REPERTORY_VER_PRODUCTVERSION ${REPERTORY_MAJOR},${REPERTORY_MINOR},${REPERTORY_REV},${REPERTORY_RELEASE_NUM})
|
||||
@ -195,10 +177,6 @@ if (MSVC OR MINGW)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.rc.in ${CMAKE_CURRENT_SOURCE_DIR}/src/version.rc @ONLY)
|
||||
set(WINDOWS_VERSION_RC ${CMAKE_CURRENT_SOURCE_DIR}/src/version.rc)
|
||||
|
||||
if (MSVC)
|
||||
set(LIB_EXT .lib)
|
||||
endif()
|
||||
|
||||
set(REPERTORY_LINK_LIBRARIES
|
||||
${REPERTORY_LINK_LIBRARIES}
|
||||
advapi32${LIB_EXT}
|
||||
|
@ -2,10 +2,11 @@ set(BOOST_PROJECT_NAME boost_${BOOST_VERSION})
|
||||
set(BOOST_BUILD_ROOT ${EXTERNAL_BUILD_ROOT}/builds/${BOOST_PROJECT_NAME})
|
||||
|
||||
set(BOOST_ADDRESS_MODEL 64)
|
||||
set(BOOST_DLL_ARCH x64)
|
||||
set(BOOST_DOWNLOAD_URL https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION_DL}.tar.gz)
|
||||
set(BOOST_VERSION ${BOOST_MAJOR_VERSION}.${BOOST_MINOR_VERSION}.${BOOST_REVISION})
|
||||
set(BOOST_VERSION2 ${BOOST_MAJOR_VERSION}_${BOOST_MINOR_VERSION}_${BOOST_REVISION})
|
||||
|
||||
set(BOOST_DOWNLOAD_URL https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION2}.tar.gz)
|
||||
|
||||
if (UNIX OR MINGW)
|
||||
if (IS_CLANG_COMPILER)
|
||||
set(BOOST_TOOLSET --with-toolset=clang)
|
||||
else ()
|
||||
@ -31,6 +32,9 @@ if (UNIX OR MINGW)
|
||||
linkflags=-std=c++${CMAKE_CXX_STANDARD}
|
||||
threading=multi
|
||||
variant=${CMAKE_BUILD_TYPE_LOWER}
|
||||
-sZLIB_BINARY=zlibstatic${DEBUG_EXTRA}
|
||||
-sZLIB_LIBPATH="${EXTERNAL_BUILD_ROOT}/lib"
|
||||
-sZLIB_INCLUDE="${EXTERNAL_BUILD_ROOT}/include"
|
||||
)
|
||||
|
||||
if (MINGW)
|
||||
@ -84,54 +88,5 @@ if (UNIX OR MINGW)
|
||||
libboost_serialization${BOOST_LIB_EXTRA}.a
|
||||
libboost_thread${BOOST_LIB_EXTRA}.a
|
||||
)
|
||||
elseif(MSVC)
|
||||
set (BOOST_COMMON_ARGS
|
||||
--with-date_time
|
||||
--with-regex
|
||||
--with-serialization
|
||||
--with-system
|
||||
--with-filesystem
|
||||
--prefix=${EXTERNAL_BUILD_ROOT}
|
||||
runtime-link=shared
|
||||
threading=multi
|
||||
address-model=${BOOST_ADDRESS_MODEL}
|
||||
architecture=x86
|
||||
toolset=${BOOST_MSVC_TOOLSET}
|
||||
variant=${CMAKE_BUILD_TYPE_LOWER}
|
||||
-sZLIB_BINARY=zlibstatic${DEBUG_EXTRA}
|
||||
-sZLIB_LIBPATH="${EXTERNAL_BUILD_ROOT}/lib"
|
||||
-sZLIB_INCLUDE="${EXTERNAL_BUILD_ROOT}/include"
|
||||
)
|
||||
|
||||
ExternalProject_Add(boost_project
|
||||
DOWNLOAD_NO_PROGRESS 1
|
||||
URL ${BOOST_DOWNLOAD_URL}
|
||||
PREFIX ${BOOST_BUILD_ROOT}
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND
|
||||
bootstrap.bat
|
||||
--with-date_time
|
||||
--with-regex
|
||||
--with-system
|
||||
--with-serialization
|
||||
--with-filesystem
|
||||
BUILD_COMMAND
|
||||
b2.exe
|
||||
${BOOST_COMMON_ARGS}
|
||||
INSTALL_COMMAND
|
||||
b2.exe
|
||||
install
|
||||
${BOOST_COMMON_ARGS}
|
||||
)
|
||||
|
||||
add_dependencies(boost_project zlib_project)
|
||||
set(BOOST_ROOT ${BOOST_BUILD_ROOT}/src/boost_project)
|
||||
set(Boost_INCLUDE_DIR ${EXTERNAL_BUILD_ROOT}/include/boost-${BOOST_VERSION_DLL})
|
||||
set(Boost_LIBRARIES
|
||||
${EXTERNAL_BUILD_ROOT}/lib/libboost_date_time-vc${BOOST_MSVC_TOOLSET_DLL}-mt-${BOOST_DEBUG_EXTRA}${BOOST_DLL_ARCH}-${BOOST_VERSION_DLL}.lib
|
||||
${EXTERNAL_BUILD_ROOT}/lib/libboost_filesystem-vc${BOOST_MSVC_TOOLSET_DLL}-mt-${BOOST_DEBUG_EXTRA}${BOOST_DLL_ARCH}-${BOOST_VERSION_DLL}.lib
|
||||
${EXTERNAL_BUILD_ROOT}/lib/libboost_regex-vc${BOOST_MSVC_TOOLSET_DLL}-mt-${BOOST_DEBUG_EXTRA}${BOOST_DLL_ARCH}-${BOOST_VERSION_DLL}.lib
|
||||
${EXTERNAL_BUILD_ROOT}/lib/libboost_serialization-vc${BOOST_MSVC_TOOLSET_DLL}-mt-${BOOST_DEBUG_EXTRA}${BOOST_DLL_ARCH}-${BOOST_VERSION_DLL}.lib
|
||||
${EXTERNAL_BUILD_ROOT}/lib/libboost_system-vc${BOOST_MSVC_TOOLSET_DLL}-mt-${BOOST_DEBUG_EXTRA}${BOOST_DLL_ARCH}-${BOOST_VERSION_DLL}.lib
|
||||
)
|
||||
endif()
|
||||
|
@ -31,14 +31,20 @@ set(CURL_CMAKE_ARGS
|
||||
-DUSE_LIBIDN2=OFF
|
||||
)
|
||||
|
||||
if (MINGW AND CMAKE_TOOLCHAIN_FILE)
|
||||
if (CMAKE_TOOLCHAIN_FILE)
|
||||
set(CURL_CMAKE_ARGS
|
||||
${CURL_CMAKE_ARGS}
|
||||
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
|
||||
)
|
||||
endif()
|
||||
|
||||
if (MINGW)
|
||||
set(CURL_CMAKE_ARGS
|
||||
${CURL_CMAKE_ARGS}
|
||||
-DCURL_USE_OPENSSL=OFF
|
||||
-DUSE_WIN32_CRYPTO=ON
|
||||
)
|
||||
elseif(NOT MINGW)
|
||||
else()
|
||||
set(CURL_CMAKE_ARGS
|
||||
${CURL_CMAKE_ARGS}
|
||||
-DCURL_USE_OPENSSL=ON
|
||||
@ -54,9 +60,8 @@ ExternalProject_Add(curl_project
|
||||
|
||||
set(REPERTORY_DEFINITIONS ${REPERTORY_DEFINITIONS} -DCURL_STATICLIB=ON -DCURL_DISABLE_LDAP=ON)
|
||||
|
||||
if (MSVC)
|
||||
set(CURL_LIBRARIES ${EXTERNAL_BUILD_ROOT}/lib/libcurl${DEBUG_EXTRA2}${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||
else()
|
||||
set(CURL_LIBRARIES libcurl${DEBUG_EXTRA2}${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||
add_dependencies(curl_project openssl_project)
|
||||
endif()
|
||||
add_dependencies(curl_project
|
||||
openssl_project
|
||||
zlib_project
|
||||
)
|
||||
|
@ -73,41 +73,6 @@ if (UNIX OR MINGW)
|
||||
${REPERTORY_COMMON_FLAG_LIST}
|
||||
-std=c++${CMAKE_CXX_STANDARD}
|
||||
)
|
||||
elseif (MSVC)
|
||||
set(REPERTORY_C_FLAGS_LIST
|
||||
${REPERTORY_C_FLAGS_LIST}
|
||||
/D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING
|
||||
/DNOMINMAX
|
||||
/bigobj
|
||||
/Zi
|
||||
)
|
||||
|
||||
set(REPERTORY_CXX_FLAGS_LIST
|
||||
${REPERTORY_CXX_FLAGS_LIST}
|
||||
/D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING
|
||||
/DNOMINMAX
|
||||
/bigobj
|
||||
/Zi
|
||||
)
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(REPERTORY_C_FLAGS_LIST
|
||||
${REPERTORY_C_FLAGS_LIST}
|
||||
/DEBUG
|
||||
)
|
||||
|
||||
set(REPERTORY_CXX_FLAGS_LIST
|
||||
${REPERTORY_CXX_FLAGS_LIST}
|
||||
/DEBUG
|
||||
)
|
||||
|
||||
set(REPERTORY_SHARED_LINKER_FLAGS_LIST
|
||||
${REPERTORY_SHARED_LINKER_FLAGS_LIST}
|
||||
/DEBUG
|
||||
/OPT:REF
|
||||
/OPT:ICF
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(JOIN REPERTORY_CXX_FLAGS_LIST " " REPERTORY_CXX_FLAGS_LIST)
|
||||
|
@ -1,5 +1,5 @@
|
||||
function(copy_support_files target)
|
||||
if (MSVC OR MINGW)
|
||||
if (MINGW)
|
||||
add_custom_command(
|
||||
TARGET ${target}
|
||||
POST_BUILD
|
||||
|
@ -16,17 +16,11 @@ add_dependencies(librepertory
|
||||
boost_project
|
||||
curl_project
|
||||
libsodium_project
|
||||
openssl_project
|
||||
rocksdb_project
|
||||
zlib_project
|
||||
)
|
||||
|
||||
if (LINUX)
|
||||
add_dependencies(librepertory libuuid_project)
|
||||
endif()
|
||||
|
||||
if (LINUX OR MINGW OR MACOS)
|
||||
add_dependencies(librepertory openssl_project)
|
||||
endif()
|
||||
|
||||
if (MSVC OR MINGW)
|
||||
add_dependencies(librepertory zlib_project)
|
||||
endif()
|
||||
|
@ -2,28 +2,6 @@ set(LIBSODIUM_PROJECT_NAME libsodium_${LIBSODIUM_VERSION})
|
||||
set(LIBSODIUM_BUILD_ROOT ${EXTERNAL_BUILD_ROOT}/builds/${LIBSODIUM_PROJECT_NAME})
|
||||
set(LIBSODIUM_BUILD_TYPE ${EXTERNAL_BUILD_TYPE})
|
||||
|
||||
if (MSVC)
|
||||
ExternalProject_Add(libsodium_project
|
||||
DOWNLOAD_NO_PROGRESS 1
|
||||
PREFIX ${LIBSODIUM_BUILD_ROOT}
|
||||
BUILD_IN_SOURCE 1
|
||||
URL https://github.com/jedisct1/libsodium/releases/download/${LIBSODIUM_VERSION}-RELEASE/libsodium-${LIBSODIUM_VERSION}.tar.gz
|
||||
CONFIGURE_COMMAND echo "Skipping Configure"
|
||||
BUILD_COMMAND cd builds\\msvc\\vs2019 && msbuild
|
||||
libsodium.sln
|
||||
/p:Configuration=Static${LIBSODIUM_BUILD_TYPE}
|
||||
/p:Platform=x64
|
||||
/t:libsodium
|
||||
INSTALL_COMMAND echo "Skipping Install"
|
||||
)
|
||||
link_directories(PRIVATE ${LIBSODIUM_BUILD_ROOT}/src/libsodium_project/bin/x64/${LIBSODIUM_BUILD_TYPE}/v142/static)
|
||||
set(LIBSODIUM_LIBRARIES libsodium.lib)
|
||||
add_definitions(-DSODIUM_STATIC)
|
||||
include_directories(SYSTEM
|
||||
${LIBSODIUM_BUILD_ROOT}/src/libsodium_project/src/libsodium/include
|
||||
${LIBSODIUM_BUILD_ROOT}/src/libsodium_project/builds/msvc
|
||||
)
|
||||
else()
|
||||
if (MINGW)
|
||||
set(LIBSODIUM_HOST --host=x86_64-w64-mingw32)
|
||||
endif()
|
||||
@ -43,5 +21,7 @@ else()
|
||||
BUILD_COMMAND make
|
||||
INSTALL_COMMAND make install
|
||||
)
|
||||
|
||||
set(LIBSODIUM_LIBRARIES libsodium.a)
|
||||
endif()
|
||||
|
||||
add_dependencies(libsodium_project zlib_project)
|
||||
|
@ -14,4 +14,7 @@ if (LINUX)
|
||||
INSTALL_COMMAND make install
|
||||
)
|
||||
set(LIBUUID_LIBRARIES libuuid.a)
|
||||
|
||||
add_dependencies(libuuid_project zlib_project)
|
||||
endif()
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
if (MACOS OR LINUX OR MINGW)
|
||||
if (IS_CLANG_COMPILER)
|
||||
set(OPENSSL_COMPILE_TYPE_EXTRA -clang)
|
||||
endif()
|
||||
@ -29,15 +28,9 @@ if (MACOS OR LINUX OR MINGW)
|
||||
INSTALL_COMMAND make install
|
||||
)
|
||||
|
||||
if (MACOS)
|
||||
set(OPENSSL_LIBRARIES
|
||||
${EXTERNAL_BUILD_ROOT}/lib/libssl.a
|
||||
${EXTERNAL_BUILD_ROOT}/lib/libcrypto.a
|
||||
)
|
||||
else()
|
||||
set(OPENSSL_LIBRARIES
|
||||
libssl.a
|
||||
libcrypto.a
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_dependencies(openssl_project zlib_project)
|
||||
|
@ -26,23 +26,6 @@ set(ROCKSDB_CMAKE_ARGS
|
||||
-DWITH_TOOLS=OFF
|
||||
)
|
||||
|
||||
if(MSVC)
|
||||
ExternalProject_Add(rocksdb_project
|
||||
DOWNLOAD_NO_PROGRESS 1
|
||||
URL https://github.com/facebook/rocksdb/archive/v${ROCKSDB_VERSION}.tar.gz
|
||||
PREFIX ${ROCKSDB_BUILD_ROOT}
|
||||
CMAKE_ARGS ${ROCKSDB_CMAKE_ARGS}
|
||||
INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "Skipping install step."
|
||||
)
|
||||
|
||||
set(ROCKSDB_INCLUDE_DIRS ${ROCKSDB_BUILD_ROOT}/src/rocksdb_project/include)
|
||||
|
||||
if (CMAKE_GENERATOR_LOWER STREQUAL "nmake makefiles")
|
||||
set(ROCKSDB_LIBRARIES ${ROCKSDB_BUILD_ROOT}/src/rocksdb_project-build/rocksdb.lib)
|
||||
else ()
|
||||
set(ROCKSDB_LIBRARIES ${ROCKSDB_BUILD_ROOT}/src/rocksdb_project-build/${CMAKE_BUILD_TYPE}/rocksdb.lib)
|
||||
endif ()
|
||||
else()
|
||||
if (MINGW)
|
||||
if (CMAKE_TOOLCHAIN_FILE)
|
||||
set(ROCKSDB_CMAKE_ARGS
|
||||
@ -75,8 +58,9 @@ else()
|
||||
set(ROCKSDB_LIBRARIES librocksdb.a)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (MSVC OR LINUX OR MINGW)
|
||||
if (LINUX OR MINGW)
|
||||
add_dependencies(rocksdb_project curl_project)
|
||||
endif()
|
||||
|
||||
add_dependencies(rocksdb_project zlib_project)
|
||||
|
@ -4,20 +4,6 @@ if (REPERTORY_ENABLE_TESTING)
|
||||
|
||||
set(GTEST_PROJECT_NAME gtest_${GTEST_VERSION})
|
||||
set(GTEST_BUILD_ROOT ${EXTERNAL_BUILD_ROOT}/builds/${GTEST_PROJECT_NAME})
|
||||
if (MSVC)
|
||||
ExternalProject_Add(gtest_project
|
||||
DOWNLOAD_NO_PROGRESS 1
|
||||
URL https://github.com/google/googletest/archive/refs/tags/${GTEST_VERSION}.tar.gz
|
||||
PREFIX ${GTEST_BUILD_ROOT}
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=${CMAKE_POSITION_INDEPENDENT_CODE}
|
||||
-DCMAKE_BUILD_TYPE=${EXTERNAL_BUILD_TYPE}
|
||||
-Dgtest_force_shared_crt=OFF
|
||||
-DBUILD_SHARED_LIBS=ON
|
||||
-DCMAKE_CXX_FLAGS=/D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING
|
||||
INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "Skipping install step."
|
||||
)
|
||||
else()
|
||||
if (MACOS)
|
||||
set(GTEST_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
|
||||
set(GTEST_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
|
||||
@ -38,24 +24,13 @@ if (REPERTORY_ENABLE_TESTING)
|
||||
-DCMAKE_BUILD_TYPE=${EXTERNAL_BUILD_TYPE}
|
||||
INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "Skipping install step."
|
||||
)
|
||||
endif()
|
||||
|
||||
set(GTEST_INCLUDE_DIRS
|
||||
${GTEST_BUILD_ROOT}/src/gtest_project/googletest/include
|
||||
${GTEST_BUILD_ROOT}/src/gtest_project/googlemock/include
|
||||
)
|
||||
|
||||
if (MSVC)
|
||||
if (NOT CMAKE_GENERATOR_LOWER STREQUAL "nmake makefiles")
|
||||
set (GTEST_PATH_EXTRA ${CMAKE_BUILD_TYPE}/)
|
||||
endif()
|
||||
set(GTEST_LIBRARIES
|
||||
${GTEST_BUILD_ROOT}/src/gtest_project-build/lib/${GTEST_PATH_EXTRA}gmock${DEBUG_EXTRA}.lib
|
||||
${GTEST_BUILD_ROOT}/src/gtest_project-build/lib/${GTEST_PATH_EXTRA}gmock_main${DEBUG_EXTRA}.lib
|
||||
${GTEST_BUILD_ROOT}/src/gtest_project-build/lib/${GTEST_PATH_EXTRA}gtest${DEBUG_EXTRA}.lib
|
||||
${GTEST_BUILD_ROOT}/src/gtest_project-build/lib/${GTEST_PATH_EXTRA}gtest_main${DEBUG_EXTRA}.lib
|
||||
)
|
||||
elseif (UNIX OR MINGW)
|
||||
if(UNIX OR MINGW)
|
||||
set(GTEST_LIBRARIES
|
||||
${GTEST_BUILD_ROOT}/src/gtest_project-build/lib/libgmock.a
|
||||
${GTEST_BUILD_ROOT}/src/gtest_project-build/lib/libgtest.a
|
||||
@ -72,7 +47,11 @@ if (REPERTORY_ENABLE_TESTING)
|
||||
)
|
||||
|
||||
add_project_executable(unittests "${UNITTEST_SOURCES}")
|
||||
add_dependencies(unittests gtest_project)
|
||||
add_dependencies(unittests
|
||||
gtest_project
|
||||
zlib_project
|
||||
)
|
||||
|
||||
target_compile_definitions(unittests PUBLIC
|
||||
GTEST_LINKED_AS_SHARED_LIBRARY=1
|
||||
REPERTORY_TESTING
|
||||
@ -83,28 +62,5 @@ if (REPERTORY_ENABLE_TESTING)
|
||||
)
|
||||
target_link_libraries(unittests PRIVATE ${GTEST_LIBRARIES})
|
||||
|
||||
if (MSVC)
|
||||
add_custom_command(TARGET unittests
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${GTEST_BUILD_ROOT}/src/gtest_project-build/bin/${GTEST_PATH_EXTRA}gmock${DEBUG_EXTRA}.dll ${CMAKE_CURRENT_BINARY_DIR}/${GTEST_PATH_EXTRA}
|
||||
)
|
||||
add_custom_command(TARGET unittests
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${GTEST_BUILD_ROOT}/src/gtest_project-build/bin/${GTEST_PATH_EXTRA}gmock_main${DEBUG_EXTRA}.dll ${CMAKE_CURRENT_BINARY_DIR}/${GTEST_PATH_EXTRA}
|
||||
)
|
||||
add_custom_command(TARGET unittests
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${GTEST_BUILD_ROOT}/src/gtest_project-build/bin/${GTEST_PATH_EXTRA}gtest${DEBUG_EXTRA}.dll ${CMAKE_CURRENT_BINARY_DIR}/${GTEST_PATH_EXTRA}
|
||||
)
|
||||
add_custom_command(TARGET unittests
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${GTEST_BUILD_ROOT}/src/gtest_project-build/bin/${GTEST_PATH_EXTRA}gtest_main${DEBUG_EXTRA}.dll ${CMAKE_CURRENT_BINARY_DIR}/${GTEST_PATH_EXTRA}
|
||||
)
|
||||
endif()
|
||||
|
||||
if (CMAKE_GENERATOR_LOWER STREQUAL "nmake makefiles")
|
||||
add_test(NAME AllTests COMMAND unittests WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
else()
|
||||
add_test(NAME AllTests COMMAND unittests WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE})
|
||||
endif()
|
||||
endif()
|
||||
|
@ -1,16 +1,11 @@
|
||||
set(BOOST_MAJOR_VERSION 1)
|
||||
set(BOOST_MINOR_VERSION 78)
|
||||
set(BOOST_MSVC_TOOLSET msvc-14.2)
|
||||
set(BOOST_MSVC_TOOLSET_DLL 142)
|
||||
set(BOOST_MINOR_VERSION 83)
|
||||
set(BOOST_REVISION 0)
|
||||
set(BOOST_VERSION ${BOOST_MAJOR_VERSION}.${BOOST_MINOR_VERSION}.${BOOST_REVISION})
|
||||
set(BOOST_VERSION_DL ${BOOST_MAJOR_VERSION}_${BOOST_MINOR_VERSION}_${BOOST_REVISION})
|
||||
set(BOOST_VERSION_DLL ${BOOST_MAJOR_VERSION}_${BOOST_MINOR_VERSION})
|
||||
set(CURL_VERSION 8_3_0)
|
||||
set(CURL_VERSION 8_4_0)
|
||||
set(GTEST_VERSION v1.14.0)
|
||||
set(LIBSODIUM_VERSION 1.0.18)
|
||||
set(LIBSODIUM_VERSION 1.0.19)
|
||||
set(LIBUUID_VERSION 1.6.2)
|
||||
set(OPENSSL_VERSION 1_1_1w)
|
||||
set(ROCKSDB_VERSION 8.5.3)
|
||||
set(ROCKSDB_VERSION 8.6.7)
|
||||
set(WINFSP_VERSION 2.0)
|
||||
set(ZLIB_VERSION v1.3)
|
||||
|
@ -1,4 +1,3 @@
|
||||
if (MSVC OR MINGW)
|
||||
set(ZLIB_PROJECT_NAME zlib_${ZLIB_VERSION})
|
||||
set(ZLIB_BUILD_ROOT ${EXTERNAL_BUILD_ROOT}/builds/${ZLIB_PROJECT_NAME})
|
||||
set(ZLIB_CMAKE_ARGS
|
||||
@ -11,7 +10,7 @@ if (MSVC OR MINGW)
|
||||
-DCMAKE_SHARED_LINKER_FLAGS=${CMAKE_SHARED_LINKER_FLAGS}
|
||||
)
|
||||
|
||||
if (MINGW AND CMAKE_TOOLCHAIN_FILE)
|
||||
if (CMAKE_TOOLCHAIN_FILE)
|
||||
set(ZLIB_CMAKE_ARGS
|
||||
${ZLIB_CMAKE_ARGS}
|
||||
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
|
||||
@ -28,15 +27,5 @@ if (MSVC OR MINGW)
|
||||
if(MINGW)
|
||||
set(ZLIB_LIBRARIES ${EXTERNAL_BUILD_ROOT}/lib/libzlibstatic${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||
else()
|
||||
set(ZLIB_LIBRARIES ${EXTERNAL_BUILD_ROOT}/lib/zlibstatic${DEBUG_EXTRA}${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||
endif()
|
||||
elseif(LINUX)
|
||||
find_library(ZLIB_LIBRARIES NO_CACHE NAMES z)
|
||||
if (NOT ZLIB_LIBRARIES)
|
||||
message(FATAL_ERROR "'zlib' not found")
|
||||
endif()
|
||||
|
||||
if (REPERTORY_MUSL)
|
||||
set(ZLIB_LIBRARIES libz.a)
|
||||
endif()
|
||||
set(ZLIB_LIBRARIES ${EXTERNAL_BUILD_ROOT}/lib/libz${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||
endif()
|
||||
|
@ -46,7 +46,7 @@ create_directory(int argc, char *argv[], const std::string &data_directory,
|
||||
argc, argv, utils::cli::options::create_directory_option,
|
||||
api_path)) == exit_code::success) {
|
||||
lock_data lock(pt, unique_id);
|
||||
const auto res = lock.grab_lock(1u);
|
||||
const auto lock_res = lock.grab_lock(1u);
|
||||
/* if (res == lock_result::locked) { */
|
||||
/* auto port = app_config::default_api_port(pt); */
|
||||
/* utils::cli::get_api_authentication_data(user, password, port, pt,
|
||||
@ -57,7 +57,7 @@ create_directory(int argc, char *argv[], const std::string &data_directory,
|
||||
/* std::cout << static_cast<int>(response.response_type) << std::endl; */
|
||||
/* std::cout << response.data.dump(2) << std::endl; */
|
||||
/* } else */
|
||||
if (res == lock_result::success) {
|
||||
if (lock_res == lock_result::success) {
|
||||
std::cout << "creating directory: '" << api_path << "'" << std::endl;
|
||||
app_config config(pt, data_directory);
|
||||
s3_comm comm(config);
|
||||
@ -65,8 +65,8 @@ create_directory(int argc, char *argv[], const std::string &data_directory,
|
||||
std::cout << api_error_to_string(res) << std::endl;
|
||||
ret = exit_code::success;
|
||||
} else {
|
||||
std::cout << "failed to grab lock: '" << static_cast<int>(res) << "'"
|
||||
<< std::endl;
|
||||
std::cout << "failed to grab lock: '" << static_cast<int>(lock_res)
|
||||
<< "'" << std::endl;
|
||||
ret = exit_code::lock_failed;
|
||||
}
|
||||
}
|
||||
|
@ -42,18 +42,8 @@ list_objects(int /* argc */, char * /* argv */[],
|
||||
|
||||
if (pt == provider_type::s3) {
|
||||
lock_data lock(pt, unique_id);
|
||||
const auto res = lock.grab_lock(1u);
|
||||
/* if (res == lock_result::locked) { */
|
||||
/* auto port = app_config::default_api_port(pt); */
|
||||
/* utils::cli::get_api_authentication_data(user, password, port, pt,
|
||||
* data_directory); */
|
||||
/* const auto response = */
|
||||
/* client({"localhost", password, port,
|
||||
* user}).create_directory(api_path); */
|
||||
/* std::cout << static_cast<int>(response.response_type) << std::endl; */
|
||||
/* std::cout << response.data.dump(2) << std::endl; */
|
||||
/* } else */
|
||||
if (res == lock_result::success) {
|
||||
auto lock_res = lock.grab_lock(1u);
|
||||
if (lock_res == lock_result::success) {
|
||||
app_config config(pt, data_directory);
|
||||
s3_comm comm(config);
|
||||
std::vector<directory_item> list{};
|
||||
@ -67,7 +57,7 @@ list_objects(int /* argc */, char * /* argv */[],
|
||||
std::cout << api_error_to_string(res) << std::endl;
|
||||
}
|
||||
} else {
|
||||
std::cout << "failed to grab lock: '" << static_cast<int>(res) << "'"
|
||||
std::cout << "failed to grab lock: '" << static_cast<int>(lock_res) << "'"
|
||||
<< std::endl;
|
||||
ret = exit_code::lock_failed;
|
||||
}
|
||||
|
@ -27,12 +27,12 @@
|
||||
#include "file_manager/file_manager.hpp"
|
||||
|
||||
namespace repertory {
|
||||
class i_provider;
|
||||
class app_config;
|
||||
class console_consumer;
|
||||
class directory_cache;
|
||||
class eviction;
|
||||
class full_server;
|
||||
class i_provider;
|
||||
class lock_data;
|
||||
class logging_consumer;
|
||||
namespace remote_fuse {
|
||||
@ -197,8 +197,7 @@ protected:
|
||||
|
||||
#ifdef __APPLE__
|
||||
[[nodiscard]] auto getxattr_impl(std::string api_path, const char *name,
|
||||
char *value, size_t size,
|
||||
[[nodiscard]] uint32_t position,
|
||||
char *value, size_t size, uint32_t position,
|
||||
int &attribute_size) -> api_error override;
|
||||
#else // __APPLE__
|
||||
[[nodiscard]] auto getxattr_impl(std::string api_path, const char *name,
|
||||
|
@ -32,12 +32,12 @@ using event_consumer = event_system::event_consumer;
|
||||
|
||||
#define E_CAST(t) ((std::string)t)
|
||||
#define E_DOUBLE(d) std::to_string(d)
|
||||
#define E_DOUBLE_PRECISE(d) \
|
||||
#define E_DOUBLE_PRECISE(dbl_val) \
|
||||
([](const double &d) -> std::string { \
|
||||
std::stringstream ss; \
|
||||
ss << std::fixed << std::setprecision(2) << d; \
|
||||
return ss.str(); \
|
||||
})(d)
|
||||
})(dbl_val)
|
||||
#define E_FROM_BOOL(t) std::to_string(t)
|
||||
#define E_FROM_EXCEPTION(e) std::string(e.what() ? e.what() : "")
|
||||
#define E_FROM_INT32(t) std::to_string(t)
|
||||
@ -69,8 +69,9 @@ using event_consumer = event_system::event_consumer;
|
||||
#define E_PROP(type, name, short_name, ts) \
|
||||
private: \
|
||||
void init_##short_name(const type &val) { \
|
||||
ss_ << "|" << #short_name << "|" << ts(val); \
|
||||
j_[#name] = ts(val); \
|
||||
auto ts_val = ts(val); \
|
||||
ss_ << "|" << #short_name << "|" << ts_val; \
|
||||
j_[#name] = ts_val; \
|
||||
} \
|
||||
\
|
||||
public: \
|
||||
|
@ -1,115 +0,0 @@
|
||||
@echo off
|
||||
setlocal
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
set SIGNING_FOLDER=%1
|
||||
set BINARY_FOLDER=%2
|
||||
set SOURCE_FOLDER=%3
|
||||
set OUTPUT_FOLDER=%4
|
||||
|
||||
set PATH=%~dp0%..\bin;!PATH!
|
||||
|
||||
if "%SIGNING_FOLDER%" == "" (
|
||||
call :EXIT_SCRIPT "'SIGNING_FOLDER' is not set (arg1)"
|
||||
)
|
||||
|
||||
if "%BINARY_FOLDER%" == "" (
|
||||
call :EXIT_SCRIPT "'BINARY_FOLDER' is not set (arg2)"
|
||||
)
|
||||
|
||||
if "%SOURCE_FOLDER%" == "" (
|
||||
call :EXIT_SCRIPT "'SOURCE_FOLDER' is not set (arg3)"
|
||||
)
|
||||
|
||||
if "%OUTPUT_FOLDER%" == "" (
|
||||
call :EXIT_SCRIPT "'OUTPUT_FOLDER' is not set (arg4)"
|
||||
)
|
||||
|
||||
call :NORMALIZE "%SIGNING_FOLDER%"
|
||||
set SIGNING_FOLDER=%RETVAL%
|
||||
|
||||
call :NORMALIZE "%BINARY_FOLDER%"
|
||||
set BINARY_FOLDER=%RETVAL%
|
||||
|
||||
call :NORMALIZE "%SOURCE_FOLDER%"
|
||||
set SOURCE_FOLDER=%RETVAL%
|
||||
|
||||
set BUILD_ARCH=Win64
|
||||
set OPENSSL_BIN="c:\OpenSSL-%BUILD_ARCH%\bin\openssl.exe"
|
||||
if NOT EXIST %OPENSSL_BIN% (
|
||||
set OPENSSL_BIN="c:\Program Files\OpenSSL-%BUILD_ARCH%\bin\openssl.exe"
|
||||
set REPERTORY_OPENSSL_ROOT="c:\Program Files\OpenSSL-%BUILD_ARCH%"
|
||||
)
|
||||
|
||||
pushd "%SOURCE_FOLDER%"
|
||||
for /F "tokens=*" %%f in ('git rev-parse --short HEAD') do (set GIT_REV=%%f)
|
||||
for /F "tokens=*" %%f in ('git branch --show-current') do (set GIT_BRANCH=%%f)
|
||||
for /F "tokens=*" %%f in ('grep set(REPERTORY_MAJOR .\CMakeLists.txt ^| sed "s/)//g" ^| awk "{print $2}"') do (set REPERTORY_VERSION=%%f)
|
||||
for /F "tokens=*" %%f in ('grep set(REPERTORY_MINOR .\CMakeLists.txt ^| sed "s/)//g" ^| awk "{print $2}"') do (set REPERTORY_VERSION=%REPERTORY_VERSION%.%%f)
|
||||
for /F "tokens=*" %%f in ('grep set(REPERTORY_REV .\CMakeLists.txt ^| sed "s/)//g" ^| awk "{print $2}"') do (set REPERTORY_VERSION=%REPERTORY_VERSION%.%%f)
|
||||
for /F "tokens=*" %%f in ('grep set(REPERTORY_RELEASE_ITER .\CMakeLists.txt ^| sed "s/)//g" ^| awk "{print $2}"') do (set REPERTORY_VERSION=%REPERTORY_VERSION%-%%f)
|
||||
popd
|
||||
|
||||
if "%GIT_BRANCH%" == "development" (
|
||||
set RELEASE_FOLDER=nightly
|
||||
) else (
|
||||
set RELEASE_FOLDER=%REPERTORY_RELEASE_ITER%
|
||||
)
|
||||
|
||||
call :NORMALIZE "%OUTPUT_FOLDER%\!RELEASE_FOLDER!"
|
||||
set OUTPUT_FOLDER=%RETVAL%
|
||||
|
||||
set OUT_FILE=repertory_%REPERTORY_VERSION%_%GIT_REV%_windows_amd64.zip
|
||||
set OUT_ZIP=%BINARY_FOLDER%\%OUT_FILE%
|
||||
set FILE_LIST=repertory.exe repertory.exe.sha256 repertory.exe.sig winfsp-x64.dll winfsp-x64.dll.sha256 winfsp-x64.dll.sig cacert.pem cacert.pem.sha256 cacert.pem.sig
|
||||
|
||||
pushd "%BINARY_FOLDER%"
|
||||
call :CLEANUP
|
||||
|
||||
call :CREATE_HASH "%BINARY_FOLDER%\repertory.exe"
|
||||
call :CREATE_HASH "%BINARY_FOLDER%\winfsp-x64.dll"
|
||||
call :CREATE_HASH "%BINARY_FOLDER%\cacert.pem"
|
||||
|
||||
(7za u "%OUT_FILE%" %FILE_LIST%) || (7z u "%OUT_FILE%" %FILE_LIST%) || (call :EXIT_SCRIPT "Create repertory zip failed")
|
||||
|
||||
call :CREATE_HASH "%OUT_FILE%"
|
||||
|
||||
copy /y "%OUT_ZIP%" "%OUTPUT_FOLDER%" || call :EXIT_SCRIPT "Copy %OUT_ZIP% to %OUTPUT_FOLDER% failed"
|
||||
copy /y "%OUT_ZIP%.sha256" "%OUTPUT_FOLDER%" || call :EXIT_SCRIPT "Copy %OUT_ZIP%.sha256 to %OUTPUT_FOLDER% failed"
|
||||
copy /y "%OUT_ZIP%.sig" "%OUTPUT_FOLDER%" || call :EXIT_SCRIPT "Copy %OUT_ZIP%.sig to %OUTPUT_FOLDER% failed"
|
||||
|
||||
call :CLEANUP
|
||||
popd
|
||||
goto :END
|
||||
|
||||
:CREATE_HASH
|
||||
call :NORMALIZE %1
|
||||
set HASH_FILE=%RETVAL%
|
||||
|
||||
(%OPENSSL_BIN% dgst -sha256 -sign "%SIGNING_FOLDER%\blockstorage_dev_private.pem" -out "%HASH_FILE%.sig" "%HASH_FILE%") || (call :EXIT_SCRIPT "Create %HASH_FILE% signature failed")
|
||||
(%OPENSSL_BIN% dgst -sha256 -verify "%SIGNING_FOLDER%\blockstorage_dev_public.pem" -signature "%HASH_FILE%.sig" "%HASH_FILE%") || (call :EXIT_SCRIPT "Verify %HASH_FILE% signature failed")
|
||||
((certutil -hashfile "%HASH_FILE%" SHA256 | sed -e "1d" -e "$d" -e "s/\ //g") > "%HASH_FILE%.sha256") || (call :EXIT_SCRIPT "Create %HASH_FILE% sha-256 failed")
|
||||
EXIT /B
|
||||
|
||||
:CLEANUP
|
||||
del /q "%OUT_ZIP%" 1>NUL 2>&1
|
||||
del /q "%OUT_ZIP%.sha256" 1>NUL 2>&1
|
||||
del /q "%OUT_ZIP%.sig" 1>NUL 2>&1
|
||||
del /q "%BINARY_FOLDER%\cacert.pem.sha256" 1>NUL 2>&1
|
||||
del /q "%BINARY_FOLDER%\cacert.pem.sig" 1>NUL 2>&1
|
||||
del /q "%BINARY_FOLDER%\repertory.exe.sha256" 1>NUL 2>&1
|
||||
del /q "%BINARY_FOLDER%\repertory.exe.sig" 1>NUL 2>&1
|
||||
del /q "%BINARY_FOLDER%\winfsp-x64.dll.sha256" 1>NUL 2>&1
|
||||
del /q "%BINARY_FOLDER%\winfsp-x64.dll.sig" 1>NUL 2>&1
|
||||
EXIT /B
|
||||
|
||||
:NORMALIZE
|
||||
SET RETVAL=%~f1
|
||||
exit /B
|
||||
|
||||
:EXIT_SCRIPT
|
||||
echo %1
|
||||
exit 1
|
||||
|
||||
:END
|
||||
echo Done
|
@ -1,44 +0,0 @@
|
||||
@echo off
|
||||
|
||||
set MSVC_BUILD_TYPE=%1
|
||||
set BUILD_CLEAN=%2
|
||||
|
||||
if "%MSVC_BUILD_TYPE%" == "" (
|
||||
echo "Build type not set"
|
||||
exit 1
|
||||
)
|
||||
|
||||
if "%MSVC_BUILD_TYPE%" == "Debug" (
|
||||
set BUILD_FOLDER=debug
|
||||
) else (
|
||||
if "%MSVC_BUILD_TYPE%" == "Release" (
|
||||
set BUILD_FOLDER=release
|
||||
) else (
|
||||
set BUILD_FOLDER=%MSVC_BUILD_TYPE%
|
||||
)
|
||||
set MSVC_BUILD_TYPE=Release
|
||||
)
|
||||
|
||||
if EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" (
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
|
||||
) else (
|
||||
if EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat" (
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
|
||||
)
|
||||
)
|
||||
|
||||
pushd "%~dp0%"
|
||||
md ..\build2\%BUILD_FOLDER%
|
||||
del /q ..\build2\%BUILD_FOLDER%\librepertory.lib
|
||||
del /q ..\build2\%BUILD_FOLDER%\repertory.exe
|
||||
del /q ..\build2\%BUILD_FOLDER%\unittests.exe
|
||||
|
||||
pushd "..\build2\%BUILD_FOLDER%"
|
||||
cmake ..\.. -G "NMake Makefiles" -DREPERTORY_ENABLE_S3_TESTING=ON -DREPERTORY_ENABLE_S3=ON -DCMAKE_BUILD_TYPE=%MSVC_BUILD_TYPE% || exit 1
|
||||
copy /y compile_commands.json ..
|
||||
if "%BUILD_CLEAN%" == "clean" (
|
||||
nmake clean || exit 1
|
||||
)
|
||||
nmake || exit 1
|
||||
popd
|
||||
popd
|
@ -912,7 +912,7 @@ auto fuse_drive::listxattr_impl(std::string api_path, char *buffer, size_t size,
|
||||
res = api_error::xattr_buffer_small;
|
||||
}
|
||||
|
||||
required_size += attribute_name_size;
|
||||
required_size += static_cast<int>(attribute_name_size);
|
||||
#ifdef __APPLE__
|
||||
}
|
||||
#endif
|
||||
|
@ -60,8 +60,8 @@ auto remote_fuse_drive::chmod_impl(std::string api_path, mode_t mode,
|
||||
auto remote_fuse_drive::chmod_impl(std::string api_path, mode_t mode)
|
||||
-> api_error {
|
||||
#endif
|
||||
return utils::to_api_error(
|
||||
remote_instance_->fuse_chmod(api_path.c_str(), mode));
|
||||
return utils::to_api_error(remote_instance_->fuse_chmod(
|
||||
api_path.c_str(), static_cast<remote::file_mode>(mode)));
|
||||
}
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
@ -79,7 +79,9 @@ auto remote_fuse_drive::chown_impl(std::string api_path, uid_t uid, gid_t gid)
|
||||
auto remote_fuse_drive::create_impl(std::string api_path, mode_t mode,
|
||||
struct fuse_file_info *fi) -> api_error {
|
||||
return utils::to_api_error(remote_instance_->fuse_create(
|
||||
api_path.c_str(), mode, remote::create_open_flags(fi->flags), fi->fh));
|
||||
api_path.c_str(), static_cast<remote::file_mode>(mode),
|
||||
remote::create_open_flags(static_cast<std::uint32_t>(fi->flags)),
|
||||
fi->fh));
|
||||
}
|
||||
|
||||
void remote_fuse_drive::destroy_impl(void * /*ptr*/) {
|
||||
@ -248,8 +250,8 @@ auto remote_fuse_drive::init_impl(struct fuse_conn_info *conn) -> void * {
|
||||
|
||||
auto remote_fuse_drive::mkdir_impl(std::string api_path, mode_t mode)
|
||||
-> api_error {
|
||||
return utils::to_api_error(
|
||||
remote_instance_->fuse_mkdir(api_path.c_str(), mode));
|
||||
return utils::to_api_error(remote_instance_->fuse_mkdir(
|
||||
api_path.c_str(), static_cast<remote::file_mode>(mode)));
|
||||
}
|
||||
|
||||
void remote_fuse_drive::notify_fuse_main_exit(int &ret) {
|
||||
|
@ -166,12 +166,12 @@ void remote_server::populate_stat(const struct stat64 &st1, remote::stat &st) {
|
||||
st.st_mtimespec =
|
||||
st1.st_mtim.tv_nsec + (st1.st_mtim.tv_sec * NANOS_PER_SECOND);
|
||||
#endif
|
||||
st.st_blksize = st1.st_blksize;
|
||||
st.st_blocks = st1.st_blocks;
|
||||
st.st_blksize = static_cast<remote::block_size>(st1.st_blksize);
|
||||
st.st_blocks = static_cast<remote::block_count>(st1.st_blocks);
|
||||
st.st_gid = st1.st_gid;
|
||||
st.st_mode = st1.st_mode;
|
||||
st.st_nlink = st1.st_nlink;
|
||||
st.st_size = st1.st_size;
|
||||
st.st_mode = static_cast<remote::file_mode>(st1.st_mode);
|
||||
st.st_nlink = static_cast<remote::file_nlink>(st1.st_nlink);
|
||||
st.st_size = static_cast<remote::file_size>(st1.st_size);
|
||||
st.st_uid = st1.st_uid;
|
||||
}
|
||||
|
||||
@ -227,9 +227,10 @@ auto remote_server::fuse_create(const char *path, const remote::file_mode &mode,
|
||||
-> packet::error_type {
|
||||
const auto file_path = construct_path(path);
|
||||
const auto res =
|
||||
open(file_path.c_str(), remote::create_os_open_flags(flags), mode);
|
||||
open(file_path.c_str(),
|
||||
static_cast<int>(remote::create_os_open_flags(flags)), mode);
|
||||
if (res >= 0) {
|
||||
handle = res;
|
||||
handle = static_cast<remote::file_handle>(res);
|
||||
set_open_info(res, open_info{0, "", nullptr, file_path});
|
||||
}
|
||||
|
||||
@ -269,13 +270,12 @@ ConstructPath(path); auto ret = HasOpenFileInfo(handle, -EBADF); if (ret == 0) {
|
||||
fstore.fst_offset = offset;
|
||||
fstore.fst_length = length;
|
||||
|
||||
const auto res = fcntl(static_cast<int>(handle), F_PREALLOCATE, &fstore);
|
||||
ret = ((res < 0) ? -errno : 0);
|
||||
const auto res = fcntl(static_cast<native_handle>(handle), F_PREALLOCATE,
|
||||
&fstore); ret = ((res < 0) ? -errno : 0);
|
||||
}
|
||||
#else
|
||||
const auto res = fallocate(static_cast<int>(handle), mode, offset, length);
|
||||
ret = ((res < 0) ? -errno : 0);
|
||||
#endif
|
||||
const auto res = fallocate(static_cast<native_handle>(handle), mode, offset,
|
||||
length); ret = ((res < 0) ? -errno : 0); #endif
|
||||
}
|
||||
|
||||
RAISE_REMOTE_FUSE_SERVER_EVENT(__FUNCTION__, file_path, ret);
|
||||
@ -289,11 +289,11 @@ auto remote_server::fuse_fgetattr(const char *path, remote::stat &st,
|
||||
const auto file_path = construct_path(path);
|
||||
memset(&st, 0, sizeof(remote::stat));
|
||||
|
||||
auto res = has_open_info(handle, EBADF);
|
||||
auto res = has_open_info(static_cast<native_handle>(handle), EBADF);
|
||||
if (res == 0) {
|
||||
directory = utils::file::is_directory(file_path);
|
||||
struct stat64 st1 {};
|
||||
if ((res = fstat64(static_cast<int>(handle), &st1)) == 0) {
|
||||
if ((res = fstat64(static_cast<native_handle>(handle), &st1)) == 0) {
|
||||
populate_stat(st1, st);
|
||||
}
|
||||
}
|
||||
@ -314,12 +314,12 @@ auto remote_server::fuse_fsetattr_x(const char *path,
|
||||
if (SETATTR_WANTS_MODE(&attr)) {
|
||||
res = (handle == static_cast<std::uint64_t>(REPERTORY_INVALID_HANDLE))
|
||||
? chmod(file_path.c_str(), attr.mode)
|
||||
: fchmod(handle, attr.mode);
|
||||
: fchmod(static_cast<native_handle>(handle), attr.mode);
|
||||
}
|
||||
|
||||
if (res >= 0) {
|
||||
uid_t uid = -1;
|
||||
gid_t gid = -1;
|
||||
auto uid = static_cast<uid_t>(-1);
|
||||
auto gid = static_cast<gid_t>(-1);
|
||||
if (SETATTR_WANTS_UID(&attr)) {
|
||||
uid = attr.uid;
|
||||
}
|
||||
@ -338,7 +338,7 @@ auto remote_server::fuse_fsetattr_x(const char *path,
|
||||
if (SETATTR_WANTS_SIZE(&attr)) {
|
||||
res = (handle == static_cast<std::uint64_t>(REPERTORY_INVALID_HANDLE))
|
||||
? truncate(file_path.c_str(), attr.size)
|
||||
: ftruncate(handle, attr.size);
|
||||
: ftruncate(static_cast<native_handle>(handle), attr.size);
|
||||
}
|
||||
}
|
||||
|
||||
@ -397,14 +397,14 @@ auto remote_server::fuse_fsync(const char *path, const std::int32_t &datasync,
|
||||
-> packet::error_type {
|
||||
const auto file_path = construct_path(path);
|
||||
|
||||
auto res = has_open_info(handle, EBADF);
|
||||
auto res = has_open_info(static_cast<native_handle>(handle), EBADF);
|
||||
if (res == 0) {
|
||||
#ifdef __APPLE__
|
||||
res = datasync ? fcntl(static_cast<int>(handle), F_FULLFSYNC)
|
||||
: fsync(static_cast<int>(handle));
|
||||
res = datasync ? fcntl(static_cast<native_handle>(handle), F_FULLFSYNC)
|
||||
: fsync(static_cast<native_handle>(handle));
|
||||
#else
|
||||
res = datasync ? fdatasync(static_cast<int>(handle))
|
||||
: fsync(static_cast<int>(handle));
|
||||
res = datasync ? fdatasync(static_cast<native_handle>(handle))
|
||||
: fsync(static_cast<native_handle>(handle));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -419,9 +419,9 @@ auto remote_server::fuse_ftruncate(const char *path,
|
||||
-> packet::error_type {
|
||||
const auto file_path = construct_path(path);
|
||||
|
||||
auto res = has_open_info(handle, EBADF);
|
||||
auto res = has_open_info(static_cast<native_handle>(handle), EBADF);
|
||||
if (res == 0) {
|
||||
res = ftruncate(static_cast<int>(handle), size);
|
||||
res = ftruncate(static_cast<native_handle>(handle), size);
|
||||
}
|
||||
|
||||
auto ret = ((res < 0) ? -errno : 0);
|
||||
@ -472,7 +472,7 @@ utils::path::get_parent_api_path(api_path);
|
||||
res = -ENODATA;
|
||||
if (directoryItem.MetaMap.find(name) != directoryItem.MetaMap.end())
|
||||
{ const auto data = macaron::Base64::Decode(directoryItem.MetaMap[name]); res =
|
||||
static_cast<int>(data.size()); if (size) { res = -ERANGE; if (size >=
|
||||
static_cast<native_handle>(data.size()); if (size) { res = -ERANGE; if (size >=
|
||||
data.size()) { memcpy(value, &data[0], data.size()); res = 0;
|
||||
}
|
||||
}
|
||||
@ -561,9 +561,10 @@ auto remote_server::fuse_open(const char *path, const remote::open_flags &flags,
|
||||
remote::file_handle &handle)
|
||||
-> packet::error_type {
|
||||
const auto file_path = construct_path(path);
|
||||
const auto res = open(file_path.c_str(), remote::create_os_open_flags(flags));
|
||||
const auto res = open(file_path.c_str(),
|
||||
static_cast<int>(remote::create_os_open_flags(flags)));
|
||||
if (res >= 0) {
|
||||
handle = res;
|
||||
handle = static_cast<remote::file_handle>(res);
|
||||
set_open_info(res, open_info{0, "", nullptr, file_path});
|
||||
}
|
||||
auto ret = ((res < 0) ? -errno : 0);
|
||||
@ -601,10 +602,11 @@ auto remote_server::fuse_read(const char *path, char *buffer,
|
||||
-> packet::error_type {
|
||||
const auto file_path = construct_path(path);
|
||||
auto &b = *reinterpret_cast<data_buffer *>(buffer);
|
||||
auto res = has_open_info(handle, EBADF);
|
||||
auto res = has_open_info(static_cast<native_handle>(handle), EBADF);
|
||||
if (res == 0) {
|
||||
b.resize(read_size);
|
||||
res = pread64(static_cast<int>(handle), &b[0], read_size, read_offset);
|
||||
res = pread64(static_cast<native_handle>(handle), &b[0], read_size,
|
||||
read_offset);
|
||||
}
|
||||
|
||||
auto ret = ((res < 0) ? -errno : res);
|
||||
@ -655,10 +657,10 @@ auto remote_server::fuse_release(const char *path,
|
||||
packet::error_type ret = 0;
|
||||
|
||||
const auto file_path = construct_path(path);
|
||||
auto res = has_open_info(handle, EBADF);
|
||||
auto res = has_open_info(static_cast<native_handle>(handle), EBADF);
|
||||
if (res == 0) {
|
||||
res = close(static_cast<int>(handle));
|
||||
remove_open_info(handle);
|
||||
res = close(static_cast<native_handle>(handle));
|
||||
remove_open_info(static_cast<native_handle>(handle));
|
||||
}
|
||||
|
||||
ret = ((res < 0) ? -errno : 0);
|
||||
@ -890,9 +892,10 @@ auto remote_server::fuse_write(const char *path, const char *buffer,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type {
|
||||
const auto file_path = construct_path(path);
|
||||
auto res = has_open_info(handle, EBADF);
|
||||
auto res = has_open_info(static_cast<native_handle>(handle), EBADF);
|
||||
if (res == 0) {
|
||||
res = pwrite64(static_cast<int>(handle), buffer, write_size, write_offset);
|
||||
res = pwrite64(static_cast<native_handle>(handle), buffer, write_size,
|
||||
write_offset);
|
||||
}
|
||||
|
||||
auto ret = ((res < 0) ? -errno : res);
|
||||
@ -916,7 +919,9 @@ auto remote_server::winfsp_can_delete(PVOID file_desc, PWSTR file_name)
|
||||
-> packet::error_type {
|
||||
const auto relative_path = utils::string::to_utf8(file_name);
|
||||
const auto file_path = construct_path(relative_path);
|
||||
auto ret = has_open_info(reinterpret_cast<remote::file_handle>(file_desc),
|
||||
auto ret =
|
||||
has_open_info(static_cast<native_handle>(
|
||||
reinterpret_cast<remote::file_handle>(file_desc)),
|
||||
STATUS_INVALID_HANDLE);
|
||||
if (ret == STATUS_SUCCESS) {
|
||||
ret =
|
||||
@ -994,10 +999,11 @@ auto remote_server::winfsp_cleanup(PVOID /*file_desc*/, PWSTR file_name,
|
||||
auto remote_server::winfsp_close(PVOID file_desc) -> packet::error_type {
|
||||
std::string file_path;
|
||||
const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
|
||||
if (has_open_info(handle, STATUS_INVALID_HANDLE) == STATUS_SUCCESS) {
|
||||
file_path = get_open_file_path(handle);
|
||||
close(handle);
|
||||
remove_open_info(handle);
|
||||
if (has_open_info(static_cast<native_handle>(handle),
|
||||
STATUS_INVALID_HANDLE) == STATUS_SUCCESS) {
|
||||
file_path = get_open_file_path(static_cast<native_handle>(handle));
|
||||
close(static_cast<native_handle>(handle));
|
||||
remove_open_info(static_cast<native_handle>(handle));
|
||||
}
|
||||
|
||||
RAISE_REMOTE_FUSE_SERVER_EVENT(__FUNCTION__, file_path, STATUS_SUCCESS);
|
||||
@ -1056,15 +1062,19 @@ auto remote_server::winfsp_create(PWSTR file_name, UINT32 create_options,
|
||||
auto remote_server::winfsp_flush(PVOID file_desc, remote::file_info *file_info)
|
||||
-> packet::error_type {
|
||||
const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
|
||||
auto ret = has_open_info(handle, STATUS_INVALID_HANDLE);
|
||||
auto ret =
|
||||
has_open_info(static_cast<native_handle>(handle), STATUS_INVALID_HANDLE);
|
||||
if (ret == STATUS_SUCCESS) {
|
||||
ret = (fsync(static_cast<int>(handle)) < 0)
|
||||
ret = (fsync(static_cast<native_handle>(handle)) < 0)
|
||||
? utils::unix_error_to_windows(errno)
|
||||
: populate_file_info(
|
||||
construct_api_path(get_open_file_path(handle)), *file_info);
|
||||
: populate_file_info(construct_api_path(get_open_file_path(
|
||||
static_cast<native_handle>(handle))),
|
||||
*file_info);
|
||||
}
|
||||
|
||||
RAISE_REMOTE_FUSE_SERVER_EVENT(__FUNCTION__, get_open_file_path(handle), ret);
|
||||
RAISE_REMOTE_FUSE_SERVER_EVENT(
|
||||
__FUNCTION__, get_open_file_path(static_cast<native_handle>(handle)),
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1072,13 +1082,17 @@ auto remote_server::winfsp_get_file_info(PVOID file_desc,
|
||||
remote::file_info *file_info)
|
||||
-> packet::error_type {
|
||||
const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
|
||||
auto ret = has_open_info(handle, STATUS_INVALID_HANDLE);
|
||||
auto ret =
|
||||
has_open_info(static_cast<native_handle>(handle), STATUS_INVALID_HANDLE);
|
||||
if (ret == STATUS_SUCCESS) {
|
||||
ret = populate_file_info(construct_api_path(get_open_file_path(handle)),
|
||||
ret = populate_file_info(construct_api_path(get_open_file_path(
|
||||
static_cast<native_handle>(handle))),
|
||||
*file_info);
|
||||
}
|
||||
|
||||
RAISE_REMOTE_FUSE_SERVER_EVENT(__FUNCTION__, get_open_file_path(handle), ret);
|
||||
RAISE_REMOTE_FUSE_SERVER_EVENT(
|
||||
__FUNCTION__, get_open_file_path(static_cast<native_handle>(handle)),
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1163,10 +1177,12 @@ auto remote_server::winfsp_overwrite(PVOID file_desc, UINT32 attributes,
|
||||
remote::file_info *file_info)
|
||||
-> packet::error_type {
|
||||
const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
|
||||
auto ret = has_open_info(handle, STATUS_INVALID_HANDLE);
|
||||
auto ret =
|
||||
has_open_info(static_cast<native_handle>(handle), STATUS_INVALID_HANDLE);
|
||||
if (ret == STATUS_SUCCESS) {
|
||||
const auto api_path = construct_api_path(get_open_file_path(handle));
|
||||
const auto res = ftruncate(handle, 0);
|
||||
const auto api_path = construct_api_path(
|
||||
get_open_file_path(static_cast<native_handle>(handle)));
|
||||
const auto res = ftruncate(static_cast<native_handle>(handle), 0);
|
||||
if (res >= 0) {
|
||||
auto set_attributes = false;
|
||||
if (replace_attributes) {
|
||||
@ -1195,14 +1211,17 @@ auto remote_server::winfsp_overwrite(PVOID file_desc, UINT32 attributes,
|
||||
drive_.set_item_meta(api_path, META_ATTRIBUTES,
|
||||
std::to_string(attributes));
|
||||
}
|
||||
ret = populate_file_info(construct_api_path(get_open_file_path(handle)),
|
||||
ret = populate_file_info(construct_api_path(get_open_file_path(
|
||||
static_cast<native_handle>(handle))),
|
||||
*file_info);
|
||||
} else {
|
||||
ret = utils::unix_error_to_windows(errno);
|
||||
}
|
||||
}
|
||||
|
||||
RAISE_REMOTE_FUSE_SERVER_EVENT(__FUNCTION__, get_open_file_path(handle), ret);
|
||||
RAISE_REMOTE_FUSE_SERVER_EVENT(
|
||||
__FUNCTION__, get_open_file_path(static_cast<native_handle>(handle)),
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1212,17 +1231,20 @@ auto remote_server::winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset,
|
||||
*bytes_transferred = 0;
|
||||
|
||||
const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
|
||||
auto ret = has_open_info(handle, STATUS_INVALID_HANDLE);
|
||||
auto ret =
|
||||
has_open_info(static_cast<native_handle>(handle), STATUS_INVALID_HANDLE);
|
||||
if (ret == STATUS_SUCCESS) {
|
||||
const auto res = pread64(handle, buffer, length, offset);
|
||||
if (res >= 0) {
|
||||
*bytes_transferred = res;
|
||||
*bytes_transferred = static_cast<UINT32>(res);
|
||||
} else {
|
||||
ret = utils::unix_error_to_windows(errno);
|
||||
}
|
||||
}
|
||||
|
||||
RAISE_REMOTE_FUSE_SERVER_EVENT(__FUNCTION__, get_open_file_path(handle), ret);
|
||||
RAISE_REMOTE_FUSE_SERVER_EVENT(
|
||||
__FUNCTION__, get_open_file_path(static_cast<native_handle>(handle)),
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1232,9 +1254,11 @@ auto remote_server::winfsp_read_directory(PVOID file_desc, PWSTR /*pattern*/,
|
||||
item_list.clear();
|
||||
|
||||
const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
|
||||
auto ret = has_open_info(handle, STATUS_INVALID_HANDLE);
|
||||
auto ret =
|
||||
has_open_info(static_cast<native_handle>(handle), STATUS_INVALID_HANDLE);
|
||||
if (ret == STATUS_SUCCESS) {
|
||||
const auto api_path = construct_api_path(get_open_file_path(handle));
|
||||
const auto api_path = construct_api_path(
|
||||
get_open_file_path(static_cast<native_handle>(handle)));
|
||||
auto list = drive_.get_directory_items(api_path);
|
||||
directory_iterator iterator(std::move(list));
|
||||
auto offset = marker
|
||||
@ -1253,7 +1277,9 @@ auto remote_server::winfsp_read_directory(PVOID file_desc, PWSTR /*pattern*/,
|
||||
ret = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
RAISE_REMOTE_FUSE_SERVER_EVENT(__FUNCTION__, get_open_file_path(handle), ret);
|
||||
RAISE_REMOTE_FUSE_SERVER_EVENT(
|
||||
__FUNCTION__, get_open_file_path(static_cast<native_handle>(handle)),
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1288,9 +1314,11 @@ auto remote_server::winfsp_set_basic_info(
|
||||
UINT64 last_access_time, UINT64 last_write_time, UINT64 change_time,
|
||||
remote::file_info *file_info) -> packet::error_type {
|
||||
const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
|
||||
auto ret = has_open_info(handle, STATUS_INVALID_HANDLE);
|
||||
auto ret =
|
||||
has_open_info(static_cast<native_handle>(handle), STATUS_INVALID_HANDLE);
|
||||
if (ret == STATUS_SUCCESS) {
|
||||
const auto file_path = get_open_file_path(handle);
|
||||
const auto file_path =
|
||||
get_open_file_path(static_cast<native_handle>(handle));
|
||||
if (attributes == INVALID_FILE_ATTRIBUTES) {
|
||||
attributes = 0;
|
||||
} else if (attributes == 0) {
|
||||
@ -1337,7 +1365,9 @@ auto remote_server::winfsp_set_basic_info(
|
||||
ret = populate_file_info(api_path, *file_info);
|
||||
}
|
||||
|
||||
RAISE_REMOTE_FUSE_SERVER_EVENT(__FUNCTION__, get_open_file_path(handle), ret);
|
||||
RAISE_REMOTE_FUSE_SERVER_EVENT(
|
||||
__FUNCTION__, get_open_file_path(static_cast<native_handle>(handle)),
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1346,17 +1376,24 @@ auto remote_server::winfsp_set_file_size(PVOID file_desc, UINT64 new_size,
|
||||
remote::file_info *file_info)
|
||||
-> packet::error_type {
|
||||
const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
|
||||
auto ret = has_open_info(handle, STATUS_INVALID_HANDLE);
|
||||
auto ret =
|
||||
has_open_info(static_cast<native_handle>(handle), STATUS_INVALID_HANDLE);
|
||||
if (ret == STATUS_SUCCESS) {
|
||||
const auto res = set_allocation_size ? 0 : ftruncate(handle, new_size);
|
||||
const auto res =
|
||||
set_allocation_size
|
||||
? 0
|
||||
: ftruncate(static_cast<native_handle>(handle), new_size);
|
||||
ret = ((res < 0) ? utils::unix_error_to_windows(errno) : 0);
|
||||
if (ret == 0) {
|
||||
ret = populate_file_info(construct_api_path(get_open_file_path(handle)),
|
||||
ret = populate_file_info(construct_api_path(get_open_file_path(
|
||||
static_cast<native_handle>(handle))),
|
||||
*file_info);
|
||||
}
|
||||
}
|
||||
|
||||
RAISE_REMOTE_FUSE_SERVER_EVENT(__FUNCTION__, get_open_file_path(handle), ret);
|
||||
RAISE_REMOTE_FUSE_SERVER_EVENT(
|
||||
__FUNCTION__, get_open_file_path(static_cast<native_handle>(handle)),
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1375,9 +1412,11 @@ auto remote_server::winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset,
|
||||
-> packet::error_type {
|
||||
*bytes_transferred = 0;
|
||||
const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
|
||||
auto ret = has_open_info(handle, STATUS_INVALID_HANDLE);
|
||||
auto ret =
|
||||
has_open_info(static_cast<native_handle>(handle), STATUS_INVALID_HANDLE);
|
||||
if (ret == STATUS_SUCCESS) {
|
||||
const auto api_path = construct_api_path(get_open_file_path(handle));
|
||||
const auto api_path = construct_api_path(
|
||||
get_open_file_path(static_cast<native_handle>(handle)));
|
||||
const auto file_size = drive_.get_file_size(api_path);
|
||||
if (write_to_end) {
|
||||
offset = file_size;
|
||||
@ -1389,7 +1428,7 @@ auto remote_server::winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset,
|
||||
ret = STATUS_SUCCESS;
|
||||
should_write = false;
|
||||
} else if ((offset + length) > file_size) {
|
||||
length = static_cast<UINT64>(file_size - offset);
|
||||
length = static_cast<UINT32>(file_size - offset);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1397,9 +1436,10 @@ auto remote_server::winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset,
|
||||
if (length > 0) {
|
||||
const auto res = pwrite64(handle, buffer, length, offset);
|
||||
if (res >= 0) {
|
||||
*bytes_transferred = res;
|
||||
ret = populate_file_info(
|
||||
construct_api_path(get_open_file_path(handle)), *file_info);
|
||||
*bytes_transferred = static_cast<UINT32>(res);
|
||||
ret = populate_file_info(construct_api_path(get_open_file_path(
|
||||
static_cast<native_handle>(handle))),
|
||||
*file_info);
|
||||
} else {
|
||||
ret = utils::unix_error_to_windows(errno);
|
||||
}
|
||||
@ -1407,7 +1447,9 @@ auto remote_server::winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset,
|
||||
}
|
||||
}
|
||||
|
||||
RAISE_REMOTE_FUSE_SERVER_EVENT(__FUNCTION__, get_open_file_path(handle), ret);
|
||||
RAISE_REMOTE_FUSE_SERVER_EVENT(
|
||||
__FUNCTION__, get_open_file_path(static_cast<native_handle>(handle)),
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -103,13 +103,13 @@ void file_manager::open_file::download_chunk(std::size_t chunk,
|
||||
reset_timeout();
|
||||
}
|
||||
|
||||
unique_recur_mutex_lock file_lock(file_mtx_);
|
||||
unique_recur_mutex_lock download_lock(file_mtx_);
|
||||
if ((get_api_error() == api_error::success) && (chunk < read_state_.size()) &&
|
||||
not read_state_[chunk]) {
|
||||
if (active_downloads_.find(chunk) != active_downloads_.end()) {
|
||||
if (not skip_active) {
|
||||
auto active_download = active_downloads_.at(chunk);
|
||||
file_lock.unlock();
|
||||
download_lock.unlock();
|
||||
|
||||
active_download->wait();
|
||||
}
|
||||
@ -129,7 +129,7 @@ void file_manager::open_file::download_chunk(std::size_t chunk,
|
||||
read_state_.count());
|
||||
|
||||
active_downloads_[chunk] = std::make_shared<download>();
|
||||
file_lock.unlock();
|
||||
download_lock.unlock();
|
||||
|
||||
if (should_reset) {
|
||||
reset_timeout();
|
||||
@ -486,7 +486,7 @@ auto file_manager::open_file::close() -> bool {
|
||||
}
|
||||
|
||||
void file_manager::open_file::update_background_reader(std::size_t read_chunk) {
|
||||
recur_mutex_lock file_lock(file_mtx_);
|
||||
recur_mutex_lock reader_lock(file_mtx_);
|
||||
read_chunk_index_ = read_chunk;
|
||||
|
||||
if (not reader_thread_ && not stop_requested_) {
|
||||
@ -533,11 +533,11 @@ auto file_manager::open_file::write(std::uint64_t write_offset,
|
||||
return api_error::success;
|
||||
}
|
||||
|
||||
unique_recur_mutex_lock file_lock(file_mtx_);
|
||||
unique_recur_mutex_lock write_lock(file_mtx_);
|
||||
if (stop_requested_) {
|
||||
return api_error::download_stopped;
|
||||
}
|
||||
file_lock.unlock();
|
||||
write_lock.unlock();
|
||||
|
||||
const auto start_chunk_index =
|
||||
static_cast<std::size_t>(write_offset / chunk_size_);
|
||||
@ -552,7 +552,7 @@ auto file_manager::open_file::write(std::uint64_t write_offset,
|
||||
return get_api_error();
|
||||
}
|
||||
|
||||
file_lock.lock();
|
||||
write_lock.lock();
|
||||
if ((write_offset + data.size()) > fsi_.size) {
|
||||
auto res = resize(write_offset + data.size());
|
||||
if (res != api_error::success) {
|
||||
|
@ -264,18 +264,18 @@ auto file_manager::ring_buffer_open_file::read(std::size_t read_size,
|
||||
res = do_io([this, &buffer, &chunk, &data, read_offset,
|
||||
&to_read]() -> api_error {
|
||||
std::size_t bytes_read{};
|
||||
auto res = nf_->read_bytes(buffer.data(), buffer.size(),
|
||||
auto ret = nf_->read_bytes(buffer.data(), buffer.size(),
|
||||
((chunk % ring_state_.size()) * chunk_size_),
|
||||
bytes_read)
|
||||
? api_error::success
|
||||
: api_error::os_error;
|
||||
if (res == api_error::success) {
|
||||
if (ret == api_error::success) {
|
||||
data.insert(data.end(), buffer.begin() + read_offset,
|
||||
buffer.begin() + read_offset + to_read);
|
||||
reset_timeout();
|
||||
}
|
||||
|
||||
return res;
|
||||
return ret;
|
||||
});
|
||||
read_offset = 0u;
|
||||
read_size -= to_read;
|
||||
|
@ -407,8 +407,7 @@ void base_provider::remove_deleted_files() {
|
||||
removed_files.pop_back();
|
||||
|
||||
bool exists{};
|
||||
auto res = is_directory(api_path, exists);
|
||||
if (res != api_error::success) {
|
||||
if (is_directory(api_path, exists) != api_error::success) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -421,7 +420,7 @@ void base_provider::remove_deleted_files() {
|
||||
fm_->perform_locked_operation(
|
||||
[this, &api_path, &source_path](i_provider &) -> bool {
|
||||
if (fm_->has_no_open_file_handles()) {
|
||||
const auto res = meta_db_->remove_item_meta(api_path);
|
||||
auto res = meta_db_->remove_item_meta(api_path);
|
||||
if (res == api_error::success) {
|
||||
event_system::instance().raise<file_removed_externally>(
|
||||
api_path, source_path);
|
||||
|
@ -222,21 +222,23 @@ auto encrypt_provider::get_directory_items(const std::string &api_path,
|
||||
for (const auto &dir_entry :
|
||||
std::filesystem::directory_iterator(source_path)) {
|
||||
try {
|
||||
std::string api_path{};
|
||||
std::string entry_api_path{};
|
||||
if (dir_entry.is_directory()) {
|
||||
db_->Get(rocksdb::ReadOptions(), dir_family_,
|
||||
dir_entry.path().string(), &api_path);
|
||||
if (api_path.empty()) {
|
||||
dir_entry.path().string(), &entry_api_path);
|
||||
if (entry_api_path.empty()) {
|
||||
const auto cfg = config_.get_encrypt_config();
|
||||
for (const auto &child_dir_entry :
|
||||
std::filesystem::directory_iterator(dir_entry.path())) {
|
||||
if (process_directory_entry(child_dir_entry, cfg, api_path)) {
|
||||
api_path = utils::path::get_parent_api_path(api_path);
|
||||
if (process_directory_entry(child_dir_entry, cfg,
|
||||
entry_api_path)) {
|
||||
entry_api_path =
|
||||
utils::path::get_parent_api_path(entry_api_path);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (api_path.empty()) {
|
||||
if (entry_api_path.empty()) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -246,16 +248,16 @@ auto encrypt_provider::get_directory_items(const std::string &api_path,
|
||||
dir_entry.path().string(), &api_path_data);
|
||||
if (api_path_data.empty()) {
|
||||
const auto cfg = config_.get_encrypt_config();
|
||||
if (not process_directory_entry(dir_entry, cfg, api_path)) {
|
||||
if (not process_directory_entry(dir_entry, cfg, entry_api_path)) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
api_path =
|
||||
entry_api_path =
|
||||
json::parse(api_path_data).at("api_path").get<std::string>();
|
||||
}
|
||||
}
|
||||
|
||||
auto file = create_api_file(api_path, dir_entry.is_directory(),
|
||||
auto file = create_api_file(entry_api_path, dir_entry.is_directory(),
|
||||
dir_entry.path().string());
|
||||
|
||||
directory_item di{};
|
||||
@ -464,13 +466,13 @@ auto encrypt_provider::get_filesystem_item(const std::string &api_path,
|
||||
}
|
||||
|
||||
if (directory) {
|
||||
std::string api_path{};
|
||||
db_->Get(rocksdb::ReadOptions(), dir_family_, source_path, &api_path);
|
||||
if (api_path.empty()) {
|
||||
std::string db_api_path{};
|
||||
db_->Get(rocksdb::ReadOptions(), dir_family_, source_path, &db_api_path);
|
||||
if (db_api_path.empty()) {
|
||||
return api_error::item_not_found;
|
||||
}
|
||||
fsi.api_parent = utils::path::get_parent_api_path(api_path);
|
||||
fsi.api_path = api_path;
|
||||
fsi.api_parent = utils::path::get_parent_api_path(db_api_path);
|
||||
fsi.api_path = db_api_path;
|
||||
fsi.directory = true;
|
||||
fsi.size = 0U;
|
||||
fsi.source_path = source_path;
|
||||
|
@ -961,8 +961,8 @@ void sia_provider::remove_deleted_files() {
|
||||
if (get_item_meta(iterator->key().ToString(), meta) == api_error::success) {
|
||||
if (utils::string::to_bool(meta[META_DIRECTORY])) {
|
||||
bool exists{};
|
||||
auto res = is_directory(iterator->key().ToString(), exists);
|
||||
if (res != api_error::success) {
|
||||
if (is_directory(iterator->key().ToString(), exists) !=
|
||||
api_error::success) {
|
||||
continue;
|
||||
}
|
||||
if (not exists) {
|
||||
@ -973,8 +973,7 @@ void sia_provider::remove_deleted_files() {
|
||||
}
|
||||
|
||||
bool exists{};
|
||||
auto res = is_file(iterator->key().ToString(), exists);
|
||||
if (res != api_error::success) {
|
||||
if (is_file(iterator->key().ToString(), exists) != api_error::success) {
|
||||
continue;
|
||||
}
|
||||
if (not exists) {
|
||||
|
@ -162,8 +162,8 @@ TEST_F(directory_db_test, get_file) {
|
||||
|
||||
api_file file{};
|
||||
EXPECT_EQ(api_error::success,
|
||||
db_->get_file("/cow.txt", file, [](api_file &file) {
|
||||
EXPECT_STREQ("/cow.txt", file.api_path.c_str());
|
||||
db_->get_file("/cow.txt", file, [](api_file &cur_file) {
|
||||
EXPECT_STREQ("/cow.txt", cur_file.api_path.c_str());
|
||||
}));
|
||||
EXPECT_STREQ("/cow.txt", file.api_path.c_str());
|
||||
}
|
||||
|
@ -89,9 +89,9 @@ TEST(open_file, properly_initializes_state_based_on_chunk_size) {
|
||||
|
||||
EXPECT_CALL(um, remove_resume)
|
||||
.WillOnce(
|
||||
[&fsi](const std::string &api_path, const std::string &source_path) {
|
||||
[&fsi](const std::string &api_path, const std::string &source_path2) {
|
||||
EXPECT_EQ(fsi.api_path, api_path);
|
||||
EXPECT_EQ(fsi.source_path, source_path);
|
||||
EXPECT_EQ(fsi.source_path, source_path2);
|
||||
});
|
||||
|
||||
file_manager::open_file o(1u, 0U, fsi, mp, um);
|
||||
@ -143,15 +143,15 @@ TEST(open_file, will_change_source_path_if_file_size_is_greater_than_0) {
|
||||
|
||||
EXPECT_CALL(um, remove_resume)
|
||||
.WillOnce(
|
||||
[&fsi](const std::string &api_path, const std::string &source_path) {
|
||||
[&fsi](const std::string &api_path, const std::string &source_path2) {
|
||||
EXPECT_EQ(fsi.api_path, api_path);
|
||||
EXPECT_EQ(fsi.source_path, source_path);
|
||||
EXPECT_EQ(fsi.source_path, source_path2);
|
||||
});
|
||||
|
||||
EXPECT_CALL(mp, set_item_meta(fsi.api_path, META_SOURCE, _))
|
||||
.WillOnce([&fsi](const std::string &, const std::string &,
|
||||
const std::string &source_path) -> api_error {
|
||||
EXPECT_STRNE(fsi.source_path.c_str(), source_path.c_str());
|
||||
const std::string &source_path2) -> api_error {
|
||||
EXPECT_STRNE(fsi.source_path.c_str(), source_path2.c_str());
|
||||
return api_error::success;
|
||||
});
|
||||
|
||||
@ -248,9 +248,9 @@ TEST(open_file, write_with_incomplete_download) {
|
||||
|
||||
EXPECT_CALL(um, store_resume)
|
||||
.Times(2)
|
||||
.WillRepeatedly([&fsi](const i_open_file &o) {
|
||||
EXPECT_EQ(fsi.api_path, o.get_api_path());
|
||||
EXPECT_EQ(fsi.source_path, o.get_source_path());
|
||||
.WillRepeatedly([&fsi](const i_open_file &cur_file) {
|
||||
EXPECT_EQ(fsi.api_path, cur_file.get_api_path());
|
||||
EXPECT_EQ(fsi.source_path, cur_file.get_source_path());
|
||||
});
|
||||
|
||||
data_buffer data = {10, 9, 8};
|
||||
@ -325,9 +325,9 @@ TEST(open_file, write_new_file) {
|
||||
EXPECT_EQ(fsi.api_path, api_path);
|
||||
});
|
||||
|
||||
EXPECT_CALL(um, queue_upload).WillOnce([&fsi](const i_open_file &o) {
|
||||
EXPECT_EQ(fsi.api_path, o.get_api_path());
|
||||
EXPECT_EQ(fsi.source_path, o.get_source_path());
|
||||
EXPECT_CALL(um, queue_upload).WillOnce([&fsi](const i_open_file &cur_file) {
|
||||
EXPECT_EQ(fsi.api_path, cur_file.get_api_path());
|
||||
EXPECT_EQ(fsi.source_path, cur_file.get_source_path());
|
||||
});
|
||||
|
||||
std::size_t bytes_written{};
|
||||
@ -414,9 +414,9 @@ TEST(open_file, write_new_file_multiple_chunks) {
|
||||
EXPECT_EQ(fsi.api_path, api_path);
|
||||
});
|
||||
|
||||
EXPECT_CALL(um, queue_upload).WillOnce([&fsi](const i_open_file &o) {
|
||||
EXPECT_EQ(fsi.api_path, o.get_api_path());
|
||||
EXPECT_EQ(fsi.source_path, o.get_source_path());
|
||||
EXPECT_CALL(um, queue_upload).WillOnce([&fsi](const i_open_file &cur_file) {
|
||||
EXPECT_EQ(fsi.api_path, cur_file.get_api_path());
|
||||
EXPECT_EQ(fsi.source_path, cur_file.get_source_path());
|
||||
});
|
||||
|
||||
std::size_t bytes_written{};
|
||||
@ -478,13 +478,13 @@ TEST(open_file, resize_file_to_0_bytes) {
|
||||
EXPECT_EQ(fsi.api_path, api_path);
|
||||
});
|
||||
|
||||
EXPECT_CALL(um, queue_upload).WillOnce([&fsi](const i_open_file &o) {
|
||||
EXPECT_EQ(fsi.api_path, o.get_api_path());
|
||||
EXPECT_EQ(fsi.source_path, o.get_source_path());
|
||||
EXPECT_CALL(um, queue_upload).WillOnce([&fsi](const i_open_file &cur_file) {
|
||||
EXPECT_EQ(fsi.api_path, cur_file.get_api_path());
|
||||
EXPECT_EQ(fsi.source_path, cur_file.get_source_path());
|
||||
});
|
||||
EXPECT_CALL(um, store_resume).WillOnce([&fsi](const i_open_file &o) {
|
||||
EXPECT_EQ(fsi.api_path, o.get_api_path());
|
||||
EXPECT_EQ(fsi.source_path, o.get_source_path());
|
||||
EXPECT_CALL(um, store_resume).WillOnce([&fsi](const i_open_file &cur_file) {
|
||||
EXPECT_EQ(fsi.api_path, cur_file.get_api_path());
|
||||
EXPECT_EQ(fsi.source_path, cur_file.get_source_path());
|
||||
});
|
||||
|
||||
EXPECT_EQ(api_error::success, o.resize(0u));
|
||||
@ -532,9 +532,9 @@ TEST(open_file, resize_file_by_full_chunk) {
|
||||
EXPECT_EQ(fsi.api_path, api_path);
|
||||
});
|
||||
|
||||
EXPECT_CALL(um, queue_upload).WillOnce([&fsi](const i_open_file &o) {
|
||||
EXPECT_EQ(fsi.api_path, o.get_api_path());
|
||||
EXPECT_EQ(fsi.source_path, o.get_source_path());
|
||||
EXPECT_CALL(um, queue_upload).WillOnce([&fsi](const i_open_file &cur_file) {
|
||||
EXPECT_EQ(fsi.api_path, cur_file.get_api_path());
|
||||
EXPECT_EQ(fsi.source_path, cur_file.get_source_path());
|
||||
});
|
||||
|
||||
EXPECT_EQ(api_error::success, o.resize(test_chunk_size * 3u));
|
||||
@ -583,9 +583,9 @@ TEST(open_file, can_add_handle) {
|
||||
.WillOnce(Return(api_error::success));
|
||||
EXPECT_CALL(um, remove_resume)
|
||||
.WillOnce(
|
||||
[&fsi](const std::string &api_path, const std::string &source_path) {
|
||||
[&fsi](const std::string &api_path, const std::string &source_path2) {
|
||||
EXPECT_EQ(fsi.api_path, api_path);
|
||||
EXPECT_EQ(fsi.source_path, source_path);
|
||||
EXPECT_EQ(fsi.source_path, source_path2);
|
||||
});
|
||||
|
||||
event_capture capture(
|
||||
@ -642,9 +642,9 @@ TEST(open_file, can_remove_handle) {
|
||||
|
||||
EXPECT_CALL(um, remove_resume)
|
||||
.WillOnce(
|
||||
[&fsi](const std::string &api_path, const std::string &source_path) {
|
||||
[&fsi](const std::string &api_path, const std::string &source_path2) {
|
||||
EXPECT_EQ(fsi.api_path, api_path);
|
||||
EXPECT_EQ(fsi.source_path, source_path);
|
||||
EXPECT_EQ(fsi.source_path, source_path2);
|
||||
});
|
||||
EXPECT_CALL(mp, set_item_meta(fsi.api_path, META_SOURCE, _))
|
||||
.WillOnce(Return(api_error::success));
|
||||
|
@ -461,10 +461,10 @@ TEST(file_manager, download_is_stored_after_write_if_partially_downloaded) {
|
||||
});
|
||||
EXPECT_CALL(mp, set_item_meta("/test_write_partial_download.txt", _))
|
||||
.WillOnce(
|
||||
[](const std::string &, const api_meta_map &meta) -> api_error {
|
||||
EXPECT_NO_THROW(EXPECT_FALSE(meta.at(META_CHANGED).empty()));
|
||||
EXPECT_NO_THROW(EXPECT_FALSE(meta.at(META_MODIFIED).empty()));
|
||||
EXPECT_NO_THROW(EXPECT_FALSE(meta.at(META_WRITTEN).empty()));
|
||||
[](const std::string &, const api_meta_map &meta2) -> api_error {
|
||||
EXPECT_NO_THROW(EXPECT_FALSE(meta2.at(META_CHANGED).empty()));
|
||||
EXPECT_NO_THROW(EXPECT_FALSE(meta2.at(META_MODIFIED).empty()));
|
||||
EXPECT_NO_THROW(EXPECT_FALSE(meta2.at(META_WRITTEN).empty()));
|
||||
return api_error::success;
|
||||
});
|
||||
EXPECT_CALL(mp, upload_file).Times(0u);
|
||||
@ -611,10 +611,10 @@ TEST(file_manager, upload_occurs_after_write_if_fully_downloaded) {
|
||||
});
|
||||
EXPECT_CALL(mp, set_item_meta("/test_write_full_download.txt", _))
|
||||
.WillOnce(
|
||||
[](const std::string &, const api_meta_map &meta) -> api_error {
|
||||
EXPECT_NO_THROW(EXPECT_FALSE(meta.at(META_CHANGED).empty()));
|
||||
EXPECT_NO_THROW(EXPECT_FALSE(meta.at(META_MODIFIED).empty()));
|
||||
EXPECT_NO_THROW(EXPECT_FALSE(meta.at(META_WRITTEN).empty()));
|
||||
[](const std::string &, const api_meta_map &meta2) -> api_error {
|
||||
EXPECT_NO_THROW(EXPECT_FALSE(meta2.at(META_CHANGED).empty()));
|
||||
EXPECT_NO_THROW(EXPECT_FALSE(meta2.at(META_MODIFIED).empty()));
|
||||
EXPECT_NO_THROW(EXPECT_FALSE(meta2.at(META_WRITTEN).empty()));
|
||||
return api_error::success;
|
||||
});
|
||||
std::size_t bytes_written{};
|
||||
@ -977,11 +977,11 @@ TEST(file_manager, evict_file_fails_if_file_is_uploading) {
|
||||
.WillRepeatedly(Return(api_error::success));
|
||||
EXPECT_CALL(mp, upload_file)
|
||||
.WillOnce([](const std::string &api_path,
|
||||
const std::string &source_path,
|
||||
const std::string &source_path2,
|
||||
const std::string &encryption_token,
|
||||
stop_type & /*stop_requested*/) -> api_error {
|
||||
EXPECT_STREQ("/test_evict.txt", api_path.c_str());
|
||||
EXPECT_FALSE(source_path.empty());
|
||||
EXPECT_FALSE(source_path2.empty());
|
||||
EXPECT_TRUE(encryption_token.empty());
|
||||
std::this_thread::sleep_for(3s);
|
||||
return api_error::success;
|
||||
|
@ -113,8 +113,8 @@ public:
|
||||
const get_name_callback &get_name,
|
||||
const get_token_callback &get_token, api_file &file) {
|
||||
auto f = std::find_if(list.begin(), list.end(),
|
||||
[&api_path](const auto &f) -> bool {
|
||||
return f.api_path == api_path;
|
||||
[&api_path](const auto &cur_file) -> bool {
|
||||
return cur_file.api_path == api_path;
|
||||
});
|
||||
if (f == list.end()) {
|
||||
return api_error::item_not_found;
|
||||
|
@ -30,8 +30,8 @@ TEST(lock_data, lock_and_unlock) {
|
||||
EXPECT_EQ(lock_result::success, l.grab_lock());
|
||||
|
||||
std::thread([]() {
|
||||
lock_data l(provider_type::sia, "1");
|
||||
EXPECT_EQ(lock_result::locked, l.grab_lock(10));
|
||||
lock_data l2(provider_type::sia, "1");
|
||||
EXPECT_EQ(lock_result::locked, l2.grab_lock(10));
|
||||
}).join();
|
||||
}
|
||||
|
||||
|
@ -25,16 +25,16 @@
|
||||
|
||||
namespace repertory {
|
||||
TEST(packet, encrypt_and_decrypt) {
|
||||
packet packet;
|
||||
packet.encode("test");
|
||||
packet.encrypt("moose");
|
||||
packet test_packet;
|
||||
test_packet.encode("test");
|
||||
test_packet.encrypt("moose");
|
||||
|
||||
std::uint32_t size{};
|
||||
EXPECT_EQ(0, packet.decode(size));
|
||||
EXPECT_EQ(0, packet.decrypt("moose"));
|
||||
EXPECT_EQ(0, test_packet.decode(size));
|
||||
EXPECT_EQ(0, test_packet.decrypt("moose"));
|
||||
|
||||
std::string data;
|
||||
EXPECT_EQ(0, packet.decode(data));
|
||||
EXPECT_EQ(0, test_packet.decode(data));
|
||||
|
||||
EXPECT_STREQ("test", data.c_str());
|
||||
}
|
||||
|
Reference in New Issue
Block a user