Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert our unit tests and perf harness to use native entry-points #50

Merged
merged 62 commits into from
Jan 26, 2024

Conversation

jkoritzinsky
Copy link
Collaborator

@jkoritzinsky jkoritzinsky commented Dec 22, 2023

Currently, our unit tests and perf harness are both C#-based (xUnit, BenchmarkDotNet) but do almost all of their work in native code.

This PR changes our tests to instead use GoogleTest and Google Benchmark and be fully-native test apps.

The only remaining managed code is the Regression.TargetAssembly app that is used for the FindAPIs test and the code to locate CoreCLR (done so using a DNNE-based API).

I've moved the .NET Framework install lookup and the "generate an image with indirection tables" functionality into the native code.

I'm still exploring how to move the CoreCLR locating APIs to C++. I'd like to use nethost and the hostfxr APIs to avoid starting up CoreCLR just to get its location, but it is difficult to use nethost without moving to vcpkg (right now I'm using FetchContent to pull in dependencies manually).

CoreCLR lookup is done with the nethost APIs from the current .NET installation (to avoid using vcpkg).

Test exploration/execution inner-loop still works very well in this world. The "Testing" pane on VSCode populates with all of the tests when the CMake extension is installed and configured, and the Test Explorer in VS populates when you open the DNMD project in the CMake targets view.

This PR updates the C++ standard version used in the tests to C++17 to get the standard filesystem APIs. I can move away from using these APIs, but then we'll need to provide a separate PAL for them (which I wanted to avoid for the first implementation to focus on getting things to work).

jkoritzinsky and others added 30 commits December 13, 2023 14:42
…ture in C++ to be able to run the tests we want to run.
…st integration (which starts a separate process for each test) way too slow, likely due to CoreCLR startup.
…iles so we aren't allocating a ton and slowing down test discovery and execution.
…sing IMetaDataEmit instead of using Roslyn to remove another managed dependency.
@jkoritzinsky
Copy link
Collaborator Author

I still have some work to get macOS passing, but think enough work is done for a first look.

@jkoritzinsky
Copy link
Collaborator Author

I can't reproduce the mac failures locally... I'll try to figure out what's going on.

@jkoritzinsky
Copy link
Collaborator Author

Okay looks like the problem is that hostfxr doesn't find runtimes/frameworks/sdks in its installation if that is not a global installation and the path is not specified. macOS is the only platform where the install path isn't the default path.

I'll try to figure out a good solution here.

Copy link
Owner

@AaronRobinsonMSFT AaronRobinsonMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bunch of minor nits. Thanks!

src/inc/internal/dnmd_platform.hpp Show resolved Hide resolved
test/FindNetHostDir.proj Outdated Show resolved Hide resolved
test/regpal/pal.cpp Outdated Show resolved Hide resolved
test/regpal/pal.cpp Outdated Show resolved Hide resolved
test/regpal/pal.cpp Outdated Show resolved Hide resolved
test/regperf/perf.cpp Outdated Show resolved Hide resolved
test/regperf/perf.cpp Outdated Show resolved Hide resolved
test/regperf/perf.cpp Outdated Show resolved Hide resolved
test/CMakeLists.txt Outdated Show resolved Hide resolved
test/regtest/main.cpp Outdated Show resolved Hide resolved
@jkoritzinsky jkoritzinsky merged commit f6e4b6c into AaronRobinsonMSFT:master Jan 26, 2024
12 checks passed
@jkoritzinsky jkoritzinsky deleted the no-dotnet-test branch January 26, 2024 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants