]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fixed for nightly fuzzing to align with new Make approach (#4289)
authorTerry Burton <tez@terryburton.co.uk>
Sun, 24 Oct 2021 19:09:21 +0000 (20:09 +0100)
committerGitHub <noreply@github.com>
Sun, 24 Oct 2021 19:09:21 +0000 (15:09 -0400)
* Fix nightly fuzzing; dynamic matrix of protocols to fuzz

* CI: Don't run all tests for special fuzzer runs

.github/workflows/ci-deb.yml
.github/workflows/ci-rpm.yml
.github/workflows/ci-scheduled-fuzzing.yml
.github/workflows/ci.yml
.github/workflows/documentation.yml

index d70c41fa911693f6cb1d08f6d22970ab6da96090..7b7079b8f4d9efee7c44e5415be3661a100ea52a 100644 (file)
@@ -4,6 +4,7 @@ on:
   push:
     branches-ignore:
       - coverity_scan
+      - run-fuzzer**
   schedule:
     - cron: '0 20 * * *'
 
index 1f13238f10e5528bad553a3951f039a01c7b3ef6..9a5bf20e26a54706b08bb5ec0e4fd02aba5be7bb 100644 (file)
@@ -4,6 +4,7 @@ on:
   push:
     branches-ignore:
       - coverity_scan
+      - run-fuzzer**
   schedule:
     - cron: '0 20 * * *'
 
index 9a589ad9c8d4b7d5628cec48253a8bc3637eba39..6fdf114ce5daf1dfaad95dc9721bb1ab83261859 100644 (file)
@@ -33,20 +33,65 @@ env:
   CC: clang
 
 jobs:
+
+  #
+  #  Constructs a matrix of protocols to fuzz as JSON that when set in the main
+  #  fuzzer job is equivalent to the following YAML:
+  #
+  #    matrix:
+  #      env:
+  #        - { "PROTOCOL": "radius", "TOTAL_RUNTIME": "20000" }
+  #        - { "PROTOCOL": "dhcpv4", "TOTAL_RUNTIME": "20000" }
+  #        - ...
+  #
+  set-matrix:
+
+    name: Setup build matrix
+
+    runs-on: ubuntu-latest
+
+    outputs:
+      matrix: ${{ steps.set-matrix.outputs.matrix }}
+
+    steps:
+
+    - uses: actions/checkout@v2
+      with:
+        lfs: false
+
+    - id: set-matrix
+      name: Setup the matrix
+      run: |
+        #
+        #  20000s is just short of the 6h GitHub Action job limit
+        #
+        TIMEOUT=20000
+        P=$(
+            for PROTO in `sed -ne 's/^FUZZER_PROTOCOLS\s\+=\s\+\(.*\)/\1/p' src/bin/all.mk`; do
+              echo "{ \"PROTOCOL\": \"$PROTO\", \"TOTAL_RUNTIME\": \"$TIMEOUT\" },"
+            done
+          )
+        M=$(cat <<EOF
+        {
+          "env": [
+            ${P:0:-1}
+          ]
+        }
+        EOF
+          )
+        echo ::set-output name=matrix::$M
+
+
   fuzzer:
 
+    needs:
+      - set-matrix
+
     runs-on: ubuntu-20.04
 
-    # TOTAL_RUNTIME: 20000 is just short of the 6 hours GH Actions limit
     strategy:
       fail-fast: false
-      matrix:
-        env:
-          - { PROTOCOL: radius, TOTAL_RUNTIME: 20000 }
-          - { PROTOCOL: dhcpv4, TOTAL_RUNTIME: 20000 }
-          - { PROTOCOL: dhcpv6, TOTAL_RUNTIME: 20000 }
-          - { PROTOCOL: vmps,   TOTAL_RUNTIME: 20000 }
-          - { PROTOCOL: tacacs, TOTAL_RUNTIME: 20000 }
+      matrix: ${{ fromJson(needs.set-matrix.outputs.matrix) }}
 
     env: ${{ matrix.env }}
 
@@ -100,14 +145,6 @@ jobs:
       run: |
         pip3 install tacacs_plus
 
-#    - name: Install LLVM snapshot
-#      run: |
-#        wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add
-#        sudo apt-add-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal main"
-#        sudo apt-get install -y --no-install-recommends clang llvm gdb
-#        sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-12 60 && sudo update-alternatives --set clang /usr/bin/clang-12
-#        sudo update-alternatives --install /usr/bin/llvm-symbolizer llvm-symbolizer /usr/bin/llvm-symbolizer-12 60 && sudo update-alternatives --set llvm-symbolizer /usr/bin/llvm-symbolizer-12
-
     - name: Install LLVM 10
       run: |
         wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add
@@ -154,16 +191,15 @@ jobs:
         REMAINING_TIME=$(( $TOTAL_RUNTIME + `cat ~/start_timestamp` - `date +%s` ))
         echo "Fuzzing ${{ steps.pick_commit.outputs.commit_id }}:$PROTOCOL for $REMAINING_TIME secs"
         [[ "$REMAINING_TIME" -lt 1 ]] && exit 1
-        timeout "$REMAINING_TIME" make test.fuzzer.$PROTOCOL FUZZER_TIMEOUT=300 FUZZER_ARGUMENTS="-jobs=10000 -workers=`nproc`" || :
-        cp fuzz-*.log build/fuzzer
-        find build/fuzzer -type f ! -name 'fuzz-*.log' | grep . && exit 1 || :
+        make test.fuzzer.$PROTOCOL FUZZER_TIMEOUT="$REMAINING_TIME" FUZZER_ARGUMENTS="-jobs=`nproc` -workers=`nproc`" || :
+        find build/fuzzer -type f ! -path 'build/fuzzer/*.log' | grep . && exit 1 || :
       env:
         GITHUB_REF: "${{ github.ref }}"
 
     - name: "Clang libFuzzer: Store assets on failure"
       uses: actions/upload-artifact@v2
       with:
-        name: fuzzer-${{ matrix.env.PROTOCOL }}-${{ steps.pick_commit.outputs.commit_id }}
+        name: clang-fuzzer-${{ matrix.env.PROTOCOL }}-${{ steps.pick_commit.outputs.commit_id }}
         path: build/fuzzer
         retention-days: 30
       if: ${{ failure() }}
index 471e4d7adc9cda0d0aef2d872bfac8350b77024f..ea013fb9fcd67d91fec445062bb16103d54d6e21 100644 (file)
@@ -4,6 +4,7 @@ on:
   push:
     branches-ignore:
       - coverity_scan
+      - run-fuzzer**
   pull_request:
 
 env:
index 97c2129a855279f922b9493a07cd843e1c027430..1efbb17a9e58815777d24b879821d7f4bcfb5c50 100644 (file)
@@ -2,8 +2,9 @@ name: Documentation
 
 on:
   push:
-    branches-ignore: 
+    branches-ignore:
       - coverity_scan
+      - run-fuzzer**
   pull_request:
 
 jobs:
@@ -15,18 +16,18 @@ jobs:
 
     steps:
     - uses: actions/checkout@v2
-        
+
     - name: Install common build dependencies
       run: |
         sudo apt-get install -y --no-install-recommends \
         asciidoctor \
         doxygen \
         graphviz
-        
+
     - name: Install Antora
       run: |
         sudo npm i -g @antora/cli@2.0 @antora/site-generator-default@2.0;
-        
+
     - name: Show versions
       run: |
         make --version
@@ -48,6 +49,6 @@ jobs:
         target_branch: main
         pages_directory: doc/doxygen/html
         target_directory : docs
-        
+
     - name: Build Antora docsite
-      run: antora site.yml 
+      run: antora site.yml