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
micro_benchmarks.py: Run the project from an isolated directory (#2330)
* micro_benchmarks.py: Run the project from an isolated directory
Problem:
When running `MicroBenchmarks.csproj` for wasm, the build does:
1. `dotnet restore /Users/radical/dev/performance/src/benchmarks/micro/MicroBenchmarks.csproj ...`
2. `dotnet build /Users/radical/dev/performance/src/benchmarks/micro/MicroBenchmarks.csproj ...`
- which emits to `./artifacts/{obj, bin}/MicroBenchmarks/`
3. `dotnet run --project /Users/radical/dev/performance/src/benchmarks/micro/MicroBenchmarks.csproj`
- and this runs from the artifacts dir
Then the running `MicroBenchmarks` tries to build the same project as a project reference from a generated wrapper project:
4. `// start dotnet restore`; `// start dotnet build ..`
- And this emits warnings, and then errors:
```
warning MSB3026: Could not copy "/Users/radical/dev/performance/artifacts/obj/MicroBenchmarks/Release/net7.0/MicroBenchmarks.pdb" to "/Users/radical/dev/performance/artifacts/bin/MicroBenchmarks/Release/net7.0/MicroBenchmarks.pdb". Beginning retry 1 in 1000ms. The process cannot access the file '/Users/radical/dev/performance/artifacts/bin/MicroBenchmarks/Release/net7.0/MicroBenchmarks.pdb' because it is being used by another process.
```
- This is because the project is running from the same directory, as
what the build in (4) tries to work with, which causes the build
failure. If I use a different directory for (4), then there are no
errors.
This fails the build. But BDN ignores that, and runs the build again
with `--no-dependencies`, which then skips the build of
`MicroBenchmarks.csproj`, and just builds the wrapper project, thus
succeeding.
Solution:
This commit prevents this by copying the build output to a separate
directory, and running it from there.
Fixes#2327
* Add a `--run-isolated` command line parameter
This will cause the build output to be in
`artifacts/bin/for-running/{project_name}`, instead of
`artifacts/bin/{project_name}`. And then instead of using `dotnet run
--project` to run, `dotnet exec {project_name.dll}` will be used.
* Fix windows build - don't assume .dll extension
* Use dotnet exec only when running isolated
* clean up the api a bit
* Bump bdn to 0.13.1.1740
* micro_benchmarks.py: add back '--' to the 'dotnet run' command line
0 commit comments