This is an automated email from the ASF dual-hosted git repository.

cmcfarlen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new aa0b33958c Cleanup build with tsapibackend (#10725)
aa0b33958c is described below

commit aa0b33958c795260c9fd263b8c1009785a4fc3f8
Author: Chris McFarlen <[email protected]>
AuthorDate: Tue Nov 7 18:26:17 2023 -0600

    Cleanup build with tsapibackend (#10725)
    
    * Introduce tsapibackend
    
    * unit tests only link with the library they are testing
    
    * cleanup some links for traffic_ programs
    
    * remove dup stubs
    
    * run cmake-format
    
    * add overridable_txn_vars
    
    ---------
    
    Co-authored-by: Chris McFarlen <[email protected]>
---
 CMakeLists.txt                                     |   3 -
 .../uri_signing/unit_tests/CMakeLists.txt          |   2 +-
 src/api/CMakeLists.txt                             |  34 +++--
 src/api/HttpHookState.cc                           | 103 +++++++++++++
 src/api/InkAPI.cc                                  |  85 -----------
 src/iocore/aio/CMakeLists.txt                      |  10 ++
 src/iocore/cache/CMakeLists.txt                    |  35 +++++
 src/iocore/cache/unit_tests/main.cc                |  40 -----
 src/iocore/cache/unit_tests/stub.cc                |  37 +++++
 src/iocore/eventsystem/CMakeLists.txt              |  15 ++
 .../eventsystem/unit_tests/test_MIOBufferWriter.cc |   2 +-
 src/iocore/net/CMakeLists.txt                      |  30 ++--
 src/iocore/net/libinknet_stub.cc                   |  39 +++++
 src/mgmt/rpc/CMakeLists.txt                        |   2 +-
 src/proxy/CMakeLists.txt                           |   2 +-
 src/tests/CMakeLists.txt                           | 162 ---------------------
 src/traffic_layout/CMakeLists.txt                  |  12 +-
 src/traffic_logcat/CMakeLists.txt                  |  16 +-
 src/traffic_logstats/CMakeLists.txt                |  12 +-
 19 files changed, 287 insertions(+), 354 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0bd4c2a04c..10d37354dd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -607,9 +607,6 @@ endif()
 if(ENABLE_CRIPTS)
   add_subdirectory(src/cripts)
 endif()
-if(BUILD_TESTING)
-  add_subdirectory(src/tests)
-endif()
 if(ENABLE_AUTEST)
   add_subdirectory(tests)
 endif()
diff --git a/plugins/experimental/uri_signing/unit_tests/CMakeLists.txt 
b/plugins/experimental/uri_signing/unit_tests/CMakeLists.txt
index 8e5360f762..0cca0ae709 100644
--- a/plugins/experimental/uri_signing/unit_tests/CMakeLists.txt
+++ b/plugins/experimental/uri_signing/unit_tests/CMakeLists.txt
@@ -28,7 +28,6 @@ add_executable(
   ${PROJECT_SOURCE_DIR}/parse.cc
   ${PROJECT_SOURCE_DIR}/timing.cc
   ${PROJECT_SOURCE_DIR}/uri_signing.cc
-  ${CMAKE_SOURCE_DIR}/src/shared/overridable_txn_vars.cc
 )
 target_compile_definitions(uri_signing_test PRIVATE UNITTEST)
 target_include_directories(uri_signing_test PRIVATE ${PROJECT_SOURCE_DIR})
@@ -44,6 +43,7 @@ target_link_libraries(
           ts::configmanager
           ts::logging
           ts::inknet
+          ts::overridable_txn_vars
           OpenSSL::SSL
           OpenSSL::Crypto
 )
diff --git a/src/api/CMakeLists.txt b/src/api/CMakeLists.txt
index d785a3d6c8..fc6c15b2c7 100644
--- a/src/api/CMakeLists.txt
+++ b/src/api/CMakeLists.txt
@@ -15,7 +15,9 @@
 #
 #######################
 
-add_library(tsapi SHARED InkAPI.cc InkIOCoreAPI.cc)
+# plugin api *only*
+add_library(tsapi SHARED InkAPI.cc InkIOCoreAPI.cc FetchSM.cc # OSCP stapling
+)
 add_library(ts::tsapi ALIAS tsapi)
 
 set(TSAPI_PUBLIC_HEADERS
@@ -32,23 +34,31 @@ set(TSAPI_PUBLIC_HEADERS
 target_link_libraries(tsapi PRIVATE libswoc yaml-cpp::yaml-cpp PCRE::PCRE 
OpenSSL::SSL)
 set_target_properties(tsapi PROPERTIES PUBLIC_HEADER "${TSAPI_PUBLIC_HEADERS}")
 
+# Items common between api and other ts libraries
 add_library(
-  tsapicore STATIC
-  APIHook.cc
-  APIHooks.cc
-  Metrics.cc
-  ConfigUpdateCbTable.cc
-  InkContInternal.cc
-  InkVConnInternal.cc
-  FetchSM.cc
-  LifecycleAPIHooks.cc
-  DbgCtl.cc
+  tsapibackend
+  ConfigUpdateCbTable.cc # configmanager
+  InkContInternal.cc # proxy, http
+  InkVConnInternal.cc # proxy, http
+  APIHook.cc # iocore
+  APIHooks.cc # proxy
+  LifecycleAPIHooks.cc # proxy, http
+  HttpHookState.cc # proxy, http
+)
+add_library(ts::tsapibackend ALIAS tsapibackend)
+target_link_libraries(
+  tsapibackend
+  PUBLIC ts::inknet ts::http
+  PRIVATE ts::proxy ts::hdrs ts::tscore
 )
+
+# Items that even tscore can depend on
+add_library(tsapicore Metrics.cc DbgCtl.cc)
 add_library(ts::tsapicore ALIAS tsapicore)
 target_link_libraries(tsapicore PRIVATE ts::tscore)
 set_target_properties(tsapicore PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
 
-install(TARGETS tsapi PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ts)
+install(TARGETS tsapi tsapicore tsapibackend PUBLIC_HEADER DESTINATION 
${CMAKE_INSTALL_INCLUDEDIR}/ts)
 
 if(APPLE)
   target_link_options(tsapi PRIVATE -undefined dynamic_lookup)
diff --git a/src/api/HttpHookState.cc b/src/api/HttpHookState.cc
new file mode 100644
index 0000000000..4e120454fa
--- /dev/null
+++ b/src/api/HttpHookState.cc
@@ -0,0 +1,103 @@
+/** @file
+
+  Internal SDK stuff
+
+  @section license License
+
+  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.
+ */
+
+#include "api/InkAPIInternal.h"
+
+void
+HttpHookState::init(TSHttpHookID id, HttpAPIHooks const *global, HttpAPIHooks 
const *ssn, HttpAPIHooks const *txn)
+{
+  _id = id;
+
+  if (global) {
+    _global.init(global, id);
+  } else {
+    _global.clear();
+  }
+
+  if (ssn) {
+    _ssn.init(ssn, id);
+  } else {
+    _ssn.clear();
+  }
+
+  if (txn) {
+    _txn.init(txn, id);
+  } else {
+    _txn.clear();
+  }
+}
+
+APIHook const *
+HttpHookState::getNext()
+{
+  APIHook const *zret = nullptr;
+
+#ifdef DEBUG
+  Debug("plugin", "computing next callback for hook %d", _id);
+#endif
+
+  if (zret = _global.candidate(); zret) {
+    ++_global;
+  } else if (zret = _ssn.candidate(); zret) {
+    ++_ssn;
+  } else if (zret = _txn.candidate(); zret) {
+    ++_txn;
+  }
+
+  return zret;
+}
+
+void
+HttpHookState::Scope::init(HttpAPIHooks const *feature_hooks, TSHttpHookID id)
+{
+  _hooks = (*feature_hooks)[id];
+
+  _p = nullptr;
+  _c = _hooks->head();
+}
+
+APIHook const *
+HttpHookState::Scope::candidate()
+{
+  /// Simply returns _c hook for now. Later will do priority checking here
+
+  // Check to see if a hook has been added since this was initialized empty
+  if (nullptr == _c && nullptr == _p && _hooks != nullptr) {
+    _c = _hooks->head();
+  }
+  return _c;
+}
+
+void
+HttpHookState::Scope::operator++()
+{
+  _p = _c;
+  _c = _c->next();
+}
+
+void
+HttpHookState::Scope::clear()
+{
+  _hooks = nullptr;
+  _p = _c = nullptr;
+}
diff --git a/src/api/InkAPI.cc b/src/api/InkAPI.cc
index 9965733d3d..b4c791e874 100644
--- a/src/api/InkAPI.cc
+++ b/src/api/InkAPI.cc
@@ -1041,91 +1041,6 @@ FileImpl::fgets(char *buf, size_t length)
   return buf;
 }
 
-////////////////////////////////////////////////////////////////////
-//
-// APIHook, APIHooks, HttpAPIHooks, HttpHookState
-//
-////////////////////////////////////////////////////////////////////
-
-void
-HttpHookState::init(TSHttpHookID id, HttpAPIHooks const *global, HttpAPIHooks 
const *ssn, HttpAPIHooks const *txn)
-{
-  _id = id;
-
-  if (global) {
-    _global.init(global, id);
-  } else {
-    _global.clear();
-  }
-
-  if (ssn) {
-    _ssn.init(ssn, id);
-  } else {
-    _ssn.clear();
-  }
-
-  if (txn) {
-    _txn.init(txn, id);
-  } else {
-    _txn.clear();
-  }
-}
-
-APIHook const *
-HttpHookState::getNext()
-{
-  APIHook const *zret = nullptr;
-
-#ifdef DEBUG
-  Debug("plugin", "computing next callback for hook %d", _id);
-#endif
-
-  if (zret = _global.candidate(); zret) {
-    ++_global;
-  } else if (zret = _ssn.candidate(); zret) {
-    ++_ssn;
-  } else if (zret = _txn.candidate(); zret) {
-    ++_txn;
-  }
-
-  return zret;
-}
-
-void
-HttpHookState::Scope::init(HttpAPIHooks const *feature_hooks, TSHttpHookID id)
-{
-  _hooks = (*feature_hooks)[id];
-
-  _p = nullptr;
-  _c = _hooks->head();
-}
-
-APIHook const *
-HttpHookState::Scope::candidate()
-{
-  /// Simply returns _c hook for now. Later will do priority checking here
-
-  // Check to see if a hook has been added since this was initialized empty
-  if (nullptr == _c && nullptr == _p && _hooks != nullptr) {
-    _c = _hooks->head();
-  }
-  return _c;
-}
-
-void
-HttpHookState::Scope::operator++()
-{
-  _p = _c;
-  _c = _c->next();
-}
-
-void
-HttpHookState::Scope::clear()
-{
-  _hooks = nullptr;
-  _p = _c = nullptr;
-}
-
 ////////////////////////////////////////////////////////////////////
 //
 // api_init
diff --git a/src/iocore/aio/CMakeLists.txt b/src/iocore/aio/CMakeLists.txt
index fbcdeadd0d..4d7446cdda 100644
--- a/src/iocore/aio/CMakeLists.txt
+++ b/src/iocore/aio/CMakeLists.txt
@@ -24,3 +24,13 @@ target_link_libraries(aio PUBLIC ts::inkevent ts::tscore)
 if(TS_USE_LINUX_IO_URING)
   target_link_libraries(aio PUBLIC ts::inkuring)
 endif()
+
+if(BUILD_TESTING)
+  add_executable(test_AIO test_AIO.cc)
+  target_link_libraries(test_AIO ts::aio)
+  add_test(
+    NAME test_AIO
+    COMMAND $<TARGET_FILE:test_AIO>
+    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src/iocore/aio
+  )
+endif()
diff --git a/src/iocore/cache/CMakeLists.txt b/src/iocore/cache/CMakeLists.txt
index 959c8f0381..f3748723b2 100644
--- a/src/iocore/cache/CMakeLists.txt
+++ b/src/iocore/cache/CMakeLists.txt
@@ -53,3 +53,38 @@ target_link_libraries(
 if(HAVE_LZMA_H)
   target_link_libraries(inkcache PRIVATE LibLZMA::LibLZMA)
 endif()
+
+if(BUILD_TESTING)
+  macro(add_cache_test name)
+    add_executable(${name} unit_tests/main.cc unit_tests/stub.cc 
unit_tests/CacheTestHandler.cc ${ARGN})
+    target_link_libraries(${name} PRIVATE ts::inkcache catch2::catch2)
+    add_test(NAME test_cache_${name} COMMAND $<TARGET_FILE:${name}>)
+  endmacro()
+
+  add_cache_test(Cache unit_tests/test_Cache.cc)
+  add_cache_test(Populated_Cache unit_tests/test_Populated_Cache.cc)
+  if(ENABLE_DISK_FAILURE_TESTS)
+    foreach(i RANGE 1)
+      add_cache_test(Disk_Init_Failure_${i} 
unit_tests/test_Disk_Init_Failure.cc)
+      target_compile_definitions(Disk_Init_Failure_${i} PUBLIC 
FAILURE_INDICES={${i}})
+    endforeach()
+    foreach(i RANGE 5 20)
+      add_cache_test(Disk_Failure_${i} unit_tests/test_Disk_Failure.cc)
+      target_compile_definitions(Disk_Failure_${i} PUBLIC 
FAILURE_INDICES={${i}})
+    endforeach()
+    add_cache_test(Populated_Cache_Disk_Failure 
unit_tests/test_Populated_Cache_Disk_Failure.cc)
+  endif()
+  add_cache_test(CacheDir unit_tests/test_CacheDir.cc)
+  add_cache_test(CacheVol unit_tests/test_CacheVol.cc)
+  add_cache_test(RWW unit_tests/test_RWW.cc)
+  add_cache_test(Alternate_L_to_S unit_tests/test_Alternate_L_to_S.cc)
+  add_cache_test(Alternate_S_to_L unit_tests/test_Alternate_S_to_L.cc)
+  add_cache_test(Alternate_L_to_S_remove_L 
unit_tests/test_Alternate_L_to_S_remove_L.cc)
+  add_cache_test(Alternate_L_to_S_remove_S 
unit_tests/test_Alternate_L_to_S_remove_S.cc)
+  add_cache_test(Alternate_S_to_L_remove_L 
unit_tests/test_Alternate_S_to_L_remove_L.cc)
+  add_cache_test(Alternate_S_to_L_remove_S 
unit_tests/test_Alternate_S_to_L_remove_S.cc)
+  add_cache_test(Update_L_to_S unit_tests/test_Update_L_to_S.cc)
+  add_cache_test(Update_S_to_L unit_tests/test_Update_S_to_L.cc)
+  add_cache_test(Update_Header unit_tests/test_Update_header.cc)
+
+endif()
diff --git a/src/iocore/cache/unit_tests/main.cc 
b/src/iocore/cache/unit_tests/main.cc
index 9c39f6be1f..863f656ee2 100644
--- a/src/iocore/cache/unit_tests/main.cc
+++ b/src/iocore/cache/unit_tests/main.cc
@@ -366,43 +366,3 @@ CacheReadTest::start_test(int event, void *e)
 }
 
 constexpr size_t WRITE_LIMIT = 1024 * 3;
-
-/************ STUB ******************/
-
-#include "api/FetchSM.h"
-ClassAllocator<FetchSM> FetchSMAllocator("unusedFetchSMAllocator");
-void
-FetchSM::ext_launch()
-{
-}
-void
-FetchSM::ext_destroy()
-{
-}
-ssize_t
-FetchSM::ext_read_data(char *, unsigned long)
-{
-  return 0;
-}
-void
-FetchSM::ext_add_header(char const *, int, char const *, int)
-{
-}
-void
-FetchSM::ext_write_data(void const *, unsigned long)
-{
-}
-void *
-FetchSM::ext_get_user_data()
-{
-  return nullptr;
-}
-void
-FetchSM::ext_set_user_data(void *)
-{
-}
-void
-FetchSM::ext_init(Continuation *, char const *, char const *, char const *, 
sockaddr const *, int)
-{
-}
-ChunkedHandler::ChunkedHandler() {}
diff --git a/src/iocore/cache/unit_tests/stub.cc 
b/src/iocore/cache/unit_tests/stub.cc
index 66c5d50def..20f5385456 100644
--- a/src/iocore/cache/unit_tests/stub.cc
+++ b/src/iocore/cache/unit_tests/stub.cc
@@ -77,3 +77,40 @@ TSIOBufferReaderConsume(TSIOBufferReader readerp, int64_t 
nbytes)
 {
 }
 } // namespace tsapi::c
+
+#include "api/FetchSM.h"
+ClassAllocator<FetchSM> FetchSMAllocator("unusedFetchSMAllocator");
+void
+FetchSM::ext_launch()
+{
+}
+void
+FetchSM::ext_destroy()
+{
+}
+ssize_t
+FetchSM::ext_read_data(char *, unsigned long)
+{
+  return 0;
+}
+void
+FetchSM::ext_add_header(char const *, int, char const *, int)
+{
+}
+void
+FetchSM::ext_write_data(void const *, unsigned long)
+{
+}
+void *
+FetchSM::ext_get_user_data()
+{
+  return nullptr;
+}
+void
+FetchSM::ext_set_user_data(void *)
+{
+}
+void
+FetchSM::ext_init(Continuation *, char const *, char const *, char const *, 
sockaddr const *, int)
+{
+}
diff --git a/src/iocore/eventsystem/CMakeLists.txt 
b/src/iocore/eventsystem/CMakeLists.txt
index 25a7d870d6..8792cab202 100644
--- a/src/iocore/eventsystem/CMakeLists.txt
+++ b/src/iocore/eventsystem/CMakeLists.txt
@@ -49,3 +49,18 @@ target_link_libraries(
 if(TS_USE_HWLOC)
   target_link_libraries(inkevent PRIVATE hwloc::hwloc)
 endif()
+
+if(BUILD_TESTING)
+  add_executable(test_EventSystem unit_tests/test_EventSystem.cc)
+  target_link_libraries(test_EventSystem ts::inkevent catch2::catch2)
+  add_executable(test_IOBuffer unit_tests/test_IOBuffer.cc)
+  target_link_libraries(test_IOBuffer ts::inkevent catch2::catch2)
+
+  add_executable(test_MIOBufferWriter unit_tests/test_MIOBufferWriter.cc)
+  target_link_libraries(test_MIOBufferWriter libswoc catch2::catch2)
+
+  add_test(NAME test_EventSystem COMMAND test_EventSystem)
+  add_test(NAME test_IOBuffer COMMAND test_IOBuffer)
+  add_test(NAME test_MIOBufferWriter COMMAND test_MIOBufferWriter)
+
+endif()
diff --git a/src/iocore/eventsystem/unit_tests/test_MIOBufferWriter.cc 
b/src/iocore/eventsystem/unit_tests/test_MIOBufferWriter.cc
index 49b7abc1b6..0e480d885d 100644
--- a/src/iocore/eventsystem/unit_tests/test_MIOBufferWriter.cc
+++ b/src/iocore/eventsystem/unit_tests/test_MIOBufferWriter.cc
@@ -42,7 +42,7 @@ struct MIOBuffer {
 
 #define UNIT_TEST_BUFFER_WRITER
 #include "iocore/eventsystem/MIOBufferWriter.h"
-#include "MIOBufferWriter.cc"
+#include "../MIOBufferWriter.cc"
 
 IOBufferBlock iobb[1];
 unsigned int iobbIdx{0};
diff --git a/src/iocore/net/CMakeLists.txt b/src/iocore/net/CMakeLists.txt
index 009c91f2fe..a713d4c534 100644
--- a/src/iocore/net/CMakeLists.txt
+++ b/src/iocore/net/CMakeLists.txt
@@ -94,7 +94,7 @@ if(TS_USE_QUIC)
   target_link_libraries(inknet PUBLIC quiche::quiche ts::quic)
 endif()
 
-if(BUILD_REGRESSION_TESTING)
+if(BUILD_REGRESSION_TESTING OR BUILD_TESTING)
   target_sources(inknet PRIVATE NetVCTest.cc)
 endif()
 
@@ -102,20 +102,28 @@ target_compile_options(inknet PUBLIC 
-Wno-deprecated-declarations)
 
 target_link_libraries(
   inknet
-  PUBLIC ts::inkevent ts::proxy ts::records ts::tscore OpenSSL::Crypto 
OpenSSL::SSL
+  PUBLIC ts::inkevent
+         ts::proxy
+         ts::records
+         ts::tscore
+         OpenSSL::Crypto
+         OpenSSL::SSL
+         ts::tsapibackend
   PRIVATE ts::tsapicore yaml-cpp::yaml-cpp
 )
 
+# Is this necessary?
 if(TS_USE_LINUX_IO_URING)
   target_link_libraries(inknet PUBLIC ts::inkuring)
 endif()
 
-# Fails to link because of circular dep with proxy (ParentSelection)
-# add_executable(test_net unit_tests/test_ProxyProtocol.cc)
-# target_link_libraries(test_net records_p inknet inkevent tscore yaml-cpp 
libswoc)
-# target_include_directories(test_net PRIVATE
-#         ${CMAKE_SOURCE_DIR}/include
-#         ${CMAKE_SOURCE_DIR}/iocore/net
-#         ${CMAKE_SOURCE_DIR}/iocore/eventsystem
-#         ${CATCH_INCLUDE_DIR}
-# )
+if(BUILD_TESTING)
+  add_executable(
+    test_net libinknet_stub.cc NetVCTest.cc unit_tests/test_ProxyProtocol.cc 
unit_tests/test_SSLSNIConfig.cc
+             unit_tests/test_YamlSNIConfig.cc unit_tests/unit_test_main.cc
+  )
+  target_link_libraries(test_net PRIVATE ts::inknet catch2::catch2)
+  set(LIBINKNET_UNIT_TEST_DIR "${CMAKE_SOURCE_DIR}/src/iocore/net/unit_tests")
+  target_compile_definitions(test_net PRIVATE 
LIBINKNET_UNIT_TEST_DIR=${LIBINKNET_UNIT_TEST_DIR})
+  add_test(NAME test_net COMMAND test_net)
+endif()
diff --git a/src/iocore/net/libinknet_stub.cc b/src/iocore/net/libinknet_stub.cc
index eeea04dadd..ee3c74d246 100644
--- a/src/iocore/net/libinknet_stub.cc
+++ b/src/iocore/net/libinknet_stub.cc
@@ -24,3 +24,42 @@
 #include "tscore/Version.h"
 
 AppVersionInfo appVersionInfo;
+
+#include "api/FetchSM.h"
+ClassAllocator<FetchSM> FetchSMAllocator("unusedFetchSMAllocator");
+void
+FetchSM::ext_launch()
+{
+}
+void
+FetchSM::ext_destroy()
+{
+}
+ssize_t
+FetchSM::ext_read_data(char *, unsigned long)
+{
+  return 0;
+}
+void
+FetchSM::ext_add_header(char const *, int, char const *, int)
+{
+}
+void
+FetchSM::ext_write_data(void const *, unsigned long)
+{
+}
+void *
+FetchSM::ext_get_user_data()
+{
+  return nullptr;
+}
+void
+FetchSM::ext_set_user_data(void *)
+{
+}
+void
+FetchSM::ext_init(Continuation *, char const *, char const *, char const *, 
sockaddr const *, int)
+{
+}
+
+ChunkedHandler::ChunkedHandler() {}
diff --git a/src/mgmt/rpc/CMakeLists.txt b/src/mgmt/rpc/CMakeLists.txt
index 3b97bcadf3..cdf60a8f91 100644
--- a/src/mgmt/rpc/CMakeLists.txt
+++ b/src/mgmt/rpc/CMakeLists.txt
@@ -46,7 +46,7 @@ add_library(ts::rpcpublichandlers ALIAS rpcpublichandlers)
 target_link_libraries(
   rpcpublichandlers
   PUBLIC ts::overridable_txn_vars ts::tscore
-  PRIVATE ts::inkcache ts::proxy ts::tsapicore
+  PRIVATE ts::inkcache ts::proxy ts::tsapicore ts::tsapibackend
 )
 
 if(BUILD_TESTING)
diff --git a/src/proxy/CMakeLists.txt b/src/proxy/CMakeLists.txt
index 8aae6e7378..c82bb866de 100644
--- a/src/proxy/CMakeLists.txt
+++ b/src/proxy/CMakeLists.txt
@@ -46,7 +46,7 @@ endif()
 target_link_libraries(
   proxy
   PUBLIC ts::inkcache ts::inkevent ts::tsapicore ts::tscore
-  PRIVATE ts::jsonrpc_protocol ts::inkutils
+  PRIVATE ts::jsonrpc_protocol ts::inkutils ts::tsapibackend
 )
 
 add_subdirectory(hdrs)
diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt
deleted file mode 100644
index 53db22f1c4..0000000000
--- a/src/tests/CMakeLists.txt
+++ /dev/null
@@ -1,162 +0,0 @@
-#######################
-#
-#  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.
-#
-#######################
-
-# This is for tests that depend on multiple libraries where dependency order 
matters.
-
-link_libraries(
-  inkcache
-  http
-  http_remap
-  http2
-  logging
-  hdrs
-  diagsconfig
-  inkutils
-  inkdns
-  inkhostdb
-  proxy
-  http
-  inkutils
-  inkdns
-  inkhostdb
-  proxy
-  http
-  hdrs
-  http_remap
-  logging
-  fastlz
-  aio
-  records
-  tscore
-  tsapicore
-  tscpputil
-  proxy
-  inknet
-  inkevent
-  yaml-cpp::yaml-cpp
-  libswoc
-  catch2::catch2
-  jsonrpc_protocol
-)
-if(TS_USE_LINUX_IO_URING)
-  link_libraries(inkuring uring)
-endif(TS_USE_LINUX_IO_URING)
-
-macro(add_cache_test name)
-  add_executable(
-    ${name}
-    ${CMAKE_SOURCE_DIR}/src/iocore/cache/unit_tests/main.cc 
${CMAKE_SOURCE_DIR}/src/iocore/cache/unit_tests/stub.cc
-    ${CMAKE_SOURCE_DIR}/src/iocore/cache/unit_tests/CacheTestHandler.cc ${ARGN}
-  )
-  target_link_libraries(${name} PRIVATE ts::inknet ts::proxy ts::tsapicore)
-  add_test(NAME test_cache_${name} COMMAND $<TARGET_FILE:${name}>)
-endmacro()
-
-macro(add_net_test name)
-  add_executable(
-    ${name} ${CMAKE_SOURCE_DIR}/src/iocore/net/libinknet_stub.cc 
${CMAKE_SOURCE_DIR}/src/shared/overridable_txn_vars.cc
-            ${ARGN}
-  )
-  target_link_libraries(
-    ${name}
-    PRIVATE ts::tsapicore
-            ts::inknet
-            ts::configmanager
-            ts::tsapi
-            ts::inknet
-            ts::http
-            ts::configmanager
-  )
-  add_test(NAME test_cache_${name} COMMAND $<TARGET_FILE:${name}>)
-endmacro()
-
-macro(add_stubbed_test name)
-  add_executable(${name} 
${CMAKE_SOURCE_DIR}/src/iocore/cache/unit_tests/stub.cc ${ARGN})
-  target_link_libraries(${name} PRIVATE ts::proxy ts::http)
-  add_test(NAME test_stubbed_${name} COMMAND $<TARGET_FILE:${name}>)
-endmacro()
-
-add_cache_test(Cache 
${CMAKE_SOURCE_DIR}/src/iocore/cache/unit_tests/test_Cache.cc)
-add_cache_test(Populated_Cache 
${CMAKE_SOURCE_DIR}/src/iocore/cache/unit_tests/test_Populated_Cache.cc)
-if(ENABLE_DISK_FAILURE_TESTS)
-  foreach(i RANGE 1)
-    add_cache_test(Disk_Init_Failure_${i} 
${CMAKE_SOURCE_DIR}/src/iocore/cache/unit_tests/test_Disk_Init_Failure.cc)
-    target_compile_definitions(Disk_Init_Failure_${i} PUBLIC 
FAILURE_INDICES={${i}})
-  endforeach()
-  foreach(i RANGE 5 20)
-    add_cache_test(Disk_Failure_${i} 
${CMAKE_SOURCE_DIR}/src/iocore/cache/unit_tests/test_Disk_Failure.cc)
-    target_compile_definitions(Disk_Failure_${i} PUBLIC FAILURE_INDICES={${i}})
-  endforeach()
-  add_cache_test(
-    Populated_Cache_Disk_Failure 
${CMAKE_SOURCE_DIR}/src/iocore/cache/unit_tests/test_Populated_Cache_Disk_Failure.cc
-  )
-endif()
-add_cache_test(CacheDir 
${CMAKE_SOURCE_DIR}/src/iocore/cache/unit_tests/test_CacheDir.cc)
-add_cache_test(CacheVol 
${CMAKE_SOURCE_DIR}/src/iocore/cache/unit_tests/test_CacheVol.cc)
-add_cache_test(RWW ${CMAKE_SOURCE_DIR}/src/iocore/cache/unit_tests/test_RWW.cc)
-add_cache_test(Alternate_L_to_S 
${CMAKE_SOURCE_DIR}/src/iocore/cache/unit_tests/test_Alternate_L_to_S.cc)
-add_cache_test(Alternate_S_to_L 
${CMAKE_SOURCE_DIR}/src/iocore/cache/unit_tests/test_Alternate_S_to_L.cc)
-add_cache_test(
-  Alternate_L_to_S_remove_L 
${CMAKE_SOURCE_DIR}/src/iocore/cache/unit_tests/test_Alternate_L_to_S_remove_L.cc
-)
-add_cache_test(
-  Alternate_L_to_S_remove_S 
${CMAKE_SOURCE_DIR}/src/iocore/cache/unit_tests/test_Alternate_L_to_S_remove_S.cc
-)
-add_cache_test(
-  Alternate_S_to_L_remove_L 
${CMAKE_SOURCE_DIR}/src/iocore/cache/unit_tests/test_Alternate_S_to_L_remove_L.cc
-)
-add_cache_test(
-  Alternate_S_to_L_remove_S 
${CMAKE_SOURCE_DIR}/src/iocore/cache/unit_tests/test_Alternate_S_to_L_remove_S.cc
-)
-add_cache_test(Update_L_to_S 
${CMAKE_SOURCE_DIR}/src/iocore/cache/unit_tests/test_Update_L_to_S.cc)
-add_cache_test(Update_S_to_L 
${CMAKE_SOURCE_DIR}/src/iocore/cache/unit_tests/test_Update_S_to_L.cc)
-#add_cache_test(Update_Header 
${CMAKE_SOURCE_DIR}/src/iocore/cache/unit_tests/test_Update_Header.cc)
-
-add_executable(test_AIO ${CMAKE_SOURCE_DIR}/src/iocore/aio/test_AIO.cc)
-add_test(
-  NAME test_AIO
-  COMMAND $<TARGET_FILE:test_AIO>
-  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src/iocore/aio
-)
-
-add_net_test(
-  test_net
-  "${CMAKE_SOURCE_DIR}/src/iocore/net/NetVCTest.cc"
-  "${CMAKE_SOURCE_DIR}/src/iocore/net/unit_tests/test_ProxyProtocol.cc"
-  "${CMAKE_SOURCE_DIR}/src/iocore/net/unit_tests/test_SSLSNIConfig.cc"
-  "${CMAKE_SOURCE_DIR}/src/iocore/net/unit_tests/test_YamlSNIConfig.cc"
-  "${CMAKE_SOURCE_DIR}/src/iocore/net/unit_tests/unit_test_main.cc"
-)
-set(LIBINKNET_UNIT_TEST_DIR "${CMAKE_SOURCE_DIR}/src/iocore/net/unit_tests")
-target_compile_definitions(test_net PRIVATE 
LIBINKNET_UNIT_TEST_DIR=${LIBINKNET_UNIT_TEST_DIR})
-target_link_libraries(test_net PRIVATE hdrs proxy ts::tsapicore)
-
-add_stubbed_test(
-  EventSystem ${CMAKE_SOURCE_DIR}/src/iocore/net/NetVCTest.cc
-  ${CMAKE_SOURCE_DIR}/src/iocore/eventsystem/unit_tests/test_EventSystem.cc
-)
-target_link_libraries(EventSystem PRIVATE ts::inknet)
-add_stubbed_test(IOBuffer 
${CMAKE_SOURCE_DIR}/src/iocore/eventsystem/unit_tests/test_IOBuffer.cc)
-
-add_stubbed_test(
-  HttpTransact ${CMAKE_SOURCE_DIR}/src/proxy/http/unit_tests/main.cc
-  ${CMAKE_SOURCE_DIR}/src/proxy/http/unit_tests/test_HttpTransact.cc
-)
-
-# maybe move this one back to iocore/eventsystem/CMakeLists.txt
-#add_stubbed_test(MIOBufferWriter 
${CMAKE_SOURCE_DIR}/iocore/eventsystem/unit_tests/test_MIOBufferWriter.cc)
-#add_stubbed_test(ProxyAllocator 
${CMAKE_SOURCE_DIR}/iocore/eventsystem/unit_tests/benchmark_ProxyAllocator.cc)
diff --git a/src/traffic_layout/CMakeLists.txt 
b/src/traffic_layout/CMakeLists.txt
index 3fcad51237..abb93b2bb7 100644
--- a/src/traffic_layout/CMakeLists.txt
+++ b/src/traffic_layout/CMakeLists.txt
@@ -17,17 +17,7 @@
 
 add_executable(traffic_layout engine.cc file_system.cc info.cc 
traffic_layout.cc)
 
-target_link_libraries(
-  traffic_layout
-  PRIVATE ts::inkevent
-          ts::records
-          OpenSSL::Crypto
-          yaml-cpp::yaml-cpp
-          ts::tscore
-          ts::tsapicore
-          PCRE::PCRE
-          ${OPENSSL_LIBRARY}
-)
+target_link_libraries(traffic_layout PRIVATE ts::inkevent ts::records 
yaml-cpp::yaml-cpp ts::tscore ts::tsapicore)
 
 if(TS_USE_HWLOC)
   target_link_libraries(traffic_layout PRIVATE hwloc::hwloc)
diff --git a/src/traffic_logcat/CMakeLists.txt 
b/src/traffic_logcat/CMakeLists.txt
index db737dd85a..5c16aac904 100644
--- a/src/traffic_logcat/CMakeLists.txt
+++ b/src/traffic_logcat/CMakeLists.txt
@@ -16,19 +16,5 @@
 #######################
 
 add_executable(traffic_logcat logcat.cc)
-target_link_libraries(
-  traffic_logcat
-  PRIVATE ts::tsapi
-          ts::overridable_txn_vars
-          ts::proxy
-          ts::inknet
-          ts::logging
-          ts::hdrs
-          ts::http
-          ts::tsapicore
-          ts::diagsconfig
-          ts::inkevent
-          ts::configmanager
-          libswoc
-)
+target_link_libraries(traffic_logcat PRIVATE ts::logging ts::tscore 
ts::diagsconfig ts::inkevent)
 install(TARGETS traffic_logcat)
diff --git a/src/traffic_logstats/CMakeLists.txt 
b/src/traffic_logstats/CMakeLists.txt
index 03babc0d80..b1b9f82138 100644
--- a/src/traffic_logstats/CMakeLists.txt
+++ b/src/traffic_logstats/CMakeLists.txt
@@ -16,17 +16,7 @@
 #######################
 
 add_executable(traffic_logstats logstats.cc)
-target_link_libraries(
-  traffic_logstats
-  PRIVATE ts::logging
-          ts::hdrs
-          ts::tscore
-          ts::tsapicore
-          ts::records
-          ts::diagsconfig
-          ts::inkevent
-          libswoc
-)
+target_link_libraries(traffic_logstats PRIVATE ts::logging ts::tscore 
ts::diagsconfig)
 
 install(TARGETS traffic_logstats)
 

Reply via email to