Skip to content

Commit

Permalink
restructure targets
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-ares committed Sep 27, 2023
1 parent a2106f7 commit 658b3e8
Show file tree
Hide file tree
Showing 24 changed files with 235 additions and 172 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,33 @@ jobs:
submodules: recursive

- uses: ./.github/actions/deps
- uses: ./.github/actions/hugepages

- name: Build unit tests
- name: Build low unit tests
env:
MACHINE: linux_clang_combi_low
run: make -j -Otarget unit-test

- uses: ./.github/actions/hugepages
- name: Run low unit tests
run: |
sudo prlimit --pid $$ --memlock=-1:-1
./test.sh -j --page-sz gigantic
- name: Build high unit tests
env:
MACHINE: linux_clang_combi_low
run: make -j -Otarget unit-test

- name: Run Unit Tests
- name: Run high unit tests
run: |
sudo prlimit --pid $$ --memlock=-1:-1
./test.sh -j --page-sz gigantic
- name: Make Test Coverage Report
run: |
make cov-report
make combicov-report
mkdir -p build/pages/
mv build/native/clang/cov/html build/pages/cov
mv build/combi-cov/html build/pages/cov
- name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v1'
Expand All @@ -57,11 +68,13 @@ jobs:
# Not using fuzzbot-builder because llvm-cov must be ran in the same environment otherwise paths will not match
- name: Build Fuzz Tests
env:
MACHINE: linux_clang_x86_64_fuzz_asan
# Todo: use a matrix strategy
MACHINE: linux_clang_combi_high
EXTRAS: fuzz asan
run: make -j -Otarget fuzz-test

- name: Fetch Corpus, Generate Fuzzing Coverage
run: ./.github/workflows/scripts/fuzzcov_generate.sh build/linux/clang/x86_64_fuzz_asan/fuzz-test/
run: ./.github/workflows/scripts/fuzzcov_generate.sh build/linux/clang/combi/high/fuzz-test/

- name: Publish Fuzzing Coverage to codecov.io
env:
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows-disabled/test_fuzz_regressions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Test Fuzz Regressions
on:
push:
branches:
- main
workflow_dispatch:

jobs:
make-fuzz:
name: Publish ${{ matrix.feature_set }} feature set
strategy:
matrix:
feature_set: [high, low]
runs-on:
group: github-v1
env:
MACHINE: linux_clang_combi_${{ matrix.feature_set }}
EXTRAS: fuzz asan ubsan
steps:
- uses: actions/checkout@v4

- uses: ./.github/actions/deps

- name: Build Fuzz Tests
run: make -j -Otarget fuzz-test

- name: Run Fuzz Tests Against Corpora
run: make -k -j -Otarget run-fuzz-test
File renamed without changes.
39 changes: 0 additions & 39 deletions .github/workflows/make.yml

This file was deleted.

43 changes: 0 additions & 43 deletions .github/workflows/publish_fuzz_targets.yml

This file was deleted.

48 changes: 0 additions & 48 deletions .github/workflows/sanitizer_tests.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/scripts/fuzzcov_generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ for corpus in "${corpora[@]}"; do
# Run the fuzzing target if it exists.
if [[ -f $TARGET ]]; then
export LLVM_PROFILE_FILE="build/profraw/${BASE}.profraw"
find build/fuzzcov/corpus_unpacked/${BASE}/ -type f -exec $TARGET {} +
find build/fuzzcov/corpus_unpacked/${BASE}/ -type f -exec "$TARGET {} || true" +
llvm-profdata merge -sparse "${LLVM_PROFILE_FILE}" -o "build/fuzzcov/profdata/${BASE}.profdata"
CODECOV_FILE=${BASE}.lcov
llvm-cov export $TARGET -instr-profile="build/fuzzcov/profdata/${BASE}.profdata" -format=lcov > "build/fuzzcov/lcov/${BASE}.lcov"
Expand Down
116 changes: 116 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# On every PR and main commit:
# - Build on GCC and Clang
# - Test on GCC

name: Unit Tests
on:
pull_request:
push:
branches:
- main
- next
merge_group:
types: [checks_requested]
workflow_dispatch:
jobs:
make-test:
strategy:
fail-fast: false
matrix:
compiler: [gcc]
runs-on:
group: github-v1
env:
CC: ${{ matrix.compiler }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- uses: dtolnay/[email protected]

- uses: ./.github/actions/deps

- name: Build everything
run: make -j -Otarget all rust

- uses: ./.github/actions/hugepages

- name: Run unit tests
run: |
sudo prlimit --pid $$ --memlock=-1:-1
./test.sh -j --page-sz gigantic
test-with-sanitizers:
# Only run sanitizer tests if the gcc tests passed
needs: make-test
continue-on-error: true
strategy:
matrix:
# add lowend once its fixed
# highend cannot be tested on the hosted runners due to lack of AVX-512
feature_set: [modern]
sanitizer: [asan, ubsan]
runs-on:
group: github-v1
env:
MACHINE: linux_clang_combi_${{ matrix.feature_set }}
EXTRAS: ${{ matrix.sanitizer }}
steps:
- run: lscpu

- uses: actions/checkout@v4

- uses: ./.github/actions/deps
- uses: ./.github/actions/hugepages

- name: Build unit tests
run: make -j -Otarget unit-test

- name: Run unit tests
run: |
sudo prlimit --pid $$ --memlock=-1:-1
./test.sh -j --page-sz gigantic
make-fuzz:
# Only build fuzzers if sanitizer tests pass
needs: test-with-sanitizers
name: Build Fuzzers for ${{ matrix.feature_set }} feature set (publish on main)
strategy:
matrix:
# add lowend once it's fixed
feature_set: [modern, highend]
runs-on:
group: github-v1
env:
MACHINE: linux_clang_combi_${{ matrix.feature_set }}
EXTRAS: fuzz asan ubsan
steps:
- uses: actions/checkout@v4

- uses: ./.github/actions/hugepages
- uses: ./.github/actions/deps

- run: sudo apt update && sudo apt install -y zip

- uses: firedancer-io/fuzzbot-builder@main
name: Build fuzz tests
with:
command: make -j -Otarget fuzz-test

- name: List Artifacts
run: |
ls build/linux/clang/combi/${{ matrix.feature_set }}/fuzz-test
- uses: firedancer-io/clusterfuzz-action@main
# Only publish fuzz targets if on main or next
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/next' }}
name: Upload fuzz targets to ClusterFuzz
with:
bucket-name: firedancer-builds.isol-clusterfuzz.appspot.com
artifact-dir: build/linux/clang/combi/${{ matrix.feature_set }}/fuzz-test
object-prefix: main/libfuzzer/${{ matrix.feature_set }}/firedancer
project-id: isol-clusterfuzz
qualifier: ${{ matrix.feature_set }}
service-account-credentials: ${{ secrets.FUZZ_SERVICE_ACCT_JSON_BUNDLE }}


2 changes: 2 additions & 0 deletions .github/workflows/trailing_whitespace.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Trailing Whitespace
on:
push:
branches:
- main
pull_request:
jobs:
check:
Expand Down
2 changes: 1 addition & 1 deletion config/base.mk
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ GENHTML=genhtml
FD_HAS_MAIN:=1

# Parameters passed to libFuzzer tests
FUZZFLAGS:=-max_total_time=600 -timeout=10 -runs=100
FUZZFLAGS:=-max_total_time=600 -jobs=10 -workers=10 -timeout=10 -runs=10
26 changes: 26 additions & 0 deletions config/coverage.mk
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,29 @@ $(COVDIR)/cov.lcov: $(COVDIR)/cov.profdata
$(COVDIR)/cov.profdata: $(wildcard $(COVDIR)/raw/*.profraw)
@mkdir -p $(COVDIR)
$(LLVM_PROFDATA) merge -o $@ $^


COMBICOVDIR:=$(BASEDIR)/combi-cov

# Make coverage report mixing coverage info for build under build/linux/clang/combi/
combicov-report: $(COMBICOVDIR)/html
.PHONY: $(COMBICOVDIR)/html
$(COMBICOVDIR)/html: $(COMBICOVDIR)/cov.lcov
rm -rf $@
$(GENHTML) --output $@ $<
@echo "Created coverage report at $@"

.PHONY: $(COVDIR)/cov.lcov
$(COMBICOVDIR)/cov.lcov: $(COMBICOVDIR)/cov.profdata
$(LLVM_COV) export \
-format=lcov \
-instr-profile=$< \
$(shell find $(OBJDIR)/obj \
-name '*.o' \
-exec printf "-object=%q\n" {} \;) \
--ignore-filename-regex="test_.*\\.c" \
> $@

$(COMBICOVDIR)/cov.profdata: $(wildcard build/linux/clang/combi/*/cov/raw/*.profraw)
@mkdir -p $(COMBICOVDIR)
$(LLVM_PROFDATA) merge -o $@ $^
1 change: 1 addition & 0 deletions config/everything.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ help:
# EXTRAS = $(EXTRAS)
# SHELL = $(SHELL)
# BASEDIR = $(BASEDIR)
# BUILDDIR = $(BUILDDIR)
# OBJDIR = $(OBJDIR)
# CPPFLAGS = $(CPPFLAGS)
# CC = $(CC)
Expand Down
2 changes: 2 additions & 0 deletions config/linux_clang_combi_highend.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BUILDDIR:=linux/clang/combi/highend
include config/linux_clang_icelake.mk
Loading

0 comments on commit 658b3e8

Please sign in to comment.