Copilot commented on code in PR #12593:
URL: https://github.com/apache/trafficserver/pull/12593#discussion_r4447370657
##########
src/proxy/http/remap/PluginFactory.cc:
##########
@@ -216,8 +217,18 @@ PluginFactory::getRemapPlugin(const fs::path &configPath,
int argc, char **argv,
plugin = new RemapPluginInfo(configPath, effectivePath, runtimePath);
if (nullptr != plugin) {
- if (plugin->load(error, _compilerPath)) {
- if (plugin->init(error)) {
+ bool loaded = false;
+ bool initialized = false;
+ {
+ // TSRemapInit is plugin-global: hide the loading rule from the
strategy APIs.
+ UrlMappingInstanceScope const no_rule{nullptr};
Review Comment:
This new scope introduces references to `url_mapping::loading_instance()`
and `set_loading_instance()`, whose definitions live in `UrlMapping.cc`. The
`test_PluginFactory` target compiles `PluginFactory.cc` directly and links
`ts::proxy`/`ts::tsapi`, not `ts::http_remap` (and therefore does not link
`UrlMapping.cc`), so that existing unit-test target will fail at link time with
undefined symbols. Adjust that target/source arrangement (or otherwise provide
the UrlMapping implementation) along with this change.
##########
src/proxy/http/remap/unit-tests/CMakeLists.txt:
##########
@@ -324,3 +324,25 @@ target_link_libraries(
)
add_catch2_test(NAME test_RemapRulesYaml COMMAND
$<TARGET_FILE:test_RemapRulesYaml>)
+
+### test_StrategyApi
########################################################################
+add_executable(test_StrategyApi test_StrategyApi.cc)
+
+target_compile_definitions(test_StrategyApi PRIVATE
TS_SRC_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\")
+
+# tsapi_objects rather than the shared tsapi, which fails to load on macOS
(ET_UDP).
+target_link_libraries(
+ test_StrategyApi
+ PRIVATE Catch2::Catch2WithMain
+ tsapi_objects
+ ts::http
Review Comment:
`InkAPI.cc` references the global `ts::Overridable_Txn_Vars`, which is
defined in `src/shared/overridable_txn_vars.cc`; unlike `test_api`, this new
executable does not link `ts::overridable_txn_vars`. Because `tsapi_objects` is
linked directly, the target will fail to link with an unresolved
`Overridable_Txn_Vars` symbol. Add the shared target to this test's link
dependencies.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]