diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 3babb92..ac0039b 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -6,14 +6,14 @@ on: branches: ["master"] pull_request: branches: ["master"] - -env: - dotnet-version: 9.0 jobs: AFL: runs-on: ubuntu-latest + env: + dotnet-version: "9.0" + steps: - uses: actions/checkout@v4 - uses: actions/setup-dotnet@v4 @@ -25,15 +25,19 @@ 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 + 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 + 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 `