-
Notifications
You must be signed in to change notification settings - Fork 189
161 lines (146 loc) · 4.93 KB
/
mdns__host-tests.yml
File metadata and controls
161 lines (146 loc) · 4.93 KB
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: "mdns: host-tests"
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened, labeled]
jobs:
host_test_mdns:
if: contains(github.event.pull_request.labels.*.name, 'mdns') || github.event_name == 'push'
name: Host test build
runs-on: ubuntu-22.04
container: espressif/idf:release-v5.3
steps:
- name: Checkout esp-protocols
uses: actions/checkout@v4
with:
path: protocols
- name: Build and Test
shell: bash
run: |
. ${IDF_PATH}/export.sh
python -m pip install idf-build-apps==2.10.0 dnspython pytest pytest-embedded pytest-embedded-serial-esp pytest-embedded-idf
cd $GITHUB_WORKSPACE/protocols
# Build host tests app (with all configs and targets supported)
python ./ci/build_apps.py components/mdns/tests/host_test/
cd components/mdns/tests/host_test
ls -la
ls -ls build*
# First run the linux_app and send a quick A query and a reverse query
./build_linux_app/mdns_host.elf &
python dnsfixture.py A myesp.local --ip_only | xargs python dnsfixture.py X
# Next we run the pytest (using the console app)
pytest
host_compat_checks:
if: contains(github.event.pull_request.labels.*.name, 'mdns') || github.event_name == 'push'
name: Set of compatibility checks
strategy:
matrix:
idf_ver: ["latest"]
runs-on: ubuntu-22.04
container: espressif/idf:${{ matrix.idf_ver }}
steps:
- name: Checkout esp-protocols
uses: actions/checkout@v4
- name: Install Necessary Libs
run: |
apt-get update -y
apt-get install -y libbsd-dev
- name: Test AFL compat build
shell: bash
run: |
. ${IDF_PATH}/export.sh
cd components/mdns/tests/host_unit_test/
idf.py reconfigure
mkdir build2 && cd build2
cmake ..
cmake --build .
- name: Test no malloc functions
shell: bash
run: |
cd components/mdns
for file in $(ls *.c); do
cp $file /tmp
echo -n "Checking that $file does not call any std allocations directly..."
python mem_prefix_script.py $file
diff -q $file /tmp/$file || exit 1
echo "OK"
done
host_unit_test:
if: contains(github.event.pull_request.labels.*.name, 'mdns') || github.event_name == 'push'
name: Unit tests on host
strategy:
matrix:
idf_ver: ["latest"]
runs-on: ubuntu-22.04
container: espressif/idf:${{ matrix.idf_ver }}
steps:
- name: Checkout esp-protocols
uses: actions/checkout@v4
- name: Install bsdlib and ruby
run: |
apt-get update -y
apt-get install -y libbsd-dev ruby
- name: Build and run unit tests
shell: bash
run: |
. ${IDF_PATH}/export.sh
cd components/mdns/tests/host_unit_test/
idf.py reconfigure
mkdir build2 && cd build2
cmake -DUNIT_TESTS=test_receiver ..
cmake --build .
ctest --extra-verbose
cd ..
mkdir build3 && cd build3
cmake -DUNIT_TESTS=test_sender ..
cmake --build .
ctest --extra-verbose
fuzz_test:
if: contains(github.event.pull_request.labels.*.name, 'mdns-fuzz') || github.event_name == 'push'
name: Fuzzer tests for mdns lib
strategy:
matrix:
idf_ver: ["latest"]
runs-on: ubuntu-22.04
container: aflplusplus/aflplusplus:v4.34c
steps:
- name: Checkout esp-protocols
uses: actions/checkout@v4
- name: Checkout ESP-IDF
uses: actions/checkout@v4
with:
repository: espressif/esp-idf
path: idf
submodules: recursive
- name: Install Necessary Libs
run: |
apt-get update -y
apt-get install -y libbsd-dev
- name: Run AFL++
shell: bash
run: |
export IDF_PATH=$GITHUB_WORKSPACE/idf
cd components/mdns/tests/host_unit_test/
pip install dnslib
cd input && python generate_cases.py && cd ..
cmake -B build2 -S . -G "Ninja" -DCMAKE_C_COMPILER=afl-cc
cmake --build build2
timeout 10m afl-fuzz -i input -o out -- build2/mdns_host_unit_test || \
if [ $? -eq 124 ]; then # timeout exit code
if [ -n "$(find out/default/crashes -type f 2>/dev/null)" ]; then
echo "Crashes found!";
tar -czf out/default/crashes.tar.gz -C out/default crashes;
exit 1;
fi
else
exit 1;
fi
- name: Upload Crash Artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: fuzz-crashes
path: components/mdns/tests/host_unit_test/out/default/crashes.tar.gz
if-no-files-found: ignore