diff --git a/.github/workflows/mac-os.yml b/.github/workflows/mac-os.yml index 718ac99e..0d8cdd43 100644 --- a/.github/workflows/mac-os.yml +++ b/.github/workflows/mac-os.yml @@ -3,6 +3,8 @@ name: mac-os-ci on: push: branches: [ master ] + pull_request: + branches: [ master ] workflow_dispatch: concurrency: @@ -15,34 +17,29 @@ env: jobs: build-macos: - runs-on: macos-12 + runs-on: macos-13 timeout-minutes: 30 # ✨✨✨✨ steps: - uses: actions/checkout@v4 - run: | - brew uninstall --formula node kotlin harfbuzz sbt selenium-server imagemagick \ - gradle maven openjdk postgresql r ant mongodb-community@5.0 mongosh \ - node@18 php composer - - # Prevent updating these packages that sometimes break the update - brew pin azure-cli jpeg-xl aom lima pipx gcc - - brew update && brew install --force ninja boost openssl automake libtool + brew update && brew install ninja boost automake - name: Configure CMake run: | cmake --version - gcc-13 --version + gcc-12 --version uname -a cmake -B ${{github.workspace}}/build \ -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ -GNinja \ - -DCMAKE_C_COMPILER="gcc-13" \ - -DCMAKE_CXX_COMPILER="g++-13" + -DCMAKE_C_COMPILER=gcc-12 \ + -DCMAKE_CXX_COMPILER=g++-12 \ + -DCMAKE_CXX_FLAGS="-Wl,-ld_classic" # due to a linker bug on macos, see https://github.com/Homebrew/homebrew-core/issues/145991 + - name: Build & Test run: | cd ${{github.workspace}}/build - ninja gperf_project || cat third_party/src/gperf_project-stamp/gperf_project-patch-*.log - + ninja gperf_project || cat third_party/src/gperf_project-stamp/gperf_project-install-*.log + ninja cares_project || cat third_party/src/cares_project-stamp/cares_project-build-*.log ninja -k 5 base/all io/all strings/all util/all echo_server ping_iouring_server \ https_client_cli s3_demo ./fibers_test --logtostderr --gtest_repeat=10 diff --git a/cmake/third_party.cmake b/cmake/third_party.cmake index 346d3e99..4eed887a 100644 --- a/cmake/third_party.cmake +++ b/cmake/third_party.cmake @@ -27,6 +27,10 @@ file(MAKE_DIRECTORY ${THIRD_PARTY_LIB_DIR}) set(THIRD_PARTY_CXX_FLAGS "-std=c++14 -O3 -DNDEBUG -fPIC -fno-stack-protector \ -fno-stack-clash-protection") +if (APPLE) + set(THIRD_PARTY_CXX_FLAGS "${THIRD_PARTY_CXX_FLAGS} -Wl,-ld_classic") +endif() + find_package(Threads REQUIRED) function(add_third_party name) @@ -275,7 +279,10 @@ add_third_party( URL https://github.com/gperftools/gperftools/archive/gperftools-2.15.tar.gz # GIT_SHALLOW TRUE - PATCH_COMMAND autoreconf -i # update runs every time for some reason + # Remove building the unneeded programs (they fail on macos) + PATCH_COMMAND echo sed -i "/^noinst_PROGRAMS +=/d;/binary_trees binary_trees_shared/d" + /Makefile.am + COMMAND autoreconf -i # update runs every time for some reason # CMAKE_PASS_FLAGS "-DGPERFTOOLS_BUILD_HEAP_PROFILER=OFF -DGPERFTOOLS_BUILD_HEAP_CHECKER=OFF \ # -DGPERFTOOLS_BUILD_DEBUGALLOC=OFF -DBUILD_TESTING=OFF \ # -Dgperftools_build_benchmark=OFF" @@ -372,7 +379,7 @@ endif() add_third_party( cares - URL https://github.com/c-ares/c-ares/releases/download/cares-1_29_0/c-ares-1.29.0.tar.gz + URL https://codeload.github.com/c-ares/c-ares/tar.gz/refs/tags/v1.31.0 CMAKE_PASS_FLAGS "-DCARES_SHARED:BOOL=OFF -DCARES_STATIC:BOOL=ON -DCARES_STATIC_PIC:BOOL=ON \ -DCMAKE_INSTALL_LIBDIR=lib" ) diff --git a/util/accept_server_test.cc b/util/accept_server_test.cc index 22befde7..b093e473 100644 --- a/util/accept_server_test.cc +++ b/util/accept_server_test.cc @@ -267,7 +267,15 @@ TEST_F(AcceptServerTest, Migrate) { TEST_F(AcceptServerTest, Shutdown) { listener_->SetMaxClients(1 << 16); auto* proactor = client_sock_->proactor(); - proactor->Await([this, proactor] { + + + proactor->Await([proactor, this] { +#ifdef __linux__ + constexpr auto kHupMask = POLLHUP | POLLRDHUP; +#else + constexpr auto kHupMask = POLLHUP; +#endif + vector> socks; constexpr unsigned kNumSocks = 2000; unsigned called = 0; @@ -277,7 +285,10 @@ TEST_F(AcceptServerTest, Shutdown) { error_code ec = socks.back()->Connect(ep_); EXPECT_FALSE(ec); - socks.back()->RegisterOnErrorCb([&](int) { ++called; }); + socks.back()->RegisterOnErrorCb([&](int err) { + EXPECT_EQ(err, kHupMask); + ++called; + }); } for (unsigned i = 0; i < socks.size(); ++i) { @@ -290,7 +301,7 @@ TEST_F(AcceptServerTest, Shutdown) { // exchange FIN packets. With real world scenarios it's not guaranteed that Shutdown // will trigger POLLHUP delivery, because it depends on the other size sending FIN as well. // See https://man7.org/linux/man-pages/man2/poll.2.html for more details. - EXPECT_EQ(called, socks.size()); + EXPECT_GE(called, socks.size()); for (unsigned i = 0; i < socks.size(); ++i) { std::ignore = socks[i]->Close(); }