diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 6fb486e22b..c99e255ded 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -70,7 +70,7 @@ jobs: strategy: fail-fast: false matrix: - osver: [14, 15] + osver: [15] steps: - name: Checkout Drogon source code uses: actions/checkout@v4 diff --git a/lib/tests/CMakeLists.txt b/lib/tests/CMakeLists.txt index b0db32140d..c5f713e082 100644 --- a/lib/tests/CMakeLists.txt +++ b/lib/tests/CMakeLists.txt @@ -154,6 +154,14 @@ set(COOKIE_SAME_SITE CookieSameSite.cc ) add_executable(cookie_same_site ${COOKIE_SAME_SITE}) +add_custom_command( + TARGET cookie_same_site POST_BUILD + COMMAND ${CMAKE_COMMAND} + -E + copy_if_different + ${PROJECT_SOURCE_DIR}/trantor/trantor/tests/server.crt + ${PROJECT_SOURCE_DIR}/trantor/trantor/tests/server.key + ${CMAKE_CURRENT_BINARY_DIR}) add_executable(real_ip_resolver RealIpResolverTest.cc) diff --git a/lib/tests/unittests/HttpFileTest.cc b/lib/tests/unittests/HttpFileTest.cc index 0d2d44d114..198fb98f4b 100644 --- a/lib/tests/unittests/HttpFileTest.cc +++ b/lib/tests/unittests/HttpFileTest.cc @@ -1,6 +1,7 @@ #include "../../lib/src/HttpFileImpl.h" #include #include +#include #include #include #if !defined(_WIN32) @@ -147,27 +148,16 @@ DROGON_TEST(HttpFileExceptionSafety) { // Normal relative paths (not starting with "." or "..") must resolve // against the configured upload directory (app().getUploadPath()). - struct UploadPathGuard - { - std::string originalPath_{drogon::app().getUploadPath()}; - - ~UploadPathGuard() - { - drogon::app().setUploadPath(originalPath_); - } - } guard; - - auto customUploadDir = - filesystem::current_path() / "test_custom_uploads"; - filesystem::create_directories(customUploadDir); - drogon::app().setUploadPath(customUploadDir.string()); + const auto subdir = "test_relative_upload_" + utils::getUuid(); + const auto customUploadDir = + filesystem::path(drogon::app().getUploadPath()) / subdir; HttpFileImpl file; file.setFileName("normal_rel.txt"); file.setFile("test", 4); - int res = file.save("custom_sub"); + int res = file.save(subdir); CHECK(res == 0); - auto expectedPath = customUploadDir / "custom_sub" / "normal_rel.txt"; + auto expectedPath = customUploadDir / "normal_rel.txt"; CHECK(filesystem::exists(expectedPath)); filesystem::remove_all(customUploadDir);