Skip to content

Commit

Permalink
IL test entry points should be in types so test discovery can occur. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronRobinsonMSFT authored Feb 4, 2024
1 parent d1f0e29 commit e1be9a7
Show file tree
Hide file tree
Showing 29 changed files with 1,564 additions and 1,447 deletions.
88 changes: 46 additions & 42 deletions src/tests/JIT/Directed/IL/PInvokeTail/PInvokeTail.il
Original file line number Diff line number Diff line change
Expand Up @@ -49,46 +49,50 @@
ret
} // end of global method 'callputs2'

.method public static int32 main() il managed
.class public auto ansi abstract sealed beforefieldinit PInvokeTail
extends [mscorlib]System.Object
{
.custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = (
01 00 00 00
)
.entrypoint
.maxstack 4
.locals init (char& pinned)

ldstr bytearray(48 65 6C 6C 6F 20 57 6F 72 6C 64 21 00 00 00 00) // "Hello World!"
call instance char& modreq([mscorlib]System.Runtime.InteropServices.InAttribute) [mscorlib]System.String::GetPinnableReference()
stloc.0

ldloc.0
call int32 callputs1(char&)
ldc.i4 0x0
bge PASS_1

call class [mscorlib]System.IO.TextWriter [System.Console]System.Console::get_Out()
ldstr "puts() failed"
callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string)
ldc.i4 0x1
ret

PASS_1:
ldloc.0
call int32 callputs2(char&)
ldc.i4 0x0
bge PASS_2

call class [mscorlib]System.IO.TextWriter [System.Console]System.Console::get_Out()
ldstr "puts() failed"
callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string)
ldc.i4 0x1
ret

PASS_2:
call class [mscorlib]System.IO.TextWriter [System.Console]System.Console::get_Out()
ldstr "Passed"
callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string)
ldc.i4 0x64
ret
} // end of global method 'main'
.method public static int32 main() il managed
{
.custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = (
01 00 00 00
)
.entrypoint
.maxstack 4
.locals init (char& pinned)

ldstr bytearray(48 65 6C 6C 6F 20 57 6F 72 6C 64 21 00 00 00 00) // "Hello World!"
call instance char& modreq([mscorlib]System.Runtime.InteropServices.InAttribute) [mscorlib]System.String::GetPinnableReference()
stloc.0

ldloc.0
call int32 callputs1(char&)
ldc.i4 0x0
bge PASS_1

call class [mscorlib]System.IO.TextWriter [System.Console]System.Console::get_Out()
ldstr "puts() failed"
callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string)
ldc.i4 0x1
ret

PASS_1:
ldloc.0
call int32 callputs2(char&)
ldc.i4 0x0
bge PASS_2

call class [mscorlib]System.IO.TextWriter [System.Console]System.Console::get_Out()
ldstr "puts() failed"
callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string)
ldc.i4 0x1
ret

PASS_2:
call class [mscorlib]System.IO.TextWriter [System.Console]System.Console::get_Out()
ldstr "Passed"
callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string)
ldc.i4 0x64
ret
} // end of global method 'main'
}
197 changes: 101 additions & 96 deletions src/tests/JIT/Directed/IL/PInvokeTail/tailwinapi.il
Original file line number Diff line number Diff line change
Expand Up @@ -98,102 +98,107 @@

//Global methods
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.method public static int32 main() il managed
{
.custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = (
01 00 00 00
)
.entrypoint
// Method begins at RVA 0x10c0
// Code size 241 (0xf1)
.maxstack 3
.locals (class [mscorlib]System.Text.StringBuilder V_0,
int32 V_1,
class TailWin32 V_2,
int32 V_3)

IL_0000: ldc.i4 0x100
IL_0005: newobj instance void [mscorlib]System.Text.StringBuilder::.ctor(int32)
IL_000a: stloc.0
IL_000b: ldc.i4 0x1
IL_0010: stloc.1
IL_0011: newobj instance void TailWin32::.ctor()
IL_0016: stloc.2
IL_0017: ldloc.0
IL_0018: ldc.i4 0x100
IL_001d: call unsigned int32 TailWin32::GetSystemDirectoryA(class [mscorlib]System.Text.StringBuilder,unsigned int32)
IL_0022: stloc.3
IL_0023: ldloc.0
IL_0024: castclass [mscorlib]System.Object
IL_0029: call void [System.Console]System.Console::WriteLine(class [mscorlib]System.Object)
IL_002e: ldloc.3
IL_002f: ldc.i4 0x0
IL_0034: bne.un IL_004e

IL_0039: ldstr "Call ansi API failed"//ldptr D_00003000
IL_003e: //newobj instance void [mscorlib]System.String::.ctor(wchar*)
IL_0043: call void [System.Console]System.Console::WriteLine(class [mscorlib]System.String)
IL_0048: ldc.i4 0x0
IL_004d: stloc.1
IL_004e: ldloc.2
IL_004f: ldloc.0
IL_0050: ldc.i4 0x100
IL_0055: call instance unsigned int32 TailWin32::GetSystemDirectory(class [mscorlib]System.Text.StringBuilder,unsigned int32)
IL_005a: stloc.3
IL_005b: ldloc.0
IL_005c: castclass [mscorlib]System.Object
IL_0061: call void [System.Console]System.Console::WriteLine(class [mscorlib]System.Object)
IL_0066: ldloc.3
IL_0067: ldc.i4 0x0
IL_006c: bne.un IL_0086

IL_0071: ldstr "Called unicode/ansi based." //ldptr D_00003030
IL_0076: //newobj instance void [mscorlib]System.String::.ctor(wchar*)
IL_007b: call void [System.Console]System.Console::WriteLine(class [mscorlib]System.String)
IL_0080: ldc.i4 0x0
IL_0085: stloc.1
IL_0086: ldloc.0
IL_0087: ldc.i4 0x100
IL_008c: call unsigned int32 TailWin32::GetSystemDirectoryAuto(class [mscorlib]System.Text.StringBuilder,unsigned int32)
IL_0091: stloc.3
IL_0092: ldloc.0
IL_0093: castclass [mscorlib]System.Object
IL_0098: call void [System.Console]System.Console::WriteLine(class [mscorlib]System.Object)
IL_009d: ldloc.3
IL_009e: ldc.i4 0x0
IL_00a3: bne.un IL_00bc

IL_00a8: ldstr "Call unicode/ansi" //ldptr D_000030A0
IL_00ad: //newobj instance void [mscorlib]System.String::.ctor(wchar*)
IL_00b2: call void [System.Console]System.Console::WriteLine(class [mscorlib]System.String)
IL_00b7: br IL_00dc

IL_00bc: ldloc.1
IL_00bd: ldc.i4 0x0
IL_00c2: beq IL_00dc

IL_00c7: ldstr "Passed" //ldptr D_000030EC
IL_00cc: //newobj instance void [mscorlib]System.String::.ctor(wchar*)
IL_00d1: call void [System.Console]System.Console::WriteLine(class [mscorlib]System.String)
IL_00d6: ldc.i4 0x64
IL_00db: ret

IL_00dc: ldstr "failed"//ldptr D_00003100
IL_00e1: //newobj instance void [mscorlib]System.String::.ctor(wchar*)
IL_00e6: call void [System.Console]System.Console::WriteLine(class [mscorlib]System.String)
IL_00eb: ldc.i4 0x1
IL_00f0: ret
} // end of global method 'main'

.method public static int32 _mainMSIL(int32 argc,int8** argv,int8** envp) il managed

.class public auto ansi abstract sealed beforefieldinit TailWinApi
extends [mscorlib]System.Object
{
// Method begins at RVA 0x11c0
// Code size 6 (0x6)
.maxstack 1
.method public static int32 main() il managed
{
.custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = (
01 00 00 00
)
.entrypoint
// Method begins at RVA 0x10c0
// Code size 241 (0xf1)
.maxstack 3
.locals (class [mscorlib]System.Text.StringBuilder V_0,
int32 V_1,
class TailWin32 V_2,
int32 V_3)

IL_0000: ldc.i4 0x100
IL_0005: newobj instance void [mscorlib]System.Text.StringBuilder::.ctor(int32)
IL_000a: stloc.0
IL_000b: ldc.i4 0x1
IL_0010: stloc.1
IL_0011: newobj instance void TailWin32::.ctor()
IL_0016: stloc.2
IL_0017: ldloc.0
IL_0018: ldc.i4 0x100
IL_001d: call unsigned int32 TailWin32::GetSystemDirectoryA(class [mscorlib]System.Text.StringBuilder,unsigned int32)
IL_0022: stloc.3
IL_0023: ldloc.0
IL_0024: castclass [mscorlib]System.Object
IL_0029: call void [System.Console]System.Console::WriteLine(class [mscorlib]System.Object)
IL_002e: ldloc.3
IL_002f: ldc.i4 0x0
IL_0034: bne.un IL_004e

IL_0039: ldstr "Call ansi API failed"//ldptr D_00003000
IL_003e: //newobj instance void [mscorlib]System.String::.ctor(wchar*)
IL_0043: call void [System.Console]System.Console::WriteLine(class [mscorlib]System.String)
IL_0048: ldc.i4 0x0
IL_004d: stloc.1
IL_004e: ldloc.2
IL_004f: ldloc.0
IL_0050: ldc.i4 0x100
IL_0055: call instance unsigned int32 TailWin32::GetSystemDirectory(class [mscorlib]System.Text.StringBuilder,unsigned int32)
IL_005a: stloc.3
IL_005b: ldloc.0
IL_005c: castclass [mscorlib]System.Object
IL_0061: call void [System.Console]System.Console::WriteLine(class [mscorlib]System.Object)
IL_0066: ldloc.3
IL_0067: ldc.i4 0x0
IL_006c: bne.un IL_0086

IL_0071: ldstr "Called unicode/ansi based." //ldptr D_00003030
IL_0076: //newobj instance void [mscorlib]System.String::.ctor(wchar*)
IL_007b: call void [System.Console]System.Console::WriteLine(class [mscorlib]System.String)
IL_0080: ldc.i4 0x0
IL_0085: stloc.1
IL_0086: ldloc.0
IL_0087: ldc.i4 0x100
IL_008c: call unsigned int32 TailWin32::GetSystemDirectoryAuto(class [mscorlib]System.Text.StringBuilder,unsigned int32)
IL_0091: stloc.3
IL_0092: ldloc.0
IL_0093: castclass [mscorlib]System.Object
IL_0098: call void [System.Console]System.Console::WriteLine(class [mscorlib]System.Object)
IL_009d: ldloc.3
IL_009e: ldc.i4 0x0
IL_00a3: bne.un IL_00bc

IL_00a8: ldstr "Call unicode/ansi" //ldptr D_000030A0
IL_00ad: //newobj instance void [mscorlib]System.String::.ctor(wchar*)
IL_00b2: call void [System.Console]System.Console::WriteLine(class [mscorlib]System.String)
IL_00b7: br IL_00dc

IL_00bc: ldloc.1
IL_00bd: ldc.i4 0x0
IL_00c2: beq IL_00dc

IL_00c7: ldstr "Passed" //ldptr D_000030EC
IL_00cc: //newobj instance void [mscorlib]System.String::.ctor(wchar*)
IL_00d1: call void [System.Console]System.Console::WriteLine(class [mscorlib]System.String)
IL_00d6: ldc.i4 0x64
IL_00db: ret

IL_00dc: ldstr "failed"//ldptr D_00003100
IL_00e1: //newobj instance void [mscorlib]System.String::.ctor(wchar*)
IL_00e6: call void [System.Console]System.Console::WriteLine(class [mscorlib]System.String)
IL_00eb: ldc.i4 0x1
IL_00f0: ret
} // end of global method 'main'

.method public static int32 _mainMSIL(int32 argc,int8** argv,int8** envp) il managed
{
// Method begins at RVA 0x11c0
// Code size 6 (0x6)
.maxstack 1

IL_0000: call int32 main()
IL_0005: ret
} // end of global method '_mainMSIL'
IL_0000: call int32 TailWinApi::main()
IL_0005: ret
} // end of global method '_mainMSIL'
}

.data D_00003000 = bytearray (
43 00 61 00 6C 00 6C 00 20 00 61 00 6E 00 73 00 // C.a.l.l. .a.n.s.
Expand All @@ -215,7 +220,7 @@
61 00 69 00 6C 00 65 00 64 00 00 00) // a.i.l.e.d...
.data D_000030EC = bytearray (
50 00 61 00 73 00 73 00 65 00 64 00 21 00 21 00 // P.a.s.s.e.d.!.!.
00 00 00 00)
00 00 00 00)
.data D_00003100 = bytearray (
46 00 61 00 69 00 6C 00 65 00 64 00 21 00 21 00 // F.a.i.l.e.d.!.!.
00 00)
00 00)
Loading

0 comments on commit e1be9a7

Please sign in to comment.