[mdns]: Add support for mdns service discovery #3783
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |