Skip to content

Commit 9d81462

Browse files
authored
Fix the only ilproj test that uses multiple command-line variants (#61750)
I believe that despite its singular nature this is worth a separate review to make sure we're in agreement regarding the conversion principles. There are several things worth noting here: 1) According to the current plan we're continuously documenting in #54512 we want to remove command-line parameters from all test entrypoints. Variant tests driven by command-line parameters should be turned into multiple test cases marked with separate [Fact] attributes. 2) For ilproj tests, to facilitate local debugging, our current plan is to keep them runnable as standalone executables. This implies that ilproj tests comprising several [Fact] test entrypoints require a new entrypoint that just calls into the individual test cases. 3) The Roslyn-generated merged wrapper for the tests won't care about the "composite" main (that is for local debugging only), it will directly identify and use the individual test cases marked with [Fact] attributes. 4) In accordance with this scheme, such composite ILPROJ tests are specific in not having their entrypoint method itself marked with the [Fact] attribute. 5) Funnily enough this example nicely demonstrates the implied cleanup - the entire command-line machinery is only used for a handwritten switch to choose one of the three variants; moreover we only exercised two out of the three variants, possibly due to an authoring bug when creating the variant test, potentially caused by previous complexity of such endeavor. Thanks Tomas
1 parent ca24ab0 commit 9d81462

File tree

3 files changed

+52
-27
lines changed

3 files changed

+52
-27
lines changed

src/tests/JIT/Regression/JitBlue/GitHub_26491/GitHub_26491.il

+52-17
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
// During the merge gtNewTempAssign does not expect the source value of TYP_SIMD16
2121
// and the destination value of TYP_STRUCT.
2222

23+
.assembly extern System.Console
24+
{
25+
}
26+
2327
.assembly extern System.Runtime
2428
{
2529
}
@@ -96,37 +100,68 @@
96100
IL_0009: ret
97101
}
98102

99-
.method public hidebysig static int32 Main(string[] args) cil managed
103+
.method public hidebysig static int32 MultipleReturns() cil managed
100104
{
101105
.custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = (
102106
01 00 00 00
103107
)
104-
.entrypoint
105-
.maxstack 8
106-
IL_0000: ldarg.0
107-
IL_0001: ldstr "MultipleReturns"
108-
IL_0006: call int32 [System.Runtime]System.Array::IndexOf<string>(!!0[], !!0)
109-
IL_000b: ldc.i4.m1
110-
IL_000c: beq.s IL_001b
111-
112108
IL_000e: ldc.i4 0x677b
113109
IL_0013: call valuetype GitHub_26491/ReturnType GitHub_26491::MultipleReturns(int32)
114110
IL_0018: pop
115-
IL_0019: br.s IL_0037
116-
117-
IL_001b: ldarg.0
118-
IL_001c: ldstr "SingleReturnSynchronized"
119-
IL_0021: call int32 [System.Runtime]System.Array::IndexOf<string>(!!0[], !!0)
120-
IL_0026: ldc.i4.m1
121-
IL_0027: beq.s IL_0031
111+
IL_0037: ldc.i4.s 100
112+
IL_0039: ret
113+
}
122114

115+
.method public hidebysig static int32 SingleReturnSynchronized() cil managed
116+
{
117+
.custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = (
118+
01 00 00 00
119+
)
123120
IL_0029: call valuetype GitHub_26491/ReturnType GitHub_26491::SingleReturnSynchronized()
124121
IL_002e: pop
125-
IL_002f: br.s IL_0037
122+
IL_0037: ldc.i4.s 100
123+
IL_0039: ret
124+
}
126125

126+
.method public hidebysig static int32 SingleReturn() cil managed
127+
{
128+
.custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = (
129+
01 00 00 00
130+
)
127131
IL_0031: call valuetype GitHub_26491/ReturnType GitHub_26491::SingleReturn()
128132
IL_0036: pop
129133
IL_0037: ldc.i4.s 100
130134
IL_0039: ret
131135
}
136+
137+
.method public hidebysig static int32 Main() cil managed
138+
{
139+
.entrypoint
140+
.maxstack 8
141+
142+
ldstr "MultipleReturns"
143+
call void [System.Console]System.Console::WriteLine(string)
144+
call int32 GitHub_26491::MultipleReturns()
145+
ldc.i4 100
146+
bne.un FAIL
147+
148+
ldstr "SingleReturnSynchronized"
149+
call void [System.Console]System.Console::WriteLine(string)
150+
call int32 GitHub_26491::SingleReturnSynchronized()
151+
ldc.i4 100
152+
bne.un FAIL
153+
154+
ldstr "SingleReturn"
155+
call void [System.Console]System.Console::WriteLine(string)
156+
call int32 GitHub_26491::SingleReturn()
157+
ldc.i4 100
158+
bne.un FAIL
159+
160+
ldc.i4 100
161+
ret
162+
163+
FAIL:
164+
ldc.i4 101
165+
ret
166+
}
132167
}

src/tests/JIT/Regression/JitBlue/GitHub_26491/GitHub_26491_MultipleReturns.ilproj src/tests/JIT/Regression/JitBlue/GitHub_26491/GitHub_26491.ilproj

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk.IL">
22
<PropertyGroup>
33
<OutputType>Exe</OutputType>
4-
<CLRTestExecutionArguments>MultipleReturns</CLRTestExecutionArguments>
54
</PropertyGroup>
65
<ItemGroup>
76
<Compile Include="GitHub_26491.il" />

src/tests/JIT/Regression/JitBlue/GitHub_26491/GitHub_26491_SingleReturnSynchronized.ilproj

-9
This file was deleted.

0 commit comments

Comments
 (0)