summaryrefslogtreecommitdiffstats
path: root/src/seastar/tests/dist
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
commit483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch)
treee5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/seastar/tests/dist
parentInitial commit. (diff)
downloadceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.tar.xz
ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.zip
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/seastar/tests/dist')
-rw-r--r--src/seastar/tests/dist/CMakeLists.txt54
-rw-r--r--src/seastar/tests/dist/consumer/CMakeLists.txt51
-rw-r--r--src/seastar/tests/dist/consumer/Makefile38
-rw-r--r--src/seastar/tests/dist/consumer/cmake_consumer.cc15
-rw-r--r--src/seastar/tests/dist/consumer/cmake_testing_consumer.cc13
-rw-r--r--src/seastar/tests/dist/consumer/pkgconfig_consumer.cc15
-rw-r--r--src/seastar/tests/dist/consumer/pkgconfig_testing_consumer.cc15
-rw-r--r--src/seastar/tests/dist/consumer/recipe/test_dist.cmake43
-rwxr-xr-xsrc/seastar/tests/dist/consumer_test.sh61
9 files changed, 305 insertions, 0 deletions
diff --git a/src/seastar/tests/dist/CMakeLists.txt b/src/seastar/tests/dist/CMakeLists.txt
new file mode 100644
index 00000000..e8368741
--- /dev/null
+++ b/src/seastar/tests/dist/CMakeLists.txt
@@ -0,0 +1,54 @@
+#
+# This file is open source software, licensed to you under the terms
+# of the Apache License, Version 2.0 (the "License"). See the NOTICE file
+# distributed with this work for additional information regarding copyright
+# ownership. 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.
+#
+
+#
+# Copyright (C) 2018 Scylladb, Ltd.
+#
+
+add_custom_command (
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/consumer
+ DEPENDS
+ ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/consumer/CMakeLists.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/consumer/Makefile
+ ${CMAKE_CURRENT_SOURCE_DIR}/consumer/cmake_consumer.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/consumer/pkgconfig_consumer.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/consumer/recipe/test_dist.cmake
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/consumer ${CMAKE_CURRENT_BINARY_DIR}/consumer)
+
+configure_file (
+ ${Seastar_SOURCE_DIR}/cooking.sh
+ ${CMAKE_CURRENT_BINARY_DIR}/consumer/cooking.sh
+ COPYONLY)
+
+add_custom_target (test_dist_consumer_test_run
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/consumer
+ COMMAND
+ ${CMAKE_COMMAND} -E env
+ CONSUMER_SOURCE_DIR=${CMAKE_CURRENT_BINARY_DIR}/consumer
+ SEASTAR_SOURCE_DIR=${Seastar_SOURCE_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/consumer_test.sh
+ USES_TERMINAL)
+
+add_test (
+ NAME Seastar.dist.consumer
+ COMMAND ${CMAKE_COMMAND} --build ${Seastar_BINARY_DIR} --target test_dist_consumer_test_run)
+
+add_custom_target (test_dist
+ COMMAND ctest --verbose -R Seastar.dist
+ USES_TERMINAL)
diff --git a/src/seastar/tests/dist/consumer/CMakeLists.txt b/src/seastar/tests/dist/consumer/CMakeLists.txt
new file mode 100644
index 00000000..4130239a
--- /dev/null
+++ b/src/seastar/tests/dist/consumer/CMakeLists.txt
@@ -0,0 +1,51 @@
+#
+# This file is open source software, licensed to you under the terms
+# of the Apache License, Version 2.0 (the "License"). See the NOTICE file
+# distributed with this work for additional information regarding copyright
+# ownership. 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.
+#
+
+#
+# Copyright (C) 2018 Scylladb, Ltd.
+#
+
+cmake_minimum_required (VERSION 3.5)
+
+list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
+include (Cooking OPTIONAL)
+
+project (SeastarConsumer)
+
+find_package (Boost 1.64.0 REQUIRED
+ COMPONENTS unit_test_framework)
+
+find_package (Seastar 1.0 REQUIRED)
+
+add_executable (cmake_consumer
+ cmake_consumer.cc)
+
+target_link_libraries (cmake_consumer
+ PRIVATE Seastar::seastar)
+
+add_executable (cmake_testing_consumer
+ cmake_testing_consumer.cc)
+
+target_compile_definitions (cmake_testing_consumer
+ PRIVATE SEASTAR_TESTING_MAIN)
+
+target_link_libraries (cmake_testing_consumer
+ PRIVATE
+ Boost::unit_test_framework
+ Seastar::seastar
+ Seastar::seastar_testing)
diff --git a/src/seastar/tests/dist/consumer/Makefile b/src/seastar/tests/dist/consumer/Makefile
new file mode 100644
index 00000000..d84aa1e7
--- /dev/null
+++ b/src/seastar/tests/dist/consumer/Makefile
@@ -0,0 +1,38 @@
+#
+# This file is open source software, licensed to you under the terms
+# of the Apache License, Version 2.0 (the "License"). See the NOTICE file
+# distributed with this work for additional information regarding copyright
+# ownership. 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.
+#
+
+#
+# Copyright (C) 2018 Scylladb, Ltd.
+#
+
+# Required environmental variables:
+#
+# BUILD_DIR
+
+.PHONY: prepare
+
+all: pkgconfig_consumer pkgconfig_testing_consumer
+
+pkgconfig_consumer: pkgconfig_consumer.cc prepare
+ $(CXX) $< `pkg-config seastar --cflags --libs --static` -o $(BUILD_DIR)/$@
+
+pkgconfig_testing_consumer: pkgconfig_testing_consumer.cc prepare
+ $(CXX) $< `pkg-config seastar seastar-testing --cflags --libs --static` -o $(BUILD_DIR)/$@
+
+prepare:
+ mkdir -p $(BUILD_DIR)
diff --git a/src/seastar/tests/dist/consumer/cmake_consumer.cc b/src/seastar/tests/dist/consumer/cmake_consumer.cc
new file mode 100644
index 00000000..ebdc060d
--- /dev/null
+++ b/src/seastar/tests/dist/consumer/cmake_consumer.cc
@@ -0,0 +1,15 @@
+#include <iostream>
+
+#include <seastar/core/app-template.hh>
+#include <seastar/core/future.hh>
+
+namespace sr = seastar;
+
+int main(int argc, char** argv) {
+ sr::app_template app;
+
+ return app.run(argc, argv, [] {
+ std::cout << "\"Hello\" from the Seastar CMake consumer!\n";
+ return sr::make_ready_future<>();
+ });
+}
diff --git a/src/seastar/tests/dist/consumer/cmake_testing_consumer.cc b/src/seastar/tests/dist/consumer/cmake_testing_consumer.cc
new file mode 100644
index 00000000..a2dc6656
--- /dev/null
+++ b/src/seastar/tests/dist/consumer/cmake_testing_consumer.cc
@@ -0,0 +1,13 @@
+#include <iostream>
+
+#include <seastar/core/future.hh>
+#include <seastar/testing/test_case.hh>
+
+namespace sr = seastar;
+
+SEASTAR_TEST_CASE(greeting) {
+ return sr::make_ready_future<>().then([] {
+ BOOST_REQUIRE(true);
+ std::cout << "\"Hello\" from the Seastar CMake testing consumer!\n";
+ });
+}
diff --git a/src/seastar/tests/dist/consumer/pkgconfig_consumer.cc b/src/seastar/tests/dist/consumer/pkgconfig_consumer.cc
new file mode 100644
index 00000000..a0cce755
--- /dev/null
+++ b/src/seastar/tests/dist/consumer/pkgconfig_consumer.cc
@@ -0,0 +1,15 @@
+#include <iostream>
+
+#include <seastar/core/app-template.hh>
+#include <seastar/core/future.hh>
+
+namespace sr = seastar;
+
+int main(int argc, char** argv) {
+ sr::app_template app;
+
+ return app.run(argc, argv, [] {
+ std::cout << "\"Hello\" from the Seastar pkg-config consumer!\n";
+ return sr::make_ready_future<>();
+ });
+}
diff --git a/src/seastar/tests/dist/consumer/pkgconfig_testing_consumer.cc b/src/seastar/tests/dist/consumer/pkgconfig_testing_consumer.cc
new file mode 100644
index 00000000..f3948a31
--- /dev/null
+++ b/src/seastar/tests/dist/consumer/pkgconfig_testing_consumer.cc
@@ -0,0 +1,15 @@
+#define SEASTAR_TESTING_MAIN
+
+#include <iostream>
+
+#include <seastar/core/future.hh>
+#include <seastar/testing/test_case.hh>
+
+namespace sr = seastar;
+
+SEASTAR_TEST_CASE(greeting) {
+ return sr::make_ready_future<>().then([] {
+ BOOST_REQUIRE(true);
+ std::cout << "\"Hello\" from the Seastar pkg-config testing consumer!\n";
+ });
+}
diff --git a/src/seastar/tests/dist/consumer/recipe/test_dist.cmake b/src/seastar/tests/dist/consumer/recipe/test_dist.cmake
new file mode 100644
index 00000000..9ebf5967
--- /dev/null
+++ b/src/seastar/tests/dist/consumer/recipe/test_dist.cmake
@@ -0,0 +1,43 @@
+cmake_host_system_information (
+ RESULT build_concurrency_factor
+ QUERY NUMBER_OF_LOGICAL_CORES)
+
+set (make_command make -j ${build_concurrency_factor})
+
+cooking_ingredient (Boost
+ EXTERNAL_PROJECT_ARGS
+ # The 1.67.0 release has a bug in Boost Lockfree around a missing header.
+ URL https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.gz
+ URL_MD5 319c6ffbbeccc366f14bb68767a6db79
+ PATCH_COMMAND
+ ./bootstrap.sh
+ --prefix=<INSTALL_DIR>
+ --with-libraries=atomic,chrono,date_time,filesystem,program_options,system,test,thread
+ CONFIGURE_COMMAND <DISABLE>
+ BUILD_COMMAND <DISABLE>
+ INSTALL_COMMAND
+ ${CMAKE_COMMAND} -E chdir <SOURCE_DIR>
+ ./b2
+ -j ${build_concurrency_factor}
+ --layout=system
+ --build-dir=<BINARY_DIR>
+ install
+ variant=debug
+ link=shared
+ threading=multi
+ hardcode-dll-paths=true
+ dll-path=<INSTALL_DIR>/lib)
+
+cooking_ingredient (Seastar
+ REQUIRES Boost
+ COOKING_RECIPE dev
+ COOKING_CMAKE_ARGS
+ # Not `lib64`.
+ -DCMAKE_INSTALL_LIBDIR=lib
+ -DSeastar_APPS=OFF
+ -DSeastar_DOCS=OFF
+ -DSeastar_DEMOS=OFF
+ -DSeastar_DPDK=ON
+ -DSeastar_TESTING=OFF
+ EXTERNAL_PROJECT_ARGS
+ SOURCE_DIR $ENV{SEASTAR_SOURCE_DIR})
diff --git a/src/seastar/tests/dist/consumer_test.sh b/src/seastar/tests/dist/consumer_test.sh
new file mode 100755
index 00000000..bf23ccb8
--- /dev/null
+++ b/src/seastar/tests/dist/consumer_test.sh
@@ -0,0 +1,61 @@
+#
+# This file is open source software, licensed to you under the terms
+# of the Apache License, Version 2.0 (the "License"). See the NOTICE file
+# distributed with this work for additional information regarding copyright
+# ownership. 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.
+#
+
+#
+# Copyright (C) 2018 Scylladb, Ltd.
+#
+
+# This test expects the following environmental variables to be defined:
+#
+# CONSUMER_SOURCE_DIR
+# SEASTAR_SOURCE_DIR
+#
+
+set -e
+
+cd "${CONSUMER_SOURCE_DIR}"
+./cooking.sh -r test_dist -t Release
+
+#
+# Consume from CMake.
+#
+
+cmake --build build
+build/cmake_consumer
+build/cmake_testing_consumer
+
+ingredients_dir="build/_cooking/installed"
+library_path="${ingredients_dir}"/lib
+
+#
+# Consume Seastar from its build directory with pkg-config.
+#
+
+pkg_config_path="build/_cooking/ingredient/Seastar/build"
+make BUILD_DIR=build-no-inst PKG_CONFIG_PATH="${pkg_config_path}"
+LD_LIBRARY_PATH="${library_path}" build-no-inst/pkgconfig_consumer
+LD_LIBRARY_PATH="${library_path}" build-no-inst/pkgconfig_testing_consumer
+
+#
+# Consume Seastar installed to the file-system, with pkg-config.
+#
+
+pkg_config_path="${library_path}"/pkgconfig
+make BUILD_DIR=build PKG_CONFIG_PATH="${pkg_config_path}"
+LD_LIBRARY_PATH="${library_path}" build/pkgconfig_consumer
+LD_LIBRARY_PATH="${library_path}" build/pkgconfig_testing_consumer