This is an automated email from the ASF dual-hosted git repository. cmcfarlen pushed a commit to branch 10.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 9c549dde3813854b24b2b3ee7dbcc214f0ab001e Author: Walt Karas <[email protected]> AuthorDate: Tue Apr 23 15:47:53 2024 -0400 Raise unit tests for src/proxy/http/remap from the dead. (#11259) The plugin load unit tests are not currently working. (cherry picked from commit 19551e294d1fd3ff414932aaffa2895928968790) --- include/proxy/http/remap/PluginFactory.h | 2 - src/proxy/http/remap/CMakeLists.txt | 4 + src/proxy/http/remap/unit-tests/CMakeLists.txt | 176 +++++++++++++++++++++ .../http/remap/unit-tests/nexthop_test_stubs.cc | 4 +- .../remap/unit-tests/test_NextHopConsistentHash.cc | 16 +- .../remap/unit-tests/test_NextHopRoundRobin.cc | 8 +- .../unit-tests/test_NextHopStrategyFactory.cc | 10 +- src/proxy/http/remap/unit-tests/test_PluginDso.cc | 24 +-- .../http/remap/unit-tests/test_PluginFactory.cc | 4 +- .../http/remap/unit-tests/test_RemapPlugin.cc | 4 +- 10 files changed, 215 insertions(+), 37 deletions(-) diff --git a/include/proxy/http/remap/PluginFactory.h b/include/proxy/http/remap/PluginFactory.h index 35d9a4a3d9..9007c80c9c 100644 --- a/include/proxy/http/remap/PluginFactory.h +++ b/include/proxy/http/remap/PluginFactory.h @@ -31,8 +31,6 @@ #include "proxy/http/remap/PluginDso.h" #include "proxy/http/remap/RemapPluginInfo.h" -#include "tscore/Ptr.h" - #include "tscore/ink_uuid.h" #include "ts/apidefs.h" diff --git a/src/proxy/http/remap/CMakeLists.txt b/src/proxy/http/remap/CMakeLists.txt index ca2540683e..ff0f63da03 100644 --- a/src/proxy/http/remap/CMakeLists.txt +++ b/src/proxy/http/remap/CMakeLists.txt @@ -40,3 +40,7 @@ target_link_libraries( PUBLIC ts::proxy ts::tscore PRIVATE ts::inkevent ts::inkutils yaml-cpp::yaml-cpp ) + +if(BUILD_TESTING) + add_subdirectory(unit-tests) +endif() diff --git a/src/proxy/http/remap/unit-tests/CMakeLists.txt b/src/proxy/http/remap/unit-tests/CMakeLists.txt new file mode 100644 index 0000000000..ca6793fedc --- /dev/null +++ b/src/proxy/http/remap/unit-tests/CMakeLists.txt @@ -0,0 +1,176 @@ +####################### +# +# Licensed to the Apache Software Foundation (ASF) under one or more contributor license +# agreements. See the NOTICE file distributed with this work for additional information regarding +# copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under the License +# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express +# or implied. See the License for the specific language governing permissions and limitations under +# the License. +# +####################### + +### The shared libraries built here are only used by the plugin tests #################### + +function(add_plugin_ut_lib name) + add_library(${name} MODULE ${ARGN}) + set_target_properties(${name} PROPERTIES PREFIX "") + set_target_properties(${name} PROPERTIES SUFFIX ".so") + target_include_directories( + ${name} PRIVATE "$<TARGET_PROPERTY:libswoc::libswoc,INCLUDE_DIRECTORIES>" + "$<TARGET_PROPERTY:libswoc::libswoc,INTERFACE_INCLUDE_DIRECTORIES>" + ) +endfunction() + +# Test plugins will not build on OSX +# +# add_plugin_ut_lib(plugin_v1 plugin_misc_cb.cc) +# target_compile_definitions(plugin_v1 PRIVATE PLUGINDSOVER=1) +# +# add_plugin_ut_lib(plugin_v2 plugin_misc_cb.cc) +# target_compile_definitions(plugin_v2 PRIVATE PLUGINDSOVER=2) +# +# add_plugin_ut_lib(plugin_init_fail plugin_init_fail.cc) +# +# add_plugin_ut_lib(plugin_instinit_fail plugin_instinit_fail.cc) +# +# add_plugin_ut_lib(plugin_required_cb plugin_required_cb.cc) +# target_compile_definitions(plugin_required_cb PRIVATE PLUGINDSOVER=1) +# +# add_plugin_ut_lib(plugin_missing_deleteinstance plugin_missing_deleteinstance.cc) +# target_compile_definitions(plugin_missing_deleteinstance PRIVATE PLUGINDSOVER=1) +# +# add_plugin_ut_lib(plugin_missing_doremap plugin_missing_doremap.cc) +# target_compile_definitions(plugin_missing_doremap PRIVATE PLUGINDSOVER=1) +# +# add_plugin_ut_lib(plugin_missing_init plugin_missing_init.cc) +# target_compile_definitions(plugin_missing_init PRIVATE PLUGINDSOVER=1) +# +# add_plugin_ut_lib(plugin_missing_newinstance plugin_missing_newinstance.cc) +# target_compile_definitions(plugin_missing_newinstance PRIVATE PLUGINDSOVER=1) +# +# add_plugin_ut_lib(plugin_testing_calls plugin_testing_calls.cc plugin_testing_common.cc) +# target_compile_definitions(plugin_testing_calls PRIVATE PLUGINDSOVER=1) + +### test_PluginDso ######################################################################## + +add_executable(test_PluginDso test_PluginDso.cc plugin_testing_common.cc ../PluginDso.cc) + +target_compile_definitions(test_PluginDso PRIVATE PLUGIN_DSO_TESTS) + +target_include_directories(test_PluginDso PRIVATE ${PROJECT_SOURCE_DIR}/tests/include) + +target_link_libraries(test_PluginDso PRIVATE catch2::catch2 ts::inkutils tscore libswoc::libswoc) + +# This test currently does not pass. +# add_test(NAME test_PluginDso COMMAND $<TARGET_FILE:test_PluginDso>) + +### test_PluginFactory ######################################################################## + +add_executable( + test_PluginFactory test_PluginFactory.cc plugin_testing_common.cc ../PluginFactory.cc ../PluginDso.cc + ../RemapPluginInfo.cc +) + +target_compile_definitions(test_PluginFactory PRIVATE PLUGIN_DSO_TESTS) + +target_include_directories(test_PluginFactory PRIVATE ${PROJECT_SOURCE_DIR}/tests/include) + +target_link_libraries(test_PluginFactory PRIVATE catch2::catch2 ts::inkutils tscore libswoc::libswoc) + +# This test currently does not pass. +# add_test(NAME test_PluginFactory COMMAND $<TARGET_FILE:test_PluginFactory>) + +### test_RemapPluginInfo ######################################################################## + +add_executable(test_RemapPluginInfo test_RemapPlugin.cc plugin_testing_common.cc ../PluginDso.cc ../RemapPluginInfo.cc) + +target_compile_definitions(test_RemapPluginInfo PRIVATE PLUGIN_DSO_TESTS) + +target_include_directories(test_RemapPluginInfo PRIVATE ${PROJECT_SOURCE_DIR}/tests/include) + +target_link_libraries(test_RemapPluginInfo PRIVATE catch2::catch2 ts::inkutils tscore libswoc::libswoc) + +# This test currently does not pass. +# add_test(NAME test_RemapPluginInfo COMMAND $<TARGET_FILE:test_RemapPluginInfo>) + +### test_NextHopStrategyFactory ######################################################################## + +add_executable( + test_NextHopStrategyFactory + test_NextHopStrategyFactory.cc + nexthop_test_stubs.cc + ../NextHopSelectionStrategy.cc + ../NextHopStrategyFactory.cc + ../NextHopRoundRobin.cc + ../NextHopConsistentHash.cc + ../NextHopHealthStatus.cc + ${PROJECT_SOURCE_DIR}/src/api/APIHooks.cc +) + +target_compile_definitions( + test_NextHopStrategyFactory PRIVATE _NH_UNIT_TESTS_ TS_SRC_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\" +) + +target_include_directories(test_NextHopStrategyFactory PRIVATE ${PROJECT_SOURCE_DIR}/tests/include) + +target_link_libraries( + test_NextHopStrategyFactory PRIVATE catch2::catch2 ts::hdrs ts::inkutils tscore libswoc::libswoc yaml-cpp::yaml-cpp +) + +add_test(NAME test_NextHopStrategyFactory COMMAND $<TARGET_FILE:test_NextHopStrategyFactory>) + +### test_NextHopRoundRobin ######################################################################## + +add_executable( + test_NextHopRoundRobin + test_NextHopRoundRobin.cc + nexthop_test_stubs.cc + ../NextHopSelectionStrategy.cc + ../NextHopStrategyFactory.cc + ../NextHopRoundRobin.cc + ../NextHopConsistentHash.cc + ../NextHopHealthStatus.cc + ${PROJECT_SOURCE_DIR}/src/api/APIHooks.cc +) + +target_compile_definitions(test_NextHopRoundRobin PRIVATE _NH_UNIT_TESTS_ TS_SRC_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\") + +target_include_directories(test_NextHopRoundRobin PRIVATE ${PROJECT_SOURCE_DIR}/tests/include) + +target_link_libraries( + test_NextHopRoundRobin PRIVATE catch2::catch2 ts::hdrs ts::inkutils tscore libswoc::libswoc yaml-cpp::yaml-cpp +) + +add_test(NAME test_NextHopRoundRobin COMMAND $<TARGET_FILE:test_NextHopRoundRobin>) + +### test_NextHopConsistentHash ######################################################################## + +add_executable( + test_NextHopConsistentHash + test_NextHopConsistentHash.cc + nexthop_test_stubs.cc + ../NextHopSelectionStrategy.cc + ../NextHopStrategyFactory.cc + ../NextHopConsistentHash.cc + ../NextHopRoundRobin.cc + ../NextHopHealthStatus.cc + ${PROJECT_SOURCE_DIR}/src/api/APIHooks.cc +) + +target_compile_definitions( + test_NextHopConsistentHash PRIVATE _NH_UNIT_TESTS_ TS_SRC_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\" +) + +target_include_directories(test_NextHopConsistentHash PRIVATE ${PROJECT_SOURCE_DIR}/tests/include) + +target_link_libraries( + test_NextHopConsistentHash PRIVATE catch2::catch2 tscore ts::hdrs ts::inkutils libswoc::libswoc yaml-cpp::yaml-cpp +) + +add_test(NAME test_NextHopConsistentHash COMMAND $<TARGET_FILE:test_NextHopConsistentHash>) diff --git a/src/proxy/http/remap/unit-tests/nexthop_test_stubs.cc b/src/proxy/http/remap/unit-tests/nexthop_test_stubs.cc index 4d9bb46ca3..f2416c9873 100644 --- a/src/proxy/http/remap/unit-tests/nexthop_test_stubs.cc +++ b/src/proxy/http/remap/unit-tests/nexthop_test_stubs.cc @@ -163,7 +163,7 @@ HttpRequestData::get_client_ip() #include "api/InkAPIInternal.h" void -ConfigUpdateCbTable::invoke(char const *p) +ConfigUpdateCbTable::invoke() { } @@ -207,5 +207,5 @@ HostStatus::setHostStatus(const std::string_view host, TSHostStatus status, unsi this->hosts_statuses[std::string(host)]->status = status; this->hosts_statuses[std::string(host)]->reasons = reason; this->hosts_statuses[std::string(host)]->local_down_time = down_time; - NH_Debug("next_hop", "setting host status for '%.*s' to %s", host.size(), host.data(), HostStatusNames[status]); + NH_Dbg(DbgCtl{"next_hop"}, "setting host status for '%.*s' to %s", host.size(), host.data(), HostStatusNames[status]); } diff --git a/src/proxy/http/remap/unit-tests/test_NextHopConsistentHash.cc b/src/proxy/http/remap/unit-tests/test_NextHopConsistentHash.cc index def67254c4..99860bebc1 100644 --- a/src/proxy/http/remap/unit-tests/test_NextHopConsistentHash.cc +++ b/src/proxy/http/remap/unit-tests/test_NextHopConsistentHash.cc @@ -52,7 +52,7 @@ SCENARIO("Testing NextHopConsistentHash class, using policy 'consistent_hash'", { // load the configuration strtegies. std::shared_ptr<NextHopSelectionStrategy> strategy; - NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/consistent-hash-tests.yaml"); + NextHopStrategyFactory nhf(TS_SRC_DIR "/consistent-hash-tests.yaml"); strategy = nhf.strategyInstance("consistent-hash-1"); WHEN("the config is loaded.") @@ -191,7 +191,7 @@ SCENARIO("Testing NextHopConsistentHash class (all firstcalls), using policy 'co GIVEN("Loading the consistent-hash-tests.yaml config for 'consistent_hash' tests.") { std::shared_ptr<NextHopSelectionStrategy> strategy; - NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/consistent-hash-tests.yaml"); + NextHopStrategyFactory nhf(TS_SRC_DIR "/consistent-hash-tests.yaml"); strategy = nhf.strategyInstance("consistent-hash-1"); WHEN("the config is loaded.") @@ -301,7 +301,7 @@ SCENARIO("Testing NextHop ignore_self_detect false", "[NextHopConsistentHash]") { // load the configuration strtegies. std::shared_ptr<NextHopSelectionStrategy> strategy; - NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/consistent-hash-tests.yaml"); + NextHopStrategyFactory nhf(TS_SRC_DIR "/consistent-hash-tests.yaml"); strategy = nhf.strategyInstance("ignore-self-detect-false"); HostStatus &hs = HostStatus::instance(); @@ -351,7 +351,7 @@ SCENARIO("Testing NextHop ignore_self_detect true", "[NextHopConsistentHash]") { // load the configuration strtegies. std::shared_ptr<NextHopSelectionStrategy> strategy; - NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/consistent-hash-tests.yaml"); + NextHopStrategyFactory nhf(TS_SRC_DIR "/consistent-hash-tests.yaml"); strategy = nhf.strategyInstance("ignore-self-detect-true"); HostStatus &hs = HostStatus::instance(); @@ -401,7 +401,7 @@ SCENARIO("Testing NextHopConsistentHash same host different port markdown", "[Ne { // load the configuration strtegies. std::shared_ptr<NextHopSelectionStrategy> strategy; - NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/consistent-hash-tests.yaml"); + NextHopStrategyFactory nhf(TS_SRC_DIR "/consistent-hash-tests.yaml"); strategy = nhf.strategyInstance("same-host-different-port"); WHEN("the config is loaded.") @@ -469,7 +469,7 @@ SCENARIO("Testing NextHopConsistentHash hash_string override", "[NextHopConsiste { // load the configuration strtegies. std::shared_ptr<NextHopSelectionStrategy> strategy; - NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/consistent-hash-tests.yaml"); + NextHopStrategyFactory nhf(TS_SRC_DIR "/consistent-hash-tests.yaml"); strategy = nhf.strategyInstance("hash-string-override"); WHEN("the config is loaded.") @@ -529,7 +529,7 @@ SCENARIO("Testing NextHopConsistentHash class (alternating rings), using policy GIVEN("Loading the consistent-hash-tests.yaml config for 'consistent_hash' tests.") { std::shared_ptr<NextHopSelectionStrategy> strategy; - NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/consistent-hash-tests.yaml"); + NextHopStrategyFactory nhf(TS_SRC_DIR "/consistent-hash-tests.yaml"); strategy = nhf.strategyInstance("consistent-hash-2"); WHEN("the config is loaded.") @@ -648,7 +648,7 @@ SCENARIO("Testing NextHopConsistentHash using a peering ring_mode.") GIVEN("Loading the peering.yaml config for 'consistent_hash' tests.") { std::shared_ptr<NextHopSelectionStrategy> strategy; - NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/peering.yaml"); + NextHopStrategyFactory nhf(TS_SRC_DIR "/peering.yaml"); strategy = nhf.strategyInstance("peering-group-1"); WHEN("the config is loaded.") diff --git a/src/proxy/http/remap/unit-tests/test_NextHopRoundRobin.cc b/src/proxy/http/remap/unit-tests/test_NextHopRoundRobin.cc index 36729dada7..3672dfff12 100644 --- a/src/proxy/http/remap/unit-tests/test_NextHopRoundRobin.cc +++ b/src/proxy/http/remap/unit-tests/test_NextHopRoundRobin.cc @@ -48,7 +48,7 @@ SCENARIO("Testing NextHopRoundRobin class, using policy 'rr-strict'", "[NextHopR GIVEN("Loading the round-robin-tests.yaml config for round robin 'rr-strict' tests.") { std::shared_ptr<NextHopSelectionStrategy> strategy; - NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/round-robin-tests.yaml"); + NextHopStrategyFactory nhf(TS_SRC_DIR "/round-robin-tests.yaml"); strategy = nhf.strategyInstance("rr-strict-exhaust-ring"); WHEN("the config is loaded.") @@ -173,7 +173,7 @@ SCENARIO("Testing NextHopRoundRobin class, using policy 'first-live'", "[NextHop GIVEN("Loading the round-robin-tests.yaml config for round robin 'first-live' tests.") { std::shared_ptr<NextHopSelectionStrategy> strategy; - NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/round-robin-tests.yaml"); + NextHopStrategyFactory nhf(TS_SRC_DIR "/round-robin-tests.yaml"); strategy = nhf.strategyInstance("first-live"); WHEN("the config is loaded.") @@ -242,7 +242,7 @@ SCENARIO("Testing NextHopRoundRobin class, using policy 'rr-ip'", "[NextHopRound GIVEN("Loading the round-robin-tests.yaml config for round robin 'rr-ip' tests.") { std::shared_ptr<NextHopSelectionStrategy> strategy; - NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/round-robin-tests.yaml"); + NextHopStrategyFactory nhf(TS_SRC_DIR "/round-robin-tests.yaml"); strategy = nhf.strategyInstance("rr-ip"); sockaddr_in sa1, sa2; sa1.sin_port = 10000; @@ -329,7 +329,7 @@ SCENARIO("Testing NextHopRoundRobin class, using policy 'latched'", "[NextHopRou GIVEN("Loading the round-robin-tests.yaml config for round robin 'latched' tests.") { std::shared_ptr<NextHopSelectionStrategy> strategy; - NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/round-robin-tests.yaml"); + NextHopStrategyFactory nhf(TS_SRC_DIR "/round-robin-tests.yaml"); strategy = nhf.strategyInstance("latched"); WHEN("the config is loaded.") diff --git a/src/proxy/http/remap/unit-tests/test_NextHopStrategyFactory.cc b/src/proxy/http/remap/unit-tests/test_NextHopStrategyFactory.cc index 4f550eea90..4bce72da75 100644 --- a/src/proxy/http/remap/unit-tests/test_NextHopStrategyFactory.cc +++ b/src/proxy/http/remap/unit-tests/test_NextHopStrategyFactory.cc @@ -44,9 +44,9 @@ SCENARIO("factory tests loading yaml configs", "[loadConfig]") GIVEN("Loading the strategy.yaml with included 'hosts.yaml'.") { #ifdef TS_SRC_DIR - REQUIRE(chdir(TS_SRC_DIR) == 0); + REQUIRE(chdir(TS_SRC_DIR "/..") == 0); #endif - NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/strategy.yaml"); + NextHopStrategyFactory nhf(TS_SRC_DIR "/strategy.yaml"); WHEN("the two files are loaded.") { @@ -219,7 +219,7 @@ SCENARIO("factory tests loading yaml configs", "[loadConfig]") GIVEN("loading a yaml config, simple-strategy.yaml ") { - NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/simple-strategy.yaml"); + NextHopStrategyFactory nhf(TS_SRC_DIR "/simple-strategy.yaml"); WHEN("loading the single file") { @@ -360,7 +360,7 @@ SCENARIO("factory tests loading yaml configs", "[loadConfig]") GIVEN("loading a yaml config combining hosts and strategies into one file, combined.yaml") { - NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/combined.yaml"); + NextHopStrategyFactory nhf(TS_SRC_DIR "/combined.yaml"); WHEN("loading the single file") { @@ -782,7 +782,7 @@ SCENARIO("factory tests loading yaml configs from a directory", "[loadConfig]") { GIVEN("Loading the strategies using a directory of 'yaml' files") { - NextHopStrategyFactory nhf(TS_SRC_DIR "unit-tests/strategies-dir"); + NextHopStrategyFactory nhf(TS_SRC_DIR "/strategies-dir"); WHEN("the two files are loaded.") { diff --git a/src/proxy/http/remap/unit-tests/test_PluginDso.cc b/src/proxy/http/remap/unit-tests/test_PluginDso.cc index c4ae83d1ff..3f6a119c74 100644 --- a/src/proxy/http/remap/unit-tests/test_PluginDso.cc +++ b/src/proxy/http/remap/unit-tests/test_PluginDso.cc @@ -43,7 +43,7 @@ std::error_code ec; static fs::path sandboxDir = getTemporaryDir(); static fs::path runtimeDir = sandboxDir / fs::path("runtime"); static fs::path searchDir = sandboxDir / fs::path("search"); -static fs::path pluginBuildDir = fs::current_path() / fs::path("unit-tests/.libs"); +static fs::path pluginBuildDir = fs::current_path(); /* The following are paths used in all scenarios in the unit tests */ static fs::path configPath = fs::path("plugin_v1.so"); @@ -110,7 +110,7 @@ SCENARIO("loading plugins", "[plugin][core]") WHEN("loading a valid plugin") { - bool result = plugin.load(error); + bool result = plugin.load(error, fs::path()); // Dummy compiler path. THEN("expect it to successfully load") { @@ -125,7 +125,7 @@ SCENARIO("loading plugins", "[plugin][core]") WHEN("loading a valid plugin") { - bool result = plugin.load(error); + bool result = plugin.load(error, fs::path()); // Dummy compiler path. THEN("expect saving the right DSO file modification time") { @@ -142,7 +142,7 @@ SCENARIO("loading plugins", "[plugin][core]") { CHECK(fs::remove_all(runtimeDir, ec) > 0); CHECK_FALSE(fs::exists(runtimePath)); - bool result = plugin.load(error); + bool result = plugin.load(error, fs::path()); // Dummy compiler path. THEN("expect it to fail") { @@ -155,12 +155,12 @@ SCENARIO("loading plugins", "[plugin][core]") WHEN("loading a valid plugin twice in a row") { /* First attempt OK */ - bool result = plugin.load(error); + bool result = plugin.load(error, fs::path()); // Dummy compiler path. CHECK(true == result); CHECK(error.empty()); /* Second attempt */ - result = plugin.load(error); + result = plugin.load(error, fs::path()); // Dummy compiler path. THEN("expect it to fail the second attempt") { @@ -190,7 +190,7 @@ SCENARIO("loading plugins", "[plugin][core]") WHEN("unloading a valid plugin twice in a row") { /* First attempt OK */ - bool result = plugin.load(error); + bool result = plugin.load(error, fs::path()); // Dummy compiler path. CHECK(true == result); CHECK(error.empty()); result = plugin.unload(error); @@ -214,7 +214,7 @@ SCENARIO("loading plugins", "[plugin][core]") CHECK_FALSE(fs::exists(runtimePath)); /* Load and make sure it is loaded */ - CHECK(plugin.load(error)); + CHECK(plugin.load(error, fs::path())); // Dummy compiler path. /* Effective and runtime path set */ CHECK(effectivePath == plugin.effectivePath()); CHECK(runtimePath == plugin.runtimePath()); @@ -243,7 +243,7 @@ SCENARIO("loading plugins", "[plugin][core]") PluginDsoUnitTest localPlugin(configPath, effectivePath, runtimePath); /* Load and make sure it is loaded */ - CHECK(localPlugin.load(error)); + CHECK(localPlugin.load(error, fs::path())); // Dummy compiler path. /* Effective and runtime path set */ CHECK(effectivePath == localPlugin.effectivePath()); CHECK(runtimePath == localPlugin.runtimePath()); @@ -269,7 +269,7 @@ SCENARIO("loading plugins", "[plugin][core]") WHEN("loading the plugin") { - bool result = plugin.load(error); + bool result = plugin.load(error, fs::path()); // Dummy compiler path. THEN("expect the load to fail") { @@ -300,7 +300,7 @@ SCENARIO("loading plugins", "[plugin][core]") WHEN("loading an invalid plugin") { - bool result = plugin.load(error); + bool result = plugin.load(error, fs::path()); // Dummy compiler path. THEN("expect it to fail to load") { @@ -341,7 +341,7 @@ SCENARIO("looking for symbols inside a plugin DSO", "[plugin][core]") /* Now test away. */ GIVEN("plugin loaded successfully") { - CHECK(plugin.load(error)); + CHECK(plugin.load(error, fs::path())); // Dummy compiler path. WHEN("looking for an existing symbol") { diff --git a/src/proxy/http/remap/unit-tests/test_PluginFactory.cc b/src/proxy/http/remap/unit-tests/test_PluginFactory.cc index 2626c5441d..b2cf2bbed3 100644 --- a/src/proxy/http/remap/unit-tests/test_PluginFactory.cc +++ b/src/proxy/http/remap/unit-tests/test_PluginFactory.cc @@ -106,7 +106,7 @@ static fs::path sandboxDir = getTemporaryDir(); static fs::path runtimeRootDir = sandboxDir / "runtime"; static fs::path runtimeDir = runtimeRootDir / tempComponent; static fs::path searchDir = sandboxDir / "search"; -static fs::path pluginBuildDir = fs::current_path() / "unit-tests/.libs"; +static fs::path pluginBuildDir = fs::current_path(); void clean() @@ -472,7 +472,7 @@ SCENARIO("multiple search dirs + multiple or no plugins installed", "[plugin][co fs::path runtimePath1 = runtimeDir / effectivePath1.relative_path(); fs::path runtimePath2 = runtimeDir / effectivePath2.relative_path(); fs::path runtimePath3 = runtimeDir / effectivePath3.relative_path(); - fs::path pluginBuildPath = fs::current_path() / fs::path("unit-tests/.libs") / pluginName; + fs::path pluginBuildPath = fs::current_path() / pluginName; std::string error; diff --git a/src/proxy/http/remap/unit-tests/test_RemapPlugin.cc b/src/proxy/http/remap/unit-tests/test_RemapPlugin.cc index cae770af06..8cf0831e03 100644 --- a/src/proxy/http/remap/unit-tests/test_RemapPlugin.cc +++ b/src/proxy/http/remap/unit-tests/test_RemapPlugin.cc @@ -44,7 +44,7 @@ std::error_code ec; static fs::path sandboxDir = getTemporaryDir(); static fs::path runtimeDir = sandboxDir / "runtime"; static fs::path searchDir = sandboxDir / "search"; -static fs::path pluginBuildDir = fs::current_path() / "unit-tests/.libs"; +static fs::path pluginBuildDir = fs::current_path(); void clean() @@ -106,7 +106,7 @@ setupSandBox(const fs::path configPath) bool loadPlugin(RemapPluginUnitTest *plugin, std::string &error, PluginDebugObject *&debugObject) { - bool result = plugin->load(error); + bool result = plugin->load(error, fs::path()); // Dummy compiler path. debugObject = plugin->getDebugObject(); return result; }
