Skip to content

Instantly share code, notes, and snippets.

@alexgpg
Last active June 13, 2022 21:33
Show Gist options
  • Select an option

  • Save alexgpg/959f7ded943e7d42100a2013c8f0f697 to your computer and use it in GitHub Desktop.

Select an option

Save alexgpg/959f7ded943e7d42100a2013c8f0f697 to your computer and use it in GitHub Desktop.
Docker image for test google benchmark fix (#1340) and PR(#1410)
FROM ubuntu:14.04
RUN apt-get update
RUN apt-get -y install software-properties-common git llvm-3.9-tools wget \
libssl-dev build-essential
# Install GCC 5
RUN add-apt-repository ppa:ubuntu-toolchain-r/test
RUN apt-get update
RUN apt-get -y install gcc-5 g++-5
RUN \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5
# Install CMake
ARG CMAKE_URL="https://github.com/Kitware/CMake/releases/download/v3.23.2/cmake-3.23.2.tar.gz"
RUN wget $CMAKE_URL
RUN tar xvzf cmake-3.23.2.tar.gz
RUN cd /cmake-3.23.2/ && ./bootstrap && make && make install
RUN ln -s /usr/bin/FileCheck-3.9 /usr/bin/FileCheck
# Install Clang 5.0.0
ARG CLANG_URL="https://releases.llvm.org/5.0.0/clang+llvm-5.0.0-linux-x86_64-ubuntu14.04.tar.xz"
RUN wget $CLANG_URL
RUN tar xvf clang+llvm-5.0.0-linux-x86_64-ubuntu14.04.tar.xz
RUN cd clang+llvm-5.0.0-linux-x86_64-ubuntu14.04 && cp -r * /
# Download Google Benchmark
ARG GIT_URL="https://github.com/alexgpg/benchmark.git"
ARG GIT_CHECKOUT="fix-1340-do-not-optimize-gcc-overhead"
RUN git clone $GIT_URL
# Clang build and run common tests and DoNotOptimize assembly test
RUN \
cd benchmark/ && \
cmake -E make_directory "clang_build/" && \
cmake \
-DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang \
-DCMAKE_BUILD_TYPE=Release \
-DBENCHMARK_ENABLE_ASSEMBLY_TESTS=ON -DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON \
-S . -B "clang_build/" && \
cmake --build "clang_build/" --config Release && \
# Run every test except assembly tests
cmake -E chdir "clang_build/" ctest --build-config Release \
-E "assembly_test_CHECK" && \
# Run DoNotOptimize assembly test
cmake -E chdir "clang_build/" ctest --build-config Release \
-R "run_donotoptimize_assembly_test_CHECK"
# GCC build and run DoNotOptimize assembly test
RUN \
cd benchmark/ && \
cmake -E make_directory "gcc_build/" && \
cmake \
-DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc \
-DCMAKE_BUILD_TYPE=Release \
-DBENCHMARK_ENABLE_ASSEMBLY_TESTS=ON -DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON \
-S . -B "gcc_build/" && \
cmake --build "gcc_build/" --config Release && \
# Run every test except assembly tests
cmake -E chdir "gcc_build/" ctest --build-config Release \
-E "assembly_test_CHECK" && \
# Run DoNotOptimize assembly test
cmake -E chdir "gcc_build/" ctest --build-config Release \
-R run_donotoptimize_assembly_test_CHECK

Docker image for test google benchmark fix (#1340)

Docker image for test fix for the

How to check

  1. Copy Dockerfile
  2. Run
docker build --tag googlebench:1340fix .

If docker build successfully that means the branch build and passed the tests.

Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment