From 528c762e47e872891476a1edbbc40a3fd5465a57 Mon Sep 17 00:00:00 2001 From: Nemanja Mijailovic Date: Sun, 12 Jan 2025 14:07:28 +0100 Subject: [PATCH 1/4] Test all supported .NET versions --- .github/workflows/dotnet.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 3babb92..7e69910 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -6,19 +6,20 @@ on: branches: ["master"] pull_request: branches: ["master"] - -env: - dotnet-version: 9.0 jobs: AFL: runs-on: ubuntu-latest + strategy: + matrix: + dotnet-version: [8.0, 9.0] + steps: - uses: actions/checkout@v4 - uses: actions/setup-dotnet@v4 with: - dotnet-version: ${{ env.dotnet-version }} + dotnet-version: ${{ matrix.dotnet-version }} - name: Install AFL run: ./scripts/install.sh - name: Disable core dumps @@ -30,10 +31,14 @@ jobs: libFuzzer: runs-on: windows-latest + strategy: + matrix: + dotnet-version: [8.0, 9.0] + steps: - uses: actions/checkout@v4 - uses: actions/setup-dotnet@v4 with: - dotnet-version: ${{ env.dotnet-version }} + dotnet-version: ${{ matrix.dotnet-version }} - name: Run libFuzzer tests run: ./scripts/test-libfuzzer.ps1 From 9b5ed18ce9d9ceafd066e316079b3125a14d74ea Mon Sep 17 00:00:00 2001 From: Nemanja Mijailovic Date: Sun, 12 Jan 2025 14:31:12 +0100 Subject: [PATCH 2/4] Test both versions only with libFuzzer --- .github/workflows/dotnet.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 7e69910..10d312e 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -11,15 +11,14 @@ jobs: AFL: runs-on: ubuntu-latest - strategy: - matrix: - dotnet-version: [8.0, 9.0] + env: + dotnet-version: 9.0 steps: - uses: actions/checkout@v4 - uses: actions/setup-dotnet@v4 with: - dotnet-version: ${{ matrix.dotnet-version }} + dotnet-version: ${{ env.dotnet-version }} - name: Install AFL run: ./scripts/install.sh - name: Disable core dumps @@ -33,7 +32,7 @@ jobs: strategy: matrix: - dotnet-version: [8.0, 9.0] + dotnet-version: ["8.0", "9.0"] steps: - uses: actions/checkout@v4 From 5bb7e82e7131e06464eda5d5b0a91f87fcf1d4e6 Mon Sep 17 00:00:00 2001 From: Nemanja Mijailovic Date: Sun, 12 Jan 2025 14:34:55 +0100 Subject: [PATCH 3/4] Parametrize --- .github/workflows/dotnet.yml | 4 ++-- scripts/test-libfuzzer.ps1 | 7 ++++++- scripts/test.ps1 | 7 ++++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 10d312e..c1a3cac 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -25,7 +25,7 @@ jobs: run: sudo sh -c "echo core >/proc/sys/kernel/core_pattern" - name: Run AFL tests shell: pwsh - run: ./scripts/test.ps1 + run: ./scripts/test.ps1 ${{ env.dotnet-version }} libFuzzer: runs-on: windows-latest @@ -40,4 +40,4 @@ jobs: with: dotnet-version: ${{ matrix.dotnet-version }} - name: Run libFuzzer tests - run: ./scripts/test-libfuzzer.ps1 + run: ./scripts/test-libfuzzer.ps1 ${{ matrix.dotnet-version }} diff --git a/scripts/test-libfuzzer.ps1 b/scripts/test-libfuzzer.ps1 index b7652d1..522eab7 100644 --- a/scripts/test-libfuzzer.ps1 +++ b/scripts/test-libfuzzer.ps1 @@ -1,3 +1,8 @@ +param( + [Parameter(Mandatory=$true)] + [string]$dotnetVersion +) + $libFuzzer = "libfuzzer-dotnet-windows.exe" $uri = "https://github.com/metalnem/libfuzzer-dotnet/releases/latest/download/$libFuzzer" $corpus = "corpus" @@ -8,7 +13,7 @@ New-Item -Path $corpus -ItemType Directory dotnet publish src/SharpFuzz.CommandLine/SharpFuzz.CommandLine.csproj ` --output out ` --configuration release ` - --framework net9.0 + --framework "net$dotnetVersion" & scripts/fuzz-libfuzzer.ps1 ` -libFuzzer "./$libFuzzer" ` diff --git a/scripts/test.ps1 b/scripts/test.ps1 index a5a13e1..3c581ec 100644 --- a/scripts/test.ps1 +++ b/scripts/test.ps1 @@ -1,9 +1,14 @@ +param( + [Parameter(Mandatory=$true)] + [string]$dotnetVersion +) + New-Item -Path "corpus/test" -ItemType File -Force -Value "W" dotnet publish src/SharpFuzz.CommandLine/SharpFuzz.CommandLine.csproj ` --output out ` --configuration release ` - --framework net9.0 + --framework "net$dotnetVersion" & scripts/fuzz.ps1 ` -project tests/Library.Fuzz/Library.Fuzz.csproj ` From c2855368c3c1390ede383e6395223d11ff86dcd1 Mon Sep 17 00:00:00 2001 From: Nemanja Mijailovic Date: Sun, 12 Jan 2025 14:37:57 +0100 Subject: [PATCH 4/4] Fix --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index c1a3cac..ac0039b 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest env: - dotnet-version: 9.0 + dotnet-version: "9.0" steps: - uses: actions/checkout@v4