Skip to content
Closed
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
13 changes: 9 additions & 4 deletions .github/actions/init-ut-make-config/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,20 @@ runs:
shell: bash
- run: |
sudo git clone https://github.com/gperftools/gperftools.git
cd gperftools && sudo git checkout tags/gperftools-2.16 && sudo mkdir -p /gperftools
sudo ./autogen.sh && sudo CC=clang-12 CXX=clang++-12 ./configure --prefix=/gperftools --enable-frame-pointers
cd gperftools && sudo git checkout tags/gperftools-2.16
sudo ./autogen.sh && sudo CC=clang-12 CXX=clang++-12 ./configure --prefix=/usr --enable-frame-pointers
sudo make -j ${{env.proc_num}} && sudo make install
shell: bash
- run: |
sudo git clone https://github.com/abseil/abseil-cpp.git
cd abseil-cpp && sudo git checkout lts_2022_06_23 && sudo mkdir -p /abseil-cpp
sudo CC=clang-12 CXX=clang++-12 cmake -DBUILD_TESTING=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=/abseil-cpp -DCMAKE_POLICY_VERSION_MINIMUM=3.5 .
sudo CC=clang-12 CXX=clang++-12 cmake -DBUILD_TESTING=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_POLICY_VERSION_MINIMUM=3.5 .
sudo make -j ${{env.proc_num}} && sudo sudo make install
shell: bash
- run: sh config_brpc.sh --headers="/libunwind/include /gperftools/include /abseil-cpp/include /usr/include" --libs="/libunwind/lib /gperftools/lib /abseil-cpp/lib /usr/lib /usr/lib64" --cc=clang-12 --cxx=clang++-12 ${{inputs.options}} && cat config.mk
- run: |
wget https://archive.apache.org/dist/thrift/0.11.0/thrift-0.11.0.tar.gz && tar -xf thrift-0.11.0.tar.gz && cd thrift-0.11.0/
./configure --prefix=/usr --with-rs=no --with-ruby=no --with-python=no --with-java=no --with-go=no --with-perl=no --with-php=no --with-csharp=no --with-erlang=no --with-lua=no --with-nodejs=no --with-haskell=no --with-dotnetcore=no CXXFLAGS="-Wno-unused-variable"
make -j ${{env.proc_num}} && sudo make install
shell: bash
- run: sh config_brpc.sh --headers="/libunwind/include /usr/include" --libs="/libunwind/lib /usr/lib /usr/lib64" --cc=clang-12 --cxx=clang++-12 ${{inputs.options}} && cat config.mk
shell: bash
221 changes: 18 additions & 203 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,189 +15,31 @@ env:

# https://github.com/actions/runner-images
jobs:
compile-with-make:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/install-all-dependencies

- name: gcc with default options
uses: ./.github/actions/compile-with-make
with:
options: --headers=/usr/include --libs=/usr/lib /usr/lib64 --cc=gcc --cxx=g++ --werror

- name: gcc with all options
uses: ./.github/actions/compile-with-make
with:
options: --headers=/usr/include --libs=/usr/lib /usr/lib64 --cc=gcc --cxx=g++ --werror --with-thrift --with-glog --with-rdma --with-debug-bthread-sche-safety --with-debug-lock --with-bthread-tracer --with-asan

- name: clang with default options
uses: ./.github/actions/compile-with-make
with:
options: --headers=/usr/include --libs=/usr/lib /usr/lib64 --cc=clang --cxx=clang++ --werror

- name: clang with all options
uses: ./.github/actions/compile-with-make
with:
options: --headers=/usr/include --libs=/usr/lib /usr/lib64 --cc=clang --cxx=clang++ --werror --with-thrift --with-glog --with-rdma --with-debug-bthread-sche-safety --with-debug-lock --with-bthread-tracer --with-asan

compile-with-cmake:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/install-all-dependencies

- name: gcc with default options
run: |
export CC=gcc && export CXX=g++
mkdir gcc_build && cd gcc_build && cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 ..
make -j ${{env.proc_num}} && make clean

- name: gcc with all options
run: |
export CC=gcc && export CXX=g++
mkdir gcc_build_all && cd gcc_build_all
cmake -DWITH_MESALINK=OFF -DWITH_GLOG=ON -DWITH_THRIFT=ON -DWITH_RDMA=ON -DWITH_DEBUG_BTHREAD_SCHE_SAFETY=ON -DWITH_DEBUG_LOCK=ON -DWITH_BTHREAD_TRACER=ON -DWITH_ASAN=ON -DCMAKE_POLICY_VERSION_MINIMUM=3.5 ..
make -j ${{env.proc_num}} && make clean

- name: clang with default options
run: |
export CC=clang && export CXX=clang++
mkdir clang_build && cd clang_build && cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 ..
make -j ${{env.proc_num}} && make clean

- name: clang with all options
run: |
export CC=clang && export CXX=clang++
mkdir clang_build_all && cd clang_build_all
cmake -DWITH_MESALINK=OFF -DWITH_GLOG=ON -DWITH_THRIFT=ON -DWITH_RDMA=ON -DWITH_DEBUG_BTHREAD_SCHE_SAFETY=ON -DWITH_DEBUG_LOCK=ON -DWITH_BTHREAD_TRACER=ON -DWITH_ASAN=ON -DCMAKE_POLICY_VERSION_MINIMUM=3.5 ..
make -j ${{env.proc_num}} && make clean

gcc-compile-with-make-protobuf:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/install-essential-dependencies

- name: protobuf 3.5.1
uses: ./.github/actions/compile-with-make-protobuf
with:
protobuf-version: 3.5.1
protobuf-cpp-version: 3.5.1
protobuf-install-dir: /protobuf-3.5.1
config-brpc-options: --cc=gcc --cxx=g++ --werror

- name: protobuf 3.12.4
uses: ./.github/actions/compile-with-make-protobuf
with:
protobuf-version: 3.12.4
protobuf-cpp-version: 3.12.4
protobuf-install-dir: /protobuf-3.12.4
config-brpc-options: --cc=gcc --cxx=g++ --werror

- name: protobuf 21.12
uses: ./.github/actions/compile-with-make-protobuf
with:
protobuf-version: 21.12
protobuf-cpp-version: 3.21.12
protobuf-install-dir: /protobuf-3.21.12
config-brpc-options: --cc=gcc --cxx=g++ --werror

gcc-compile-with-bazel:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- run: bazel build --verbose_failures -- //... -//example/...

gcc-compile-with-boringssl:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- run: bazel build --verbose_failures --define with_mesalink=false --define with_glog=true --define with_thrift=true --define BRPC_WITH_BORINGSSL=true -- //... -//example/...

gcc-compile-with-bazel-all-options:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- run: |
bazel build --verbose_failures \
--define with_mesalink=false \
--define with_glog=true \
--define with_thrift=true \
--define with_debug_bthread_sche_safety=true \
--define with_debug_lock=true \
--define with_asan=true \
--define with_bthread_tracer=true \
--define BRPC_WITH_NO_PTHREAD_MUTEX_HOOK=true \
-- //... -//example/...

clang-compile-with-make-protobuf:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/install-essential-dependencies

- name: protobuf 3.5.1
uses: ./.github/actions/compile-with-make-protobuf
with:
protobuf-version: 3.5.1
protobuf-cpp-version: 3.5.1
protobuf-install-dir: /protobuf-3.5.1
config-brpc-options: --cc=clang --cxx=clang++ --werror

- name: protobuf 3.12.4
uses: ./.github/actions/compile-with-make-protobuf
with:
protobuf-version: 3.12.4
protobuf-cpp-version: 3.12.4
protobuf-install-dir: /protobuf-3.12.4
config-brpc-options: --cc=clang --cxx=clang++ --werror

- name: protobuf 21.12
uses: ./.github/actions/compile-with-make-protobuf
with:
protobuf-version: 21.12
protobuf-cpp-version: 3.21.12
protobuf-install-dir: /protobuf-3.21.12
config-brpc-options: --cc=clang --cxx=clang++ --werror

clang-compile-with-bazel:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- run: bazel build --verbose_failures --action_env=CC=clang -- //... -//example/...

clang-compile-with-boringssl:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- run: bazel build --verbose_failures --action_env=CC=clang --define with_mesalink=false --define with_glog=true --define with_thrift=true --define BRPC_WITH_BORINGSSL=true -- //... -//example/...

clang-compile-with-bazel-all-options:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- run: |
bazel build --verbose_failures \
--action_env=CC=clang \
--define with_mesalink=false \
--define with_glog=true \
--define with_thrift=true \
--define with_debug_bthread_sche_safety=true \
--define with_debug_lock=true \
--define with_asan=true \
--define with_bthread_tracer=true \
--define BRPC_WITH_NO_PTHREAD_MUTEX_HOOK=true \
-- //... -//example/...

clang-unittest:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/install-essential-dependencies
- uses: ./.github/actions/init-ut-make-config
with:
options: --with-bthread-tracer
options: --with-bthread-tracer --with-thrift
- name: Setup Soft-RoCE
run: |
KERNEL_VERSION=$(uname -r | cut -d '-' -f 1)
KERNEL_NAME="linux-${KERNEL_VERSION%'.0'}"
DOWNLOAD_LINK="https://cdn.kernel.org/pub/linux/kernel/v${KERNEL_VERSION%%.*}.x/${KERNEL_NAME}.tar.xz"
ETHERNET_CARD=$(ip link | awk -F ": " '$0 !~ "lo|vir|wl|^[^0-9]"{print $2;getline}' | head -1)
echo "kernel version is ${KERNEL_VERSION}, download link is ${DOWNLOAD_LINK}, ethernet card is ${ETHERNET_CARD}"
wget -q $DOWNLOAD_LINK -O /tmp/$KERNEL_NAME.tar.xz
tar xf /tmp/$KERNEL_NAME.tar.xz --directory=/tmp
RXE_PATH="/tmp/$KERNEL_NAME/drivers/infiniband/sw/rxe"
sed 's/$(CONFIG_RDMA_RXE)/m/g' $RXE_PATH/Makefile > $RXE_PATH/Kbuild
make -C /lib/modules/$(uname -r)/build M=$RXE_PATH modules -j
sudo modprobe ib_core
sudo modprobe rdma_ucm
sudo insmod $RXE_PATH/rdma_rxe.ko
sudo rdma link add rxe_0 type rxe netdev $ETHERNET_CARD
rdma link
- name: compile tests
run: |
cat config.mk
Expand All @@ -207,30 +49,3 @@ jobs:
run: |
cd test
sh ./run_tests.sh

clang-unittest-asan:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/install-essential-dependencies
- uses: ./.github/actions/init-ut-make-config
with:
options: --with-bthread-tracer --with-asan
- name: compile tests
run: |
cat config.mk
cd test
make NEED_GPERFTOOLS=0 -j ${{env.proc_num}}
- name: run tests
run: |
cd test
sh ./run_tests.sh

bazel-bvar-unittest:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- run: bazel test --verbose_failures //test:bvar_test
- run: bazel test --verbose_failures --define with_babylon_counter=true //test:bvar_test
- run: bazel test --verbose_failures --action_env=CC=clang //test:bvar_test
- run: bazel test --verbose_failures --action_env=CC=clang --define with_babylon_counter=true //test:bvar_test
66 changes: 0 additions & 66 deletions .github/workflows/ci-macos.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*.rej
/output
/test/output
/test/gen-cpp
build/

# Ignore hidden files
Expand Down
4 changes: 2 additions & 2 deletions config_brpc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ append_linking $GFLAGS_LIB gflags

PROTOBUF_LIB=$(find_dir_of_lib_or_die protobuf)
append_linking $PROTOBUF_LIB protobuf
PROTOC=$(find_bin_or_die protoc)

LEVELDB_LIB=$(find_dir_of_lib_or_die leveldb)
# required by leveldb
Expand Down Expand Up @@ -260,8 +261,6 @@ else
DYNAMIC_LINKINGS="$DYNAMIC_LINKINGS -lleveldb"
fi

PROTOC=$(find_bin_or_die protoc)

GFLAGS_HDR=$(find_dir_of_header_or_die gflags/gflags.h)

PROTOBUF_HDR=$(find_dir_of_header_or_die google/protobuf/message.h)
Expand Down Expand Up @@ -460,6 +459,7 @@ if [ "$SYSTEM" = "Darwin" ]; then
fi

if [ $WITH_THRIFT != 0 ]; then
append_to_output "THRIFT=$(find_bin_or_die protoc)"
THRIFT_LIB=$(find_dir_of_lib_or_die thriftnb)
THRIFT_HDR=$(find_dir_of_header_or_die thrift/Thrift.h)
append_to_output_libs "$THRIFT_LIB"
Expand Down
2 changes: 1 addition & 1 deletion src/butil/thread_key.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class ThreadLocal {
void replace(T* old_ptr, T* new_ptr) {
BAIDU_SCOPED_LOCK(mutex);
auto it = std::find(ptrs.begin(), ptrs.end(), old_ptr);
CHECK_NE(it, ptrs.end());
CHECK(it != ptrs.end());
*it = new_ptr;
}

Expand Down
Loading