Skip to content

Commit

Permalink
chore: Fix tsan build on circleci.
Browse files Browse the repository at this point in the history
  • Loading branch information
iphydf committed Dec 11, 2024
1 parent 6460c25 commit 4af29cb
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 41 deletions.
59 changes: 25 additions & 34 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ workflows:
# - bazel-tsan
# Dynamic analysis with CMake
- asan
# - tsan
- tsan
- ubsan
# Static analysis
- clang-analyze
Expand Down Expand Up @@ -55,62 +55,53 @@ jobs:
//c-toxcore/auto_tests:lossless_packet_test

asan:
working_directory: ~/work
docker:
- image: ubuntu
machine: { image: ubuntu-2204:current }

steps:
- run: &apt_install
apt-get update &&
DEBIAN_FRONTEND=noninteractive
apt-get install -y
ca-certificates
clang
cmake
git
libbenchmark-dev
libconfig-dev
libgmock-dev
libgtest-dev
libopus-dev
libsodium-dev
libvpx-dev
llvm-dev
ninja-build
pkg-config
- checkout
- run: git submodule update --init --recursive
- run: CC=clang .circleci/cmake-asan
- run: other/docker/circleci/run asan

tsan:
working_directory: ~/work
docker:
- image: ubuntu
machine: { image: ubuntu-2204:current }

steps:
- run: *apt_install
- checkout
- run: git submodule update --init --recursive
- run: CC=clang .circleci/cmake-tsan
- run: other/docker/circleci/run tsan

ubsan:
working_directory: ~/work
docker:
- image: ubuntu
machine: { image: ubuntu-2204:current }

steps:
- run: *apt_install
- checkout
- run: git submodule update --init --recursive
- run: CC=clang .circleci/cmake-ubsan
- run: other/docker/circleci/run ubsan

static-analysis:
working_directory: ~/work
docker:
- image: ubuntu

steps:
- run: *apt_install
- run: &apt_install
apt-get update &&
DEBIAN_FRONTEND=noninteractive
apt-get install -y
ca-certificates
clang
cmake
git
libbenchmark-dev
libconfig-dev
libgmock-dev
libgtest-dev
libopus-dev
libsodium-dev
libvpx-dev
llvm-dev
ninja-build
pkg-config
- run:
apt-get install -y --no-install-recommends
ca-certificates
Expand Down
8 changes: 4 additions & 4 deletions other/docker/circleci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
################################################
# cmake-asan
FROM ubuntu:20.04
FROM ubuntu:24.04

RUN apt-get update && \
DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends \
clang \
cmake \
libclang-rt-dev \
libconfig-dev \
libgmock-dev \
libgtest-dev \
libopus-dev \
libsodium-dev \
libvpx-dev \
llvm-dev \
ninja-build \
pkg-config \
&& apt-get clean \
Expand All @@ -22,8 +22,8 @@ COPY entrypoint.sh /
RUN ["chmod", "755", "/entrypoint.sh"]

WORKDIR /home/builder
RUN groupadd -r -g 1000 builder \
&& useradd --no-log-init -r -g builder -u 1000 builder \
RUN groupadd -r -g 987 builder \
&& useradd --no-log-init -r -g builder -u 987 builder \
&& chown builder:builder /home/builder
USER builder

Expand Down
4 changes: 2 additions & 2 deletions other/docker/circleci/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/sh

set -eu
set -eux

SANITIZER="${1:-asan}"

cp -a /c-toxcore .
cd c-toxcore
.circleci/cmake-"$SANITIZER"
.circleci/cmake-"$SANITIZER" || cat /home/builder/c-toxcore/_build/CMakeFiles/CMakeError.log
4 changes: 3 additions & 1 deletion other/docker/circleci/run
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/sh

set -eux

SANITIZER="${1:-asan}"

docker build -t toxchat/c-toxcore:circleci other/docker/circleci
docker run --name toxcore-circleci --rm -it -v "$PWD:/c-toxcore" toxchat/c-toxcore:circleci "$SANITIZER"
docker run --name toxcore-circleci --rm --interactive --tty --volume "$PWD:/c-toxcore" toxchat/c-toxcore:circleci "$SANITIZER"

0 comments on commit 4af29cb

Please sign in to comment.