You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix some randomly failing Perf.File tests on wasm/aot (#2601)
On wasm/aot, `System.IO.FileSystem/Perf.File`'s `CopyTo`, `CopyToOverride`, and `ReadAllBytes` benchmarks fail randomly with:
```
---> System.IO.IOException: The file '/tmp/' already exists.
at BenchmarkDotNet.Autogenerated.Runnable_48.Run(IHost host, String benchmarkName)
at System.Reflection.MethodInvoker.InterpretedInvoke(Object , Span`1 , BindingFlags )
--- End of inner exception stack trace ---
at BenchmarkDotNet.Autogenerated.UniqueProgramName.AfterAssemblyLoadingAttached(String[] args)
```
.. due to `Path.GetTempFileName()` being buggy - dotnet/runtime#73721.
In `SetupReadAllBytes`, we are building the test file path as:
```csharp
_testFilePath = Path.Combine(baseDir, Path.GetTempFileName())
```
.. but the `Path.GetTempFileName()` is not appropriate here, as it will
return a full path, and it will create the file. Instead we can use
`Path.GetRandomFileName()` which should avoid the underlying issue
completely.
Fixesdotnet/runtime#74104 .
0 commit comments