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

DLL Runner #65

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

OskiKervinen-MF
Copy link
Contributor

@OskiKervinen-MF OskiKervinen-MF commented Feb 8, 2023

I feel like I wrote this message already a while back, but I can't find it anywhere, so maybe I forgot to send it? Sorry for the redundancy if I just didn't find the previous instance.

When making #63 I tried to be generic in hopes of getting the change upstream. In the discussion there, it sounds like you have your own vision of supporting the DLL use case, and won't be accepting my approach. Instead, you recommended using a private fork until the upstream supports this case. With that in view, I implemented the functionality in a less generic way, more precisely suited for our needs. This MR contains that implementation. I don't necessarily expect you to merge this, but thought it may be useful as a reference.

The idea here is to explicitly support using an executable wrapper to run the tests when the original source is a DLL file.

Includes the changes from #64 because I'll redistribute the fork via NuGet.

* End assembly file name in .TestAdapter to make VS recognize
  it from a nuget package.
* Create Catch2TestAdapter.nuspec to configure the nuget package.
  I tried embedding the nuget metadata in the project, but could
  not get it to support the exotic combination of having .NET
  assemblies that are meant to be installed in a native project.

See https://github.com/microsoft/vstest/blob/main/docs/RFCs/0004-Adapter-Extensibility.md
Command to generate the package:
`nuget pack .\Catch2TestAdapter.csproj -Version 1.8.0 -IncludeReferencedProjects -p Configuration=Debug`
When Catch2 tests are embedded in a DLL, they cannot be run by directly
running the output itself. Instead some kind of wrapper executable
must be used. The way such wrappers invoke the tests in the DLL
is a project-specific matter, so such a system requires that
the wrapper and its command line parameters are configurable.

This MR achieves this with two additional settings:
* `DllExecutor`, a path to the executable to run tests
  in DLL:s with.
* `DllExecutorCommandLine`, the command line parameters passed
  to the executor to run the tests inside some Source DLL.
@JohnnyHendriks
Copy link
Owner

Thank you for your effort. This is useful. Didn't think of making it available as a NuGet package as I associate that with the C# world, not the C++ world. Something for me to look into.

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