diff options
author | Alexey Dokuchaev <danfe@FreeBSD.org> | 2021-07-04 06:06:12 +0000 |
---|---|---|
committer | Alexey Dokuchaev <danfe@FreeBSD.org> | 2021-07-04 06:14:48 +0000 |
commit | 0fdebe53bacfd18a9d61e87388b967f3c3b2ee9c (patch) | |
tree | a315a108fdeaf10977708e7ef6caad52a6447cce /benchmarks/apib | |
parent | devel/libvirt-dbus: 1.4.1 (diff) |
benchmarks/apib: the port had been updated (+)
- Belatedly update to version 1.2.1 and sync port description
- Builds with CMake now and uses modern libraries instead of the
Apache Portable Runtime (devel/apr1)
- While upstream asks for C++11, force C++17 because that's how
Abseil C++ libraries are currently built, otherwise it won't
link due to ABI incompatibilities
- Hook two provided tests to our framework (USES+=cmake:testing)
Diffstat (limited to 'benchmarks/apib')
-rw-r--r-- | benchmarks/apib/Makefile | 27 | ||||
-rw-r--r-- | benchmarks/apib/distinfo | 6 | ||||
-rw-r--r-- | benchmarks/apib/files/patch-CMakeLists.txt | 30 | ||||
-rw-r--r-- | benchmarks/apib/files/patch-apib_CMakeLists.txt | 28 | ||||
-rw-r--r-- | benchmarks/apib/files/patch-src_apib__cpu.c | 103 | ||||
-rw-r--r-- | benchmarks/apib/files/patch-test_CMakeLists.txt | 39 | ||||
-rw-r--r-- | benchmarks/apib/pkg-descr | 9 |
7 files changed, 114 insertions, 128 deletions
diff --git a/benchmarks/apib/Makefile b/benchmarks/apib/Makefile index 7b0406b680d8..70d0ff6ac48b 100644 --- a/benchmarks/apib/Makefile +++ b/benchmarks/apib/Makefile @@ -1,8 +1,9 @@ # Created by: Alexey Dokuchaev <danfe@FreeBSD.org> PORTNAME= apib -PORTVERSION= 1.0 -PORTREVISION= 3 +DISTVERSIONPREFIX= ${PORTNAME:tu}_ +DISTVERSION= 1_2_1 +DISTVERSIONSUFFIX= _RC1 CATEGORIES= benchmarks www MAINTAINER= danfe@FreeBSD.org @@ -10,29 +11,21 @@ COMMENT= Simple and fast HTTP performance testing tool LICENSE= APACHE20 -LIB_DEPENDS= libapr-1.so:devel/apr1 +LIB_DEPENDS= libabsl_base.so:devel/abseil \ + libev.so:devel/libev \ + libgtest.so:devel/googletest \ + libhttp_parser.so:www/http-parser +USES= cmake:testing compiler:c++17-lang localbase:ldflags ssl USE_GITHUB= yes GH_ACCOUNT= apigee -GH_TAGNAME= 7e8dea9 -USES= localbase ssl -GNU_CONFIGURE= yes -CONFIGURE_ENV= APR_LOC="${LOCALBASE}/include/apr-1" - -PLIST_FILES= bin/apib bin/apibmon +PLIST_FILES= bin/apib bin/apibmon bin/testserver PORTEXAMPLES= env.sh pivot run.sh rungroup.sh tojson OPTIONS_DEFINE= EXAMPLES -post-patch: - @${REINPLACE_CMD} -e 's, LIBS="-lssl,& -lcrypto,' ${WRKSRC}/configure - -do-install: - ${INSTALL_PROGRAM} ${WRKSRC}/apib ${WRKSRC}/apibmon \ - ${STAGEDIR}${PREFIX}/bin - -do-install-EXAMPLES-on: +post-install-EXAMPLES-on: @${MKDIR} ${STAGEDIR}${EXAMPLESDIR} ${INSTALL_DATA} ${WRKSRC}/samplescripts/* ${STAGEDIR}${EXAMPLESDIR} diff --git a/benchmarks/apib/distinfo b/benchmarks/apib/distinfo index 2bce046108c2..e3f9eeb222c2 100644 --- a/benchmarks/apib/distinfo +++ b/benchmarks/apib/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1503959917 -SHA256 (apigee-apib-1.0-7e8dea9_GH0.tar.gz) = d54d3abef0123071d349aff47b6bf7477ad45056c876a704e6693c894da3611e -SIZE (apigee-apib-1.0-7e8dea9_GH0.tar.gz) = 77363 +TIMESTAMP = 1586927181 +SHA256 (apigee-apib-APIB_1_2_1_RC1_GH0.tar.gz) = 7f890b766cab013bf12189f1f9fc73611b3fc3f4d051d60a2e5932d46e118cc0 +SIZE (apigee-apib-APIB_1_2_1_RC1_GH0.tar.gz) = 65136 diff --git a/benchmarks/apib/files/patch-CMakeLists.txt b/benchmarks/apib/files/patch-CMakeLists.txt new file mode 100644 index 000000000000..05c23a408d2b --- /dev/null +++ b/benchmarks/apib/files/patch-CMakeLists.txt @@ -0,0 +1,30 @@ +--- CMakeLists.txt.orig 2020-04-15 05:06:21 UTC ++++ CMakeLists.txt +@@ -1,25 +1,13 @@ + cmake_minimum_required(VERSION 3.13) + project(Forest) +-include(ExternalProject) ++#include(ExternalProject) + enable_testing() + +-set(CMAKE_CXX_STANDARD 11) ++set(CMAKE_CXX_STANDARD 17) + set(CMAKE_CXX_FLAGS -Wall) + +-ExternalProject_Add( +- gtest +- PREFIX gtest +- URL https://github.com/google/googletest/archive/release-1.10.0.tar.gz +- URL_HASH SHA256=9dc9157a9a1551ec7a7e43daea9a694a0bb5fb8bec81235d8a1e6ef64c716dcb +- INSTALL_COMMAND "" +-) +- + include_directories( + ${CMAKE_SOURCE_DIR} +- ${CMAKE_BINARY_DIR}/gtest/src/gtest/googletest/include +-) +-link_directories( +- ${CMAKE_BINARY_DIR}/gtest/src/gtest-build/lib + ) + + if (DEFINED ENV{OPENSSL_INCLUDE_DIR}) diff --git a/benchmarks/apib/files/patch-apib_CMakeLists.txt b/benchmarks/apib/files/patch-apib_CMakeLists.txt new file mode 100644 index 000000000000..f8e05af2aec7 --- /dev/null +++ b/benchmarks/apib/files/patch-apib_CMakeLists.txt @@ -0,0 +1,28 @@ +--- apib/CMakeLists.txt.orig 2020-04-15 05:06:21 UTC ++++ apib/CMakeLists.txt +@@ -22,7 +22,7 @@ target_link_libraries(common PUBLIC -lhttp_parser + + add_library( + cpu OBJECT +- apib_cpu_generic.cc ++ apib_cpu_bsd.cc + ) + target_link_libraries(cpu PUBLIC common) + +@@ -44,7 +44,7 @@ add_library( + socket.h + tlssocket.h + ) +-target_link_libraries(io PUBLIC common base64 -lev -lssl.1.1 -lcrypto.1.1) ++target_link_libraries(io PUBLIC common base64 -lev -lpthread -lssl -lcrypto) + + add_library( + mon_lib OBJECT +@@ -65,3 +65,7 @@ add_executable( + ) + target_link_libraries(apibmon mon_lib io cpu common base64) + ++install(TARGETS ++ apib apibmon ++ DESTINATION bin ++) diff --git a/benchmarks/apib/files/patch-src_apib__cpu.c b/benchmarks/apib/files/patch-src_apib__cpu.c deleted file mode 100644 index f0af2c4f6940..000000000000 --- a/benchmarks/apib/files/patch-src_apib__cpu.c +++ /dev/null @@ -1,103 +0,0 @@ ---- src/apib_cpu.c.orig 2017-08-28 22:38:37 UTC -+++ src/apib_cpu.c -@@ -14,6 +14,11 @@ - limitations under the License. - */ - -+#ifdef __FreeBSD__ -+#include <sys/types.h> -+#include <sys/sysctl.h> -+#include <sys/times.h> -+#endif - #include <stdio.h> - #include <stdlib.h> - #include <string.h> -@@ -35,6 +40,9 @@ static double TicksPerSecond; - * for hyperthreading, etc. */ - int cpu_Count(apr_pool_t* pool) - { -+#ifdef _SC_NPROCESSORS_ONLN -+ return (int)sysconf(_SC_NPROCESSORS_ONLN); -+#else - apr_status_t s; - apr_file_t* f; - char buf[PROC_BUF_LEN]; -@@ -66,10 +74,20 @@ int cpu_Count(apr_pool_t* pool) - count = 1; - } - return count; -+#endif - } - - static int getTicks(CPUUsage* cpu, apr_pool_t* pool) - { -+#ifdef __FreeBSD__ -+ struct tms ticks; -+ -+ cpu->idle = times(&ticks); -+ if (cpu->idle == -1) -+ return 0; -+ cpu->nonIdle = ticks.tms_utime + ticks.tms_stime; -+ return 1; -+#else - apr_status_t s; - apr_file_t* proc; - char buf[PROC_BUF_LEN]; -@@ -118,10 +136,12 @@ static int getTicks(CPUUsage* cpu, apr_pool_t* pool) - } - - return 0; -+#endif - } - - double cpu_GetMemoryUsage(apr_pool_t* pool) - { -+#ifdef __linux__ - apr_status_t s; - apr_file_t* proc; - char buf[PROC_BUF_LEN]; -@@ -138,12 +158,36 @@ double cpu_GetMemoryUsage(apr_pool_t* pool) - if (s != APR_SUCCESS) { - return 0.0; - } -+#endif - - long totalMem = 0; - long freeMem = 0; - long buffers = 0; - long cache = 0; - -+#ifdef __FreeBSD__ -+ /* We work with kilobytes to match Linux' /proc/meminfo. */ -+ long pagesize = sysconf(_SC_PAGESIZE) / 1024; -+ totalMem = sysconf(_SC_PHYS_PAGES) * pagesize; -+ -+ size_t len; -+ -+ unsigned free; -+ len = sizeof(free); -+ sysctlbyname("vm.stats.vm.v_free_count", &free, &len, NULL, 0); -+ freeMem = free * pagesize; -+ -+ /* `buffers' is of expected type (long), no need for another variable. */ -+ len = sizeof(buffers); -+ sysctlbyname("vfs.bufspace", &buffers, &len, NULL, 0); -+ buffers /= 1024; -+ -+ /* `cache' is based on number of inactive pages since r309017. */ -+ unsigned inact; -+ len = sizeof(inact); -+ sysctlbyname("vm.stats.vm.v_inactive_count", &inact, &len, NULL, 0); -+ cache = inact * pagesize; -+#else - while (linep_NextLine(&line)) { - char* n = linep_NextToken(&line, " "); - char* v = linep_NextToken(&line, " "); -@@ -158,6 +202,7 @@ double cpu_GetMemoryUsage(apr_pool_t* pool) - cache = atol(v); - } - } -+#endif - - if ((totalMem <= 0) || (freeMem <= 0)) { - return 0.0; diff --git a/benchmarks/apib/files/patch-test_CMakeLists.txt b/benchmarks/apib/files/patch-test_CMakeLists.txt new file mode 100644 index 000000000000..89b3653c9a15 --- /dev/null +++ b/benchmarks/apib/files/patch-test_CMakeLists.txt @@ -0,0 +1,39 @@ +--- test/CMakeLists.txt.orig 2020-04-15 05:06:21 UTC ++++ test/CMakeLists.txt +@@ -3,14 +3,14 @@ add_library( + test_server.cc + test_server.h + ) +-target_link_libraries(testserver_lib PUBLIC common -lev -lssl.1.1 -lcrypto.1.1 -lhttp_parser) ++target_link_libraries(testserver_lib PUBLIC common -lev -lpthread -lssl -lcrypto -lhttp_parser) + + add_library( + keygen_lib OBJECT + test_keygen.cc + test_keygen.h + ) +-target_link_libraries(keygen_lib PUBLIC common -lssl.1.1 -lcrypto.1.1) ++target_link_libraries(keygen_lib PUBLIC common -lssl -lcrypto) + + add_executable( + testserver +@@ -22,7 +22,6 @@ add_executable( + iotest + io_test.cc + ) +-add_dependencies(iotest gtest) + target_link_libraries(iotest testserver_lib io cpu common base64 -lgtest) + add_test(iotest iotest) + +@@ -30,6 +29,10 @@ add_executable( + tlstest + tls_test.cc + ) +-add_dependencies(tlstest gtest) + target_link_libraries(tlstest testserver_lib io cpu common keygen_lib base64 -lgtest) + add_test(tlstest tlstest) ++ ++install(TARGETS ++ testserver ++ DESTINATION bin ++) diff --git a/benchmarks/apib/pkg-descr b/benchmarks/apib/pkg-descr index 1f49364a897b..a58722cf41da 100644 --- a/benchmarks/apib/pkg-descr +++ b/benchmarks/apib/pkg-descr @@ -1,8 +1,6 @@ -apib is a tool that makes it easy to test API servers. It is supported -on Unix systems that include the Apache Portable Runtime and OpenSSL. - -apib has most of the features of Apache Bench (ab), but is also intended -to be a more modern replacement. In particular, it offers: +apib is a tool that makes it easy to run performance tests of HTTP API +servers. It has most of the features of Apache Bench (ab), but is also +intended as a more modern replacement. In particular, it offers: - Proper HTTP 1.1 support including keep-alives and chunked encoding - Ability to spawn multiple I/O threads to take advantage of multiple @@ -12,5 +10,6 @@ to be a more modern replacement. In particular, it offers: - Support for OAuth 1.0 signatures - Ability to output results to a file so they may be automated - Remote CPU monitoring + - Simple command-line interface WWW: https://github.com/apigee/apib |