Validate with -testUsedAssemblies in a CI leg#60052
Conversation
| $env:ROSLYN_TEST_EMITDIAGNOSTICS = "true" | ||
| } | ||
|
|
||
| if ($testUsedAssemblies) { |
There was a problem hiding this comment.
@AlekseyTs Should we enable testUsedAssemblies in a CI leg? Seems like it's unused at the moment. #Closed
There was a problem hiding this comment.
Should we enable testUsedAssemblies in a CI leg? Seems like it's unused at the moment.
I think it would be good to add a separate CI leg similar to the one used for IOperation testing.
There was a problem hiding this comment.
Okay. Let's keep that separate (there's a few questions, such as choosing a leg, how to deal with potential failures that might have snuck in).
Filed tracking issue.
Towards that goal, this PR fixes an issue with TestRunner that makes sure we copy environment variables to Helix machines where tests end up running.
There was a problem hiding this comment.
I think we should consider whether to group this set of "additional validation" flags into a single leg or to have separate legs. Recently we are trying to be sensitive about number of test legs introduced because:
- Each time we additionally run the tests increases the rate of spurious failures.
- Cost of provisioning the additional machines.
See #57313.
|
@cston @RikkiGibson @dotnet/roslyn-compiler for review. Thanks |
RikkiGibson
left a comment
There was a problem hiding this comment.
Implementation looks good, but perhaps consideration from the team is required to decide whether to do this validation in the existing job or in a new job.
|
|
||
| static void transferEnvironmentVariable(StringBuilder command, string setEnvironmentVariable, string variableName) | ||
| { | ||
| if (Environment.GetEnvironmentVariable(variableName) is string iop) |
There was a problem hiding this comment.
Consider inlining. #Resolved
| } | ||
| "; | ||
| var compilation = CreateCompilation(source).VerifyDiagnostics(); | ||
| // We use VerifyDiagnosticsOnly until this issue is fixed: |
There was a problem hiding this comment.
Should we get emit diagnostics anyway and assert about the nature of the failure? I'm concerned that emit bugs may be inadvertently fixed without related test baselines getting updated, resulting in either introduction of redundant tests or reduced test coverage of the fix. Similar to the issue that comes up when 'Skip' is used in tests. #WontFix
There was a problem hiding this comment.
I agree that skipped and conditional tests could drift, but conditional tests on NoUsedAssembliesValidation and NoIOperationValidation are how we deal with problematic tests in those CI legs at the moment. I'd rather not revisit that for purpose of this PR
| $env:ROSLYN_TEST_EMITDIAGNOSTICS = "true" | ||
| } | ||
|
|
||
| if ($testUsedAssemblies) { |
There was a problem hiding this comment.
I think we should consider whether to group this set of "additional validation" flags into a single leg or to have separate legs. Recently we are trying to be sensitive about number of test legs introduced because:
- Each time we additionally run the tests increases the rate of spurious failures.
- Cost of provisioning the additional machines.
See #57313.
-testUsedAssemblies in a CI leg
|
FYI @jmarolf From discussion with Rikki and team, we're adding a new CI leg (debug, core, compiler tests only, with some additional validation added to every compiler test for used assemblies and emit diagnostics). |
azure-pipelines.yml
Outdated
| configuration: Debug | ||
| testArguments: -testCoreClr -testIOperation -testCompilerOnly | ||
|
|
||
| template: eng/pipelines/test-windows-job.yml |
There was a problem hiding this comment.
template: eng/pipelines/test-windows-job.yml
Consider adding a comment here explaining why this job is diff than others. #Resolved
|
|
||
| if ($testUsedAssemblies) { | ||
| Remove-Item env:\ROSLYN_TEST_USEDASSEMBLIES | ||
| } |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s), but failed to run 1 pipeline(s). |
415a6d8 to
5c16f6d
Compare
| } | ||
|
|
||
| [Fact] | ||
| [ConditionalFact(typeof(NoUsedAssembliesValidation))] // Tracked by https://github.com/dotnet/roslyn/issues/60045 |
There was a problem hiding this comment.
Why do you use comments here vs. putting the URL into the Reason property? #Resolved
There was a problem hiding this comment.
Not much reason. Either one works
There was a problem hiding this comment.
One appears in the test logs, one does not 🙂.
Co-authored-by: Jared Parsons <jaredpparsons@gmail.com>
azure-pipelines.yml
Outdated
| - template: eng/pipelines/test-windows-job.yml | ||
| parameters: | ||
| testRunName: 'Test Windows CoreCLR TestUsedAssemblies Debug' | ||
| jobName: Test_Windows_CoreClr_TestUsedAssemblies_Debug |
There was a problem hiding this comment.
nit: would change TestUsedAssemblies to UsedAssemblies here and in 'testRunName'. #Resolved
| } | ||
|
|
||
| [Fact] | ||
| [ConditionalFact(typeof(NoUsedAssembliesValidation))] // Tracked by https://github.com/dotnet/roslyn/issues/60046 |
There was a problem hiding this comment.
I see that 'VerifyDiagnosticsOnly' was removed and replaced with ConditionalFact. I would prefer if we didn't skip tests or make them conditional. Ideally, if the underlying bug were fixed here, this test would start failing, forcing us to update, which will end up preventing test duplication.
We could consider capturing the fact that an assertion fails in debug mode with the following pattern:
comp.VerifyDiagnosticsOnly(...);
#if DEBUG
Assert.Throws<InvalidOperationException(() => comp.VerifyEmitDiagnostics());
#endif
This identified a few issues tests that assert or throw when
GetEmitDiagnostics()is called: VoidEvent, NullCoalescingOperatorWithTupleNames, ExternAliases4, CrossAssemblySupportingAndNotSupportingCovariantReturns, TestNullCoalesce_DynamicVerified the validation fails as expected with a canary.
Fixes #60086