Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ option(ENABLE_JEMALLOC "Use jemalloc (default OFF)")
option(ENABLE_LUAJIT "Use LuaJIT (default OFF)")
option(ENABLE_MIMALLOC "Use mimalloc (default OFF)")
option(ENABLE_DOCS "Build docs (default OFF)")
option(ENABLE_AUTEST "Setup autest (default OFF)")
option(ENABLE_BENCHMARKS "Build benchmarks (default OFF)")

# Setup user
Expand Down Expand Up @@ -314,11 +315,21 @@ check_symbol_exists(
)
check_symbol_exists(TLS1_3_VERSION "openssl/ssl.h" TS_USE_TLS13)

# document tools
if(ENABLE_DOCS OR ENABLE_AUTEST)
find_package(Python3 REQUIRED)
find_program(PipEnv pipenv REQUIRED)
endif()

if(ENABLE_DOCS)
find_package(Python3 REQUIRED)
find_package(Java COMPONENTS Runtime REQUIRED)
find_program(PipEnv pipenv REQUIRED)
find_package(Java COMPONENTS Runtime REQUIRED)
endif()

if(ENABLE_AUTEST)
set(AUTEST_SANDBOX ${CMAKE_BINARY_DIR}/_sandbox CACHE STRING "Location for autest output (default
CMAKE_BINARY_DIR/_sandbox)")
set(PROXY_VERIFIER_VERSION "v2.10.1")
set(PROXY_VERIFIER_HASH "SHA1=0f189a37596d7488b5b81b5547df6fc1eadf56a1")
Comment on lines +330 to +331
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kind of handy to have these both specified here.

include(proxy-verifier)
endif()

include(CTest)
Expand Down Expand Up @@ -414,7 +425,9 @@ if(ENABLE_WCCP)
add_subdirectory(src/traffic_wccp)
endif()
add_subdirectory(src/tests)
add_subdirectory(tests)
if(ENABLE_AUTEST)
add_subdirectory(tests)
endif()
add_subdirectory(plugins)
add_subdirectory(configs)
if(ENABLE_EXAMPLE)
Expand Down Expand Up @@ -508,4 +521,3 @@ cmake_print_variables(TS_PKGSYSGROUP)
cmake_print_variables(BUILD_MACHINE)
cmake_print_variables(DEFAULT_STACK_SIZE)
cmake_print_variables(CMAKE_INSTALL_RPATH)
cmake_print_variables(OPENSSL_VERSION)
2 changes: 1 addition & 1 deletion cmake/ConfigureTransparentProxy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ endif()

# If the read fails, it will print out a confusing error. This
# is to make it clear why the error is happening in that case.
message("ENABLE_TPROXY enabled, looking for value in /usr/include/linux/in.h")
message(STATUS "ENABLE_TPROXY enabled, looking for value in /usr/include/linux/in.h")
file(READ "/usr/include/linux/in.h" HEADER_CONTENTS)
if(HEADER_CONTENTS MATCHES "#define[ \t]+IP_TRANSPARENT[ \t]+([0-9]+)")
set(TS_USE_TPROXY TRUE)
Expand Down
5 changes: 3 additions & 2 deletions cmake/install_configs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@
# If the config file doesn't exist, the source config file is copied without the '.default' extension
# If the config file already exists, the source config file is copied with the '.default' extension


file(GLOB CONFIG_FILES ${CONFIG_SOURCE_GLOBS})
file(MAKE_DIRECTORY ${CONFIG_DEST_PATH})
file(MAKE_DIRECTORY $ENV{DESTDIR}${CONFIG_DEST_PATH})
foreach(CONFIG_FILE ${CONFIG_FILES})
# remove the '.default' extension from the path
cmake_path(GET CONFIG_FILE STEM LAST_ONLY CONFIG_FILE_NAME)
set(DEST_FILE "${CONFIG_DEST_PATH}/${CONFIG_FILE_NAME}")
set(DEST_FILE "$ENV{DESTDIR}${CONFIG_DEST_PATH}/${CONFIG_FILE_NAME}")
if (EXISTS ${DEST_FILE})
set(DEST_FILE "${DEST_FILE}.default")
endif()
Expand Down
79 changes: 79 additions & 0 deletions cmake/proxy-verifier.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#######################
#
# 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 will download and extract proxy-verifier and setup variables to point to it.
#
# Required variables:
# PROXY_VERIFIER_VERSION
# PROXY_VERIFIER_HASH
#
# Defines variables:
#
# PROXY_VERIFIER_PATH Full path to the extracted proxy verifier for the build architecture
# PROXY_VERIFIER_CLIENT Full path to client-verifier
# PROXY_VERIFIER_SERVER Full path to server-verifier

if(NOT PROXY_VERIFIER_VERSION)
message(FATAL_ERROR "PROXY_VERIFIER_VERSION Required")
endif()

if(NOT PROXY_VERIFIER_HASH)
message(FATAL_ERROR "PROXY_VERIFIER_HASH Required")
endif()

# Download proxy-verifier
set(PV_ARCHIVE ${CMAKE_BINARY_DIR}/proxy-verifier/proxy-verifier.tar.gz)
file(DOWNLOAD
https://ci.trafficserver.apache.org/bintray/proxy-verifier-${PROXY_VERIFIER_VERSION}.tar.gz
${PV_ARCHIVE}
EXPECTED_HASH ${PROXY_VERIFIER_HASH}
SHOW_PROGRESS
)
file(ARCHIVE_EXTRACT
INPUT ${PV_ARCHIVE}
)

if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64" OR
CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "amd64" OR
CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "i686")
set(PV_SUBDIR "linux-amd64")
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm64" OR
CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "aarch64")
set(PV_SUBDIR "linux-arm64")
else()
message(FATAL_ERROR "Unknown processor ${CMAKE_HOST_SYSTEM_PROCESSOR}")
endif()
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64" OR
CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "amd64" OR
CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "i686")
set(PV_SUBDIR "darwin-amd64")
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm64")
set(PV_SUBDIR "darwin-arm64")
else()
message(FATAL_ERROR "Unknown processor ${CMAKE_HOST_SYSTEM_PROCESSOR}")
endif()
else()
message(FATAL_ERROR "Host ${CMAKE_HOST_SYSTEM_NAME} doesnt support running proxy verifier")
endif()

set(PROXY_VERIFIER_PATH ${CMAKE_BINARY_DIR}/proxy-verifier-${PROXY_VERIFIER_VERSION}/${PV_SUBDIR})
set(PROXY_VERIFIER_CLIENT ${PROXY_VERIFIER_PATH}/verifier-client)
set(PROXY_VERIFIER_SERVER ${PROXY_VERIFIER_PATH}/verifier-server)

message(STATUS "proxy-verifier setup in ${PROXY_VERIFIER_PATH}")
2 changes: 1 addition & 1 deletion configs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

# This is odd but seems to be the idiomatic way to pass arguments to install scripts
install(CODE "set(CONFIG_SOURCE_GLOBS \"${CMAKE_BINARY_DIR}/configs/*.default\" \"${CMAKE_SOURCE_DIR}/configs/*.default\")")
install(CODE "set(CONFIG_DEST_PATH \"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/etc/trafficserver\")")
install(CODE "set(CONFIG_DEST_PATH \"${CMAKE_INSTALL_PREFIX}/etc/trafficserver\")")

install(SCRIPT ${CMAKE_SOURCE_DIR}/cmake/install_configs.cmake)

Expand Down
29 changes: 29 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@
#
#######################

function(ADD_AUTEST_PLUGIN _NAME _SOURCES)
add_library(${_NAME} MODULE ${_SOURCES})
set_target_properties(${_NAME} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.libs"
PREFIX ""
SUFFIX ".so"
)
target_link_libraries(${_NAME} PRIVATE traffic_server)
endfunction()

add_subdirectory(tools/plugins)
add_subdirectory(gold_tests/bigobj)
add_subdirectory(gold_tests/chunked_encoding)
Expand All @@ -25,3 +35,22 @@ add_subdirectory(gold_tests/pluginTest/tsapi)
add_subdirectory(gold_tests/pluginTest/TSVConnFd)
add_subdirectory(gold_tests/timeout)
add_subdirectory(gold_tests/tls)

set(RUNPIPENV PIPENV_VENV_IN_PROJECT=True ${PipEnv})

configure_file(Pipfile Pipfile COPYONLY)
configure_file(autest.sh.in autest.sh)

add_custom_target(
autest
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target install
COMMAND ${RUNPIPENV} install
COMMAND ${RUNPIPENV} run env autest
--directory ${CMAKE_CURRENT_SOURCE_DIR}/gold_tests
--ats-bin=${CMAKE_INSTALL_PREFIX}/bin
--proxy-verifier-bin ${PROXY_VERIFIER_PATH}
--build-root ${CMAKE_BINARY_DIR}
--sandbox ${AUTEST_SANDBOX}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
USES_TERMINAL
)
13 changes: 13 additions & 0 deletions tests/autest.sh.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
#
# conveinience script for running autest after building the target
#
#

export LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib

${RUNPIPENV} run env autest \
--directory ${CMAKE_CURRENT_SOURCE_DIR}/gold_tests \
--ats-bin=${CMAKE_INSTALL_PREFIX}/bin \
--proxy-verifier-bin ${PROXY_VERIFIER_PATH} \
--build-root ${CMAKE_BINARY_DIR} "$@"
10 changes: 0 additions & 10 deletions tests/tools/plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@
#
#######################

function(ADD_AUTEST_PLUGIN _NAME _SOURCES)
add_library(${_NAME} MODULE ${_SOURCES})
set_target_properties(${_NAME} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.libs"
PREFIX ""
SUFFIX ".so"
)
target_link_libraries(${_NAME} PRIVATE traffic_server)
endfunction()

add_autest_plugin(cert_update cert_update.cc)
add_autest_plugin(conf_remap_stripped conf_remap_stripped.cc)
add_autest_plugin(continuations_verify continuations_verify.cc)
Expand Down