-
Notifications
You must be signed in to change notification settings - Fork 94
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
Added missing tests to kernel32 and DbgHelp. #249
Conversation
26faf0d
to
9c2fc46
Compare
Wait why doesn't the pipeline test ns2.0 as well so it can expose the failures on these when targeting that TFM? |
netstandard2.0 isn't a runtime. It's just a standard. Tests can only run on a runtime like .NET Core, .NET Framework, or mono. |
We don't want a test for every API to make sure it generated. We have tests for specific APIs that tend to be problematic and throw exceptions during generation, but ultimately those are redundant with our "generate everything" tests. Why do we need these new tests? |
Because a lot of those api's I added are technically some of the common ones I find that people want to use on the internet, myself included. Sure, one could use Plus there is an issue where the ProcessId returned from that class (from the I guess I could remove 3 of the tests but add them to the
And have |
9c2fc46
to
efe91d6
Compare
I see this is why I have my issue on my codebase not generating this enum:
Which is odd because it should be constant across all cpu specific builds of Windows 10 that has the latest dbghelp.dll. I think this should be rebased on top of #272 after that gets merged and see if that test starts to pass but change the other test to somehow test it being generated when it is set up correctly to be generating. |
These tests are to verify the generation issue on the functions tested in this code. Signed-off-by: AraHaan <seandhunt_7@yahoo.com>
efe91d6
to
89f1969
Compare
To be clear, I'm not arguing that we shouldn't generate those APIs. We do. I'm just saying they already have test coverage as part of the full-generation test. If we have a bug where certain APIs are simply missing in the generated code, then that's certainly worth taking a look at. It sounds like that's what you're saying, so I'll take another look. |
this.generator = new Generator(this.metadataStream, DefaultTestGeneratorOptions, this.compilation, this.parseOptions); | ||
Assert.True(this.generator.TryGenerate("MINIDUMP_TYPE", CancellationToken.None)); | ||
this.CollectGeneratedCode(this.generator); | ||
Assert.True(this.generator.TryGetEnumName("MINIDUMP_TYPE", out string? actualDeclaringEnum)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're using the wrong API here. TryGetEnumName
can't be used to verify that the enum is generated.
By adding this.AssertNoDiagnostics();
to the test the generated code is logged as test output and I see that the enum is in fact generated. So no bug here, it seems.
/// <summary> | ||
/// Verifies that MiniDumpWriteDump is generated. | ||
/// </summary> | ||
// TODO: Make test try to generate using x86, x64, arm, and arm64 instead of AnyCPU so that it passes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The trick here is to add this line to the top of your test:
this.compilation = this.compilation.WithOptions(this.compilation.Options.WithPlatform(Platform.X86));
With that, the test passes. So again, apparently no bug here.
"GetCurrentProcess", // A handle for the current process | ||
"GetCurrentProcessId", // An ID of the current process | ||
"GetCurrentThreadId")] // An ID of the current thread of the current process |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the value of testing these individually unless they provide a faster path to exposing an existing test failure in the FullGeneration
test.
Fixes #224
(Tests created on my Mac)