Skip to content

Commit

Permalink
build(docker,cmakelists.txt,code-cov,llvm-fuzz): remove -static from …
Browse files Browse the repository at this point in the history
…fuzz/coverage builds
  • Loading branch information
JaDogg committed May 18, 2024
1 parent 5e8128c commit 105fac3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
17 changes: 11 additions & 6 deletions compiler/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
cmake_minimum_required(VERSION 3.5)
project(Yaksha)

if(NOT APPLE)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set(BUILD_SHARED_LIBS OFF)
set(CMAKE_EXE_LINKER_FLAGS "-static")
endif()

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
Expand All @@ -15,6 +9,17 @@ set(CMAKE_INSTALL_PREFIX build})
set(UTF8_DIR 3rd/utfcpp/source)
set(REPROC_DIR 3rd/reproc)

if(NOT APPLE)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
if (DEFINED ENV{YAKSHA_COV_OR_FUZZ})
message("Building for coverage or fuzzing")
else()
message("Static build enabled")
set(BUILD_SHARED_LIBS OFF)
set(CMAKE_EXE_LINKER_FLAGS "-static")
endif ()
endif()

get_filename_component(CMAKE_BINARY_DIR "bin" ABSOLUTE)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})

Expand Down
8 changes: 3 additions & 5 deletions compiler/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
FROM ubuntu:noble-20240407.1
ENV DEBIAN_FRONTEND=noninteractive
ARG ZIG_VERSION=0.9.1
RUN apt-get update && apt-get -y -q install clang-12 clang-tools git wget build-essential python3 libssl-dev lcov gcovr dos2unix cmake ninja-build
RUN apt-get update && apt-get -y -q install clang-15 clang-tools git wget build-essential python3 libssl-dev lcov gcovr dos2unix cmake ninja-build python3-pip python3-tqdm

RUN ln -s /usr/bin/clang-12 /usr/bin/clang \
&& ln -s /usr/bin/clang++-12 /usr/bin/clang++

RUN apt-get -y -q install python3-pip && pip3 install tqdm
RUN ln -s /usr/bin/clang-15 /usr/bin/clang \
&& ln -s /usr/bin/clang++-15 /usr/bin/clang++

RUN wget https://ziglang.org/download/0.9.1/zig-linux-x86_64-${ZIG_VERSION}.tar.xz \
&& tar -xf zig-linux-x86_64-${ZIG_VERSION}.tar.xz \
Expand Down
4 changes: 2 additions & 2 deletions compiler/scripts/code-coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ find . -type f -exec dos2unix {} \;
set -e
cd build || exit 1
# Build project
cmake -G Ninja -S .. -B . -DCMAKE_CXX_FLAGS="-fprofile-arcs -ftest-coverage -fPIC -O0 -fsanitize=address -static-libasan -g"
cmake --build . -- -j 24
YAKSHA_COV_OR_FUZZ=1 cmake -G Ninja -S .. -B . -DCMAKE_CXX_FLAGS="-fprofile-arcs -ftest-coverage -fPIC -O0 -fsanitize=address -static-libasan -g"
YAKSHA_COV_OR_FUZZ=1 cmake --build . -- -j 24
# Run test cases
echo "β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ"
echo "β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ"
Expand Down
4 changes: 2 additions & 2 deletions compiler/scripts/llvm-fuzzer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ echo "---------------FUZZER--------------"
mkdir fuzz-build
cd fuzz-build
export YAKSHA_FUZZ=1
CC=clang-12 CXX=clang++-12 cmake -S .. -B .
cmake --build . --target YakshaFuzz
YAKSHA_COV_OR_FUZZ=1 CC=clang-15 CXX=clang++-15 cmake -S .. -B .
YAKSHA_COV_OR_FUZZ=1 cmake --build . --target YakshaFuzz
cd ../bin
./YakshaFuzz -fork=2 ../test_data
cp crash-* /fuzz
Expand Down

0 comments on commit 105fac3

Please sign in to comment.