Skip to content

Commit 2f47795

Browse files
committed
Add a duration argument to fuzzing
1 parent 2a687c9 commit 2f47795

3 files changed

Lines changed: 15 additions & 3 deletions

File tree

Runner/JobBase.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,19 @@ public string GetArgument(string argument, string @default)
5959
: @default;
6060
}
6161

62-
private bool TryGetArgument(string argument, [NotNullWhen(true)] out string? value)
62+
public bool TryGetArgument(string argument, out int value)
63+
{
64+
if (TryGetArgument(argument, out string? stringValue) &&
65+
int.TryParse(stringValue, out value))
66+
{
67+
return true;
68+
}
69+
70+
value = 0;
71+
return false;
72+
}
73+
74+
public bool TryGetArgument(string argument, [NotNullWhen(true)] out string? value)
6375
{
6476
value = null;
6577

Runner/Jobs/BenchmarkLibrariesJob.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ private async Task CloneDotnetPerformanceAndSetupToolsAsync()
8282
await RunProcessAsync("git", $"clone --no-tags --depth=1 -b {branch} --progress https://github.com/{repo} performance", logPrefix: "Clone performance");
8383

8484
// Performance's global.json is out of date
85-
byte[] bytes = await HttpClient.GetByteArrayAsync("https://raw.githubusercontent.com/dotnet/runtime/refs/heads/main/global.json");
86-
await File.WriteAllBytesAsync("performance/global.json", bytes);
85+
await File.WriteAllBytesAsync("performance/global.json", await HttpClient.GetByteArrayAsync("https://raw.githubusercontent.com/dotnet/runtime/refs/heads/main/global.json"));
8786

8887
if (TryGetFlag("medium") || TryGetFlag("long"))
8988
{

Runner/Jobs/FuzzLibrariesJob.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ private async Task RunFuzzersAsync(string fuzzerNamePattern)
119119
TryGetFlag("long") ? int.MaxValue :
120120
TryGetFlag("short") ? 600 :
121121
TryGetFlag("dry") ? 60 :
122+
TryGetArgument("duration", out int sec) ? sec :
122123
3600;
123124

124125
for (int i = 0; i < matchingFuzzers.Length; i++)

0 commit comments

Comments
 (0)