Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address thread-safety issues by removing backtrace logger #147

Merged
merged 3 commits into from
Oct 23, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Moving to ubuntu22 for clang-13
jayv committed Oct 22, 2024
commit 2872071892cfbdca7c318441d49010fc71353ea7
6 changes: 3 additions & 3 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ jobs:

name: [
ubuntu-22.04-gcc-12,
ubuntu-20.04-clang-13,
ubuntu-22.04-clang-13,
ubuntu-22.04-clang-14,
ubuntu-22.04-clang-15,
mac-os-latest
@@ -38,8 +38,8 @@ jobs:
compiler: gcc
version: "12"

- name: ubuntu-20.04-clang-13
os: ubuntu-20.04
- name: ubuntu-22.04-clang-13
os: ubuntu-22.04
compiler: clang
version: "13"

122 changes: 0 additions & 122 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,115 +1,3 @@
# We only run clang-13 on 20.04 (and whatever ships on its libc), the other compilers run on 22.04
# unfortunately we have to duplicate the postprocessing steps
FROM ubuntu:20.04 AS base-ubuntu20
ENV DEBIAN_FRONTEND noninteractive
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drop ubuntu 20

RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates wget gpg
RUN wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
RUN echo 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main' | tee -a /etc/apt/sources.list.d/llvm.list
RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2> /dev/null \
| gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
RUN echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ focal main' \
| tee /etc/apt/sources.list.d/kitware.list
RUN apt-get update && apt-get install -y --no-install-recommends \
sudo \
build-essential \
git \
gdb \
python3 \
python3-dev \
python3-pip \
python3-pybind11 \
python3-pybindgen \
pybind11-dev \
libc++-13-dev \
libc++abi-13-dev \
clang-13 \
clang-format-13 \
clang-tidy-13 \
lld-13 \
ninja-build \
cmake

# project root will be mounted at /usr/src/flexi_cfg
COPY <<EOF /usr/bin/cmake-setup
#!/bin/bash
cmake /usr/src/flexi_cfg -DCMAKE_BUILD_TYPE=Debug -DENABLE_CLANG_TIDY:BOOL=ON -DCFG_ENABLE_DEBUG:BOOL=ON -DCFG_ENABLE_PARSER_TRACE:BOOL=OFF -DCFG_EXAMPLES:BOOL=ON -DCFG_PYTHON_BINDINGS:BOOL=ON -G Ninja
EOF
RUN chmod +x /usr/bin/cmake-setup

WORKDIR /usr/src/flexi_cfg_build/_deps

ARG USERNAME=user
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# Create the user
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME

# compose mounts volumes as root
COPY <<EOF /usr/bin/entrypoint
#!/bin/bash
set -e
# Function to handle termination signal
term_handler() {
echo "Termination signal received. Cleaning up..."
# Insert cleanup commands here
exit 0
}
# Trap termination signals (SIGTERM, SIGINT)
trap 'term_handler' SIGTERM SIGINT

sudo chown -R ${USER_UID}:${USER_GID} /usr/src/flexi_cfg_build
echo "== Executing == \$@ =="
exec "\$@"
echo "== DONE =="
sleep 2
EOF
RUN chmod +x /usr/bin/entrypoint

COPY <<EOF /usr/bin/build-and-test
#!/bin/bash
set -e
# Function to handle termination signal
term_handler() {
echo "Termination signal received. Cleaning up..."
# Insert cleanup commands here
exit 0
}
# Trap termination signals (SIGTERM, SIGINT)
trap 'term_handler' SIGTERM SIGINT
cmake-setup && ninja all && ninja test
result="\$?"
echo -- BUILD DONE -- RESULT = \$result --
exit \$result
EOF
RUN chmod +x /usr/bin/build-and-test

COPY <<EOF /home/${USERNAME}/.bashrc
echo -e "======================================================================================="
echo -e "FlexiConfig interactive test environment:"
echo -e ""
echo -e "commands: cmake-setup # prepare cmake build"
echo -e " build-and-test # builds all targets, tidy, runs tests"
echo -e " ninja all # builds all targets, tidy"
echo -e " ctest <...> # runs tests"
echo -e " tests/utils_test # run any gtest directly"
echo -e " gdb tests/utils_test # run with gdb"
echo -e "======================================================================================="
EOF

USER ${USERNAME}
WORKDIR /usr/src/flexi_cfg_build

ENV PATH=${PATH}:/home/${USERNAME}/.local/bin
ENV TEST_DIR=env

ENTRYPOINT ["/usr/bin/entrypoint"]

# ----------------------------------------------------------------------------------------------------------------

FROM ubuntu:22.04 AS base
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates wget gpg
@@ -226,16 +114,6 @@ ENTRYPOINT ["/usr/bin/entrypoint"]

# ----------------------------------------------------------------------------------------------------------------

# 20.04 for clang-13
FROM base-ubuntu20 AS clang-13-ubuntu20
ENV CC=/usr/bin/clang-13
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kept clang-13 with ubuntu 22

ENV CXX=/usr/bin/clang++-13
# clang-13 libc++ for C++20 (e.g. <span>)
ENV CXXFLAGS="-stdlib=libc++ -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"
ENV LDFLAGS="-stdlib=libc++ -g -fuse-ld=/usr/bin/ld.lld-13"
ENV CLANG_TOOLS_PATH=/usr/lib/llvm-13
CMD ["/usr/bin/build-and-test"]

FROM base AS gcc-12
ENV CC=/usr/bin/gcc-12
ENV CXX=/usr/bin/g++-12
10 changes: 1 addition & 9 deletions compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# This helps running all the tests and checks from various compilers we support
#
# usage: docker compose up --build -d # checks all compilers
# usage: docker compose up --build --force-recreate -d # checks all compilers
# docker compose run --rm clang-14 bash -c "build-and-test;bash" # interactive
# docker compose logs -f gcc-12 # gcc-12 build logs
# docker compose run gcc-12 bash # shell into gcc-12 to run interactively
@@ -47,14 +47,6 @@ services:
target: clang-13
volumes: [ "${HOME}/.cache/flexi_cfg_build_deps/clang-13:/usr/src/flexi_cfg_build/_deps" ]

clang-13-ubuntu20:
extends:
service: base
container_name: clang-13-ubuntu20
build:
target: clang-13-ubuntu20
volumes: [ "${HOME}/.cache/flexi_cfg_build_deps/clang-13:/usr/src/flexi_cfg_build/_deps" ]

clang-14:
extends:
service: base