Skip to content

Commit 679e726

Browse files
authored
Test all supported .NET versions with libFuzzer (#68)
1 parent 9667b22 commit 679e726

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

.github/workflows/dotnet.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ on:
66
branches: ["master"]
77
pull_request:
88
branches: ["master"]
9-
10-
env:
11-
dotnet-version: 9.0
129

1310
jobs:
1411
AFL:
1512
runs-on: ubuntu-latest
1613

14+
env:
15+
dotnet-version: "9.0"
16+
1717
steps:
1818
- uses: actions/checkout@v4
1919
- uses: actions/setup-dotnet@v4
@@ -25,15 +25,19 @@ jobs:
2525
run: sudo sh -c "echo core >/proc/sys/kernel/core_pattern"
2626
- name: Run AFL tests
2727
shell: pwsh
28-
run: ./scripts/test.ps1
28+
run: ./scripts/test.ps1 ${{ env.dotnet-version }}
2929

3030
libFuzzer:
3131
runs-on: windows-latest
3232

33+
strategy:
34+
matrix:
35+
dotnet-version: ["8.0", "9.0"]
36+
3337
steps:
3438
- uses: actions/checkout@v4
3539
- uses: actions/setup-dotnet@v4
3640
with:
37-
dotnet-version: ${{ env.dotnet-version }}
41+
dotnet-version: ${{ matrix.dotnet-version }}
3842
- name: Run libFuzzer tests
39-
run: ./scripts/test-libfuzzer.ps1
43+
run: ./scripts/test-libfuzzer.ps1 ${{ matrix.dotnet-version }}

scripts/test-libfuzzer.ps1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
param(
2+
[Parameter(Mandatory=$true)]
3+
[string]$dotnetVersion
4+
)
5+
16
$libFuzzer = "libfuzzer-dotnet-windows.exe"
27
$uri = "https://github.com/metalnem/libfuzzer-dotnet/releases/latest/download/$libFuzzer"
38
$corpus = "corpus"
@@ -8,7 +13,7 @@ New-Item -Path $corpus -ItemType Directory
813
dotnet publish src/SharpFuzz.CommandLine/SharpFuzz.CommandLine.csproj `
914
--output out `
1015
--configuration release `
11-
--framework net9.0
16+
--framework "net$dotnetVersion"
1217

1318
& scripts/fuzz-libfuzzer.ps1 `
1419
-libFuzzer "./$libFuzzer" `

scripts/test.ps1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1+
param(
2+
[Parameter(Mandatory=$true)]
3+
[string]$dotnetVersion
4+
)
5+
16
New-Item -Path "corpus/test" -ItemType File -Force -Value "W"
27

38
dotnet publish src/SharpFuzz.CommandLine/SharpFuzz.CommandLine.csproj `
49
--output out `
510
--configuration release `
6-
--framework net9.0
11+
--framework "net$dotnetVersion"
712

813
& scripts/fuzz.ps1 `
914
-project tests/Library.Fuzz/Library.Fuzz.csproj `

0 commit comments

Comments
 (0)