test: Mark test projects as AOT compatible and switch to xunit.v3.aot with MTP testrunner - #297
Conversation
There was a problem hiding this comment.
This configures the dotnet test to use the new MTP runner.
{
"test": {
"runner": "Microsoft.Testing.Platform"
}
}You can find the related documentation from Microsoft here.
From what I understand from the xunit.v3 aot docs, it should be possible to continue using VSTest, but since it's the default, I think it makes sense to use MTP all the way.
Edit: I tried to move it into the C# crate, but if you run dotnet test from the repo root, it has no effect, so it should stay there, unfortunately.
There was a problem hiding this comment.
Ah, actually, would it work wrapping the C# runner via a just command and then make it pick up the file from a C#-related path?
There was a problem hiding this comment.
you mean moving the global.json file to crates/backend_csharp and then modifying the just file to
cd crates/backend_csharp && dotnet test --project tests/reference_project/Tests/Tests.csproj
? That should be possible as well, I think
There was a problem hiding this comment.
Yes, something to the effect. I think it's ugly if a random backend litters the crate root for unit tests.
75ecad5 to
9594953
Compare
|
Thanks! |
|
Yes, worked, thanks a lot! |


This is the first step to introduce the fixes necessary for #293.
The final goal is to add
DisableRuntimeMarshallingto all the test projects. However, when I did that, additional issues arose from, e.g., function pointers that depended on runtime marshaling as well, not just theVec<T>use case in #293.Therefore, I decided to split the work into multiple smaller PRs and start with a common foundation: The AOT-compatible test project.
I migrated to xunit.v3.aot (still in prerelease) and fixed some warnings. The AOT package requires the new MicrosoftTestingPlatform, which is why some of the dotnet test commands were adjusted.
Note: I did not want to change the CI, so the tests still run normally in the CI. I only published and ran them locally.