Skip to content

Commit ec5e3e3

Browse files
committed
test
1 parent a650c62 commit ec5e3e3

7 files changed

Lines changed: 18 additions & 6 deletions

File tree

.github/workflows/Dockerfile.buster

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ RUN apt-get update && \
1818
apt-get install -y --no-install-recommends \
1919
git cmake-data=3.18* cmake=3.18* make g++ gperf netcat \
2020
python3-minimal python3-dev libpython3-dev python3-jsonschema python3-setuptools python3-pip && \
21+
git clone https://github.com/kaniini/libucontext && cd libucontext && make FREESTANDING=yes ARCH=x86_64 && cp -R include/libucontext /usr/local/include && cp libucontext.a /usr/local/lib && cd .. && \
2122
pip3 install wheel && \
2223
apt-get install -y --no-install-recommends curl-kphp-vk kphp-timelib libuber-h3-dev libfmt-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \
2324
libzstd-dev libyaml-cpp-dev libnghttp2-dev zlib1g-dev php7.4-dev mysql-server libmysqlclient-dev libldap-dev libkrb5-dev \

.github/workflows/Dockerfile.focal

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ RUN apt-get update && \
1111
apt-get install -y --no-install-recommends \
1212
git cmake make clang g++ g++-10 gperf netcat \
1313
python3-minimal python3-dev libpython3-dev python3-jsonschema python3-setuptools python3-pip && \
14+
git clone https://github.com/kaniini/libucontext && cd libucontext && make FREESTANDING=yes ARCH=x86_64 && cp -R include/libucontext /usr/local/include && cp libucontext.a /usr/local/lib && cd .. && \
1415
pip3 install wheel && \
1516
apt-get install -y --no-install-recommends curl-kphp-vk kphp-timelib libuber-h3-dev libfmt-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \
1617
libzstd-dev libyaml-cpp-dev libnghttp2-dev zlib1g-dev php7.4-dev mysql-server libmysqlclient-dev libldap-dev libkrb5-dev \
1718
postgresql postgresql-server-dev-all libnuma-dev composer unzip && \
1819
pip3 install portalocker psutil requests-toolbelt pytest pytest-xdist pytest-mysql pytest-postgresql psycopg zstandard && \
1920
rm -rf /var/lib/apt/lists/*
2021

21-
ENV ASAN_OPTIONS=detect_leaks=0
22+
ENV ASAN_OPTIONS=detect_leaks=1
2223
ENV UBSAN_OPTIONS=print_stacktrace=1:allow_addr2line=1
2324

2425
RUN useradd -ms /bin/bash kitten

.github/workflows/Dockerfile.jammy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ RUN apt update && \
1313
apt install -y --no-install-recommends \
1414
git cmake make g++ lld gperf netcat \
1515
python3-minimal python3-dev libpython3-dev python3-jsonschema python3-setuptools python3-pip && \
16+
git clone https://github.com/kaniini/libucontext && cd libucontext && make ARCH=x86_64 && make FREESTANDING=yes ARCH=x86_64 && cp -R include/libucontext /usr/local/include && cp libucontext.a /usr/local/lib && cd .. && \
1617
pip3 install wheel && \
1718
apt install -y --no-install-recommends curl-kphp-vk kphp-timelib libuber-h3-dev libfmt-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \
1819
libzstd-dev libyaml-cpp-dev libnghttp2-dev zlib1g-dev php7.4-dev mysql-server libmysqlclient-dev libnuma-dev unzip \
@@ -32,7 +33,7 @@ RUN update-alternatives --install /usr/bin/ld ld /usr/bin/x86_64-linux-gnu-ld 10
3233
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
3334
php composer-setup.php --install-dir=/usr/bin --filename=composer --version=1.10.26
3435

35-
ENV ASAN_OPTIONS=detect_leaks=0
36+
ENV ASAN_OPTIONS=detect_leaks=1
3637
ENV UBSAN_OPTIONS=print_stacktrace=1:allow_addr2line=1
3738

3839
RUN useradd -ms /bin/bash kitten

cmake/init-compilation-flags.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ if(APPLE)
2727
else()
2828
message(FATAL_ERROR "unsupported arch: ${CMAKE_SYSTEM_PROCESSOR}")
2929
endif()
30+
else()
31+
add_compile_options(-l:ucontext)
32+
link_directories(/usr/local/lib)
33+
add_compile_options(-Wno-unused-command-line-argument)
3034
endif()
3135

3236
set(OPENSSL_USE_STATIC_LIBS TRUE)

compiler/compiler-settings.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,9 @@ void CompilerSettings::init() {
320320
ld_flags.value_ = extra_ld_flags.get();
321321
append_curl(cxx_default_flags, ld_flags.value_);
322322
append_apple_options(cxx_default_flags, ld_flags.value_);
323-
std::vector<vk::string_view> external_static_libs{"pcre", "re2", "yaml-cpp", "h3", "z", "zstd", "nghttp2", "kphp-timelib"};
323+
std::vector<vk::string_view> external_static_libs{"pcre", "re2", "yaml-cpp", "h3", "z", "zstd", "nghttp2", "kphp-timelib", "ucontext"};
324+
325+
ld_flags.value_ += " -L /usr/local/lib";
324326

325327
#ifdef KPHP_TIMELIB_LIB_DIR
326328
ld_flags.value_ += " -L" KPHP_TIMELIB_LIB_DIR;
@@ -331,7 +333,8 @@ void CompilerSettings::init() {
331333
ld_flags.value_ += " -L /usr/local/lib";
332334
#endif
333335

334-
#if defined(__APPLE__) && defined(__arm64__)
336+
#if defined(__APPLE__) && !defined(__arm64__)
337+
external_static_libs.pop_back();
335338
// for development under M1, manual installation of libucontext is needed
336339
// see the docs: https://vkcom.github.io/kphp/kphp-internals/developing-and-extending-kphp/compiling-kphp-from-sources.html
337340
ld_flags.value_ += " /opt/homebrew/lib/libucontext.a";

server/ucontext-portable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#pragma once
66

7-
#if !(defined(__APPLE__) && defined(__arm64__))
7+
#if defined(__APPLE__) && !defined(__arm64__)
88
// for x86 mac or x86/arm linux, we just use makecontext(), ucontext_t and other native functions
99
#include <ucontext.h>
1010

tests/tests.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ if(KPHP_TESTS)
33
set(TEST_NAME unittests-${TEST_NAME})
44
add_executable(${TEST_NAME} ${ARGN})
55
target_link_libraries(${TEST_NAME} PRIVATE GTest::GTest GTest::Main gmock ${SRC_LIBS} vk::popular_common)
6-
if(NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND APPLE)
6+
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND NOT APPLE)
7+
target_link_libraries(${TEST_NAME} PRIVATE /usr/local/lib/libucontext.a)
8+
elseif(NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
79
target_link_libraries(${TEST_NAME} PRIVATE /opt/homebrew/lib/libucontext.a)
810
endif()
911
target_link_options(${TEST_NAME} PRIVATE ${NO_PIE})

0 commit comments

Comments
 (0)