-
Notifications
You must be signed in to change notification settings - Fork 6
116 lines (108 loc) · 3.37 KB
/
cmake.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: CMake
on: [push, pull_request, fork]
jobs:
build:
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
shared: [ON, OFF]
exclude:
# CMake don't copy DLLs to exe output, skip for now
- os: windows-latest
shared: ON
env:
BUILD_SHARED_LIBS: ${{matrix.shared}}
steps:
- uses: actions/checkout@v4
- uses: lukka/get-cmake@latest
- name: Build
run: |
cmake --preset Release
cmake --build --parallel --preset Release
- name: Test
working-directory: build
run: ctest -C Release --output-on-failure
- name: Post Test
run: git diff --exit-code
memcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: lukka/get-cmake@latest
- name: Build
run: |
sudo apt-get install -y valgrind
cmake --preset Debug
cmake --build --parallel --preset Debug
- name: Test
working-directory: build
run: |
ctest -T memcheck --overwrite MemoryCheckCommandOptions="--leak-check=full --show-leak-kinds=all --error-exitcode=100"
awk 'FNR==1 {print "\n\n\n\n\n\t", FILENAME, "\n"}{print}' Testing/Temporary/MemoryChecker.*.log
- name: Post Test
run: git diff --exit-code
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: lukka/get-cmake@latest
- name: Build
run: |
cmake --preset Debug -DBUILD_COVERAGE=ON
cmake --build --parallel --preset Debug
- name: Test
working-directory: build
run: ctest -T test -T coverage
- name: Post Test
run: git diff --exit-code
- uses: codecov/codecov-action@v3
fuzz:
runs-on: ubuntu-latest
container: aflplusplus/aflplusplus
env:
AFL_SKIP_CPUFREQ: 1
steps:
- run: mkdir /src && cd /src
- uses: actions/checkout@v4
- name: Install
run: |
apt-get update
apt-get install -y python3-pip
apt-get install -y rename
pip install cmake
- name: Build
run: |
cmake --preset Release -DCMAKE_C_COMPILER=afl-cc -DCMAKE_CXX_COMPILER=afl-c++
cmake --build --parallel --preset Release
- name: Fuzz
# Fuzz for 60 seconds, until we fix the bugs we have
# Fuuz only pcapng files for now
run: |
mkdir input
cp pcaps/*.pcapng input
afl-fuzz -V 600 -i input -o output -e pcapng -- build/tests/test_packets_dump @@ /dev/null
afl-stat.sh output/default
cat output/default/fuzzer_stats
ls output/default/crashes
ls output/default/hangs
# Remove special chars from file names
- run: |
rename 's/:/_/g' output/default/crashes/*
rename 's/:/_/g' output/default/hangs/*
rename 's/$/.pcapng/g' output/default/crashes/*
rename 's/$/.pcapng/g' output/default/hangs/*
- name: Check
# Remove non-empty dirs, if they are not empry rmdir will fail
run: |
rmdir output/default/crashes
rmdir output/default/hangs
- uses: actions/upload-artifact@v3
if: failure()
with:
name: fuzz
retention-days: 7
path: |
output/default/crashes/*
output/default/hangs/*