diff --git a/src/tests/Common/CLRTest.Jit.targets b/src/tests/Common/CLRTest.Jit.targets
index 729d588e5337eb..745d3e96c9d3a4 100644
--- a/src/tests/Common/CLRTest.Jit.targets
+++ b/src/tests/Common/CLRTest.Jit.targets
@@ -337,6 +337,11 @@ def is_managed_exe_assembly(file):
print("")
print("ILASM RoundTrips")
+if os.environ.get("IlasmRoundTripUseManagedIlasm") == "1":
+ ilasm_path = os.path.join(os.environ["CORE_ROOT"], "managed-ilasm", "ilasm")
+else:
+ ilasm_path = os.path.join(os.environ["CORE_ROOT"], "ilasm")
+
if not os.path.exists("IL-RT"):
os.mkdir("IL-RT")
@@ -367,7 +372,11 @@ for inputAssemblyName in glob.glob("*.dll"):
proc.kill()
sys.exit(1)
- ilasm_args = f'{os.environ["CORE_ROOT"]}/ilasm -output={inputAssemblyName} {ilasmSwitches} {disassemblyName}'
+ if proc.returncode != 0:
+ print(f"ILDASM failed with exit code {proc.returncode}")
+ sys.exit(1)
+
+ ilasm_args = f'{ilasm_path} -output={inputAssemblyName} {ilasmSwitches} {disassemblyName}'
print(ilasm_args)
proc = subprocess.Popen(ilasm_args, shell=True)
@@ -377,63 +386,76 @@ for inputAssemblyName in glob.glob("*.dll"):
proc.kill()
sys.exit(1)
- test_det = proc.returncode == 0
+ if proc.returncode != 0:
+ print(f"ILASM failed with exit code {proc.returncode}")
+ sys.exit(1)
# Test determinism
- if test_det:
- hash = hash_file(inputAssemblyName)
+ hash = hash_file(inputAssemblyName)
- ilasm_args = f'{os.environ["CORE_ROOT"]}/ilasm -output={inputAssemblyName} {ilasmSwitches} {disassemblyName}'
- print(ilasm_args)
- proc = subprocess.Popen(ilasm_args, shell=True)
+ ilasm_args = f'{ilasm_path} -output={inputAssemblyName} {ilasmSwitches} {disassemblyName}'
+ print(ilasm_args)
+ proc = subprocess.Popen(ilasm_args, shell=True)
- try:
- proc.communicate()
- except:
- proc.kill()
- sys.exit(1)
+ try:
+ proc.communicate()
+ except:
+ proc.kill()
+ sys.exit(1)
- if hash != hash_file(inputAssemblyName):
- print("ILASM determinism failed")
+ if proc.returncode != 0:
+ print(f"ILASM failed with exit code {proc.returncode}")
sys.exit(1)
- else:
- print("ILASM determinism succeeded")
- # Test PDB determinism
+ if hash != hash_file(inputAssemblyName):
+ print("ILASM determinism failed")
+ sys.exit(1)
+ else:
+ print("ILASM determinism succeeded")
- if not is_managed_debug_assembly(inputAssemblyName):
- ilasmSwitches = ilasmSwitches + " -DEBUG"
+ # Test PDB determinism
- pdbName = inputAssemblyName.replace('.dll', '.pdb')
+ if not is_managed_debug_assembly(inputAssemblyName):
+ ilasmSwitches = ilasmSwitches + " -DEBUG"
+
+ pdbName = inputAssemblyName.replace('.dll', '.pdb')
+
+ ilasm_args = f'{ilasm_path} -output={pdbName} {ilasmSwitches} {disassemblyName}'
+ print(ilasm_args)
+ proc = subprocess.Popen(ilasm_args, shell=True)
- ilasm_args = f'{os.environ["CORE_ROOT"]}/ilasm -output={pdbName} {ilasmSwitches} {disassemblyName}'
- print(ilasm_args)
- proc = subprocess.Popen(ilasm_args, shell=True)
+ try:
+ proc.communicate()
+ except:
+ proc.kill()
+ sys.exit(1)
- try:
- proc.communicate()
- except:
- proc.kill()
- sys.exit(1)
+ if proc.returncode != 0:
+ print(f"ILASM failed with exit code {proc.returncode}")
+ sys.exit(1)
- hash = hash_file(pdbName)
+ hash = hash_file(pdbName)
- ilasm_args = f'{os.environ["CORE_ROOT"]}/ilasm -output={pdbName} {ilasmSwitches} {disassemblyName}'
- print(ilasm_args)
- proc = subprocess.Popen(ilasm_args, shell=True)
+ ilasm_args = f'{ilasm_path} -output={pdbName} {ilasmSwitches} {disassemblyName}'
+ print(ilasm_args)
+ proc = subprocess.Popen(ilasm_args, shell=True)
- try:
- proc.communicate()
- except:
- proc.kill()
- sys.exit(1)
+ try:
+ proc.communicate()
+ except:
+ proc.kill()
+ sys.exit(1)
- if hash != hash_file(pdbName):
- print("ILASM PDB determinism failed")
+ if proc.returncode != 0:
+ print(f"ILASM failed with exit code {proc.returncode}")
sys.exit(1)
- else:
- print("ILASM PDB determinism succeeded")
+
+ if hash != hash_file(pdbName):
+ print("ILASM PDB determinism failed")
+ sys.exit(1)
+ else:
+ print("ILASM PDB determinism succeeded")
print("")
diff --git a/src/tests/Common/testenvironment.proj b/src/tests/Common/testenvironment.proj
index eaab9898e1d34a..5b1e224c4fa6a7 100644
--- a/src/tests/Common/testenvironment.proj
+++ b/src/tests/Common/testenvironment.proj
@@ -7,8 +7,10 @@
-
@@ -66,6 +68,7 @@
DOTNET_JitForceControlFlowGuard;
DOTNET_JitCFGUseDispatcher;
RunningIlasmRoundTrip;
+ IlasmRoundTripUseManagedIlasm;
DOTNET_JitSynthesizeCounts;
DOTNET_JitCheckSynthesizedCounts;
DOTNET_JitRLCSEGreedy;
@@ -191,6 +194,7 @@
+
diff --git a/src/tests/Interop/IJW/Directory.Build.props b/src/tests/Interop/IJW/Directory.Build.props
index 6faba48234f19a..1b150028e2807b 100644
--- a/src/tests/Interop/IJW/Directory.Build.props
+++ b/src/tests/Interop/IJW/Directory.Build.props
@@ -11,6 +11,8 @@
true
true
+
+ true
diff --git a/src/tests/JIT/jit64/opt/cse/hugeexpr1.csproj b/src/tests/JIT/jit64/opt/cse/hugeexpr1.csproj
index 5bca68ddc4bcfd..3def7a12428f17 100644
--- a/src/tests/JIT/jit64/opt/cse/hugeexpr1.csproj
+++ b/src/tests/JIT/jit64/opt/cse/hugeexpr1.csproj
@@ -5,6 +5,8 @@
true
true
+
+ true
Full
diff --git a/src/tests/Loader/classloader/MethodImpl/InternalMethodImplTest.csproj b/src/tests/Loader/classloader/MethodImpl/InternalMethodImplTest.csproj
index c17f6a7f838561..e09dc84afd9fa2 100644
--- a/src/tests/Loader/classloader/MethodImpl/InternalMethodImplTest.csproj
+++ b/src/tests/Loader/classloader/MethodImpl/InternalMethodImplTest.csproj
@@ -1,4 +1,9 @@
+
+
+ true
+ true
+
diff --git a/src/tests/Loader/classloader/regressions/dev10_403582/dev10_403582.ilproj b/src/tests/Loader/classloader/regressions/dev10_403582/dev10_403582.ilproj
index 579e65d4199b66..7340d29ea37a26 100644
--- a/src/tests/Loader/classloader/regressions/dev10_403582/dev10_403582.ilproj
+++ b/src/tests/Loader/classloader/regressions/dev10_403582/dev10_403582.ilproj
@@ -1,10 +1,12 @@
-
+
true
1
true
+
+ true
diff --git a/src/tests/run.cmd b/src/tests/run.cmd
index f8aeda3a9ea99a..a1b60649ecf102 100644
--- a/src/tests/run.cmd
+++ b/src/tests/run.cmd
@@ -28,6 +28,7 @@ set __msbuildExtraArgs=
set __LongGCTests=
set __GCSimulatorTests=
set __IlasmRoundTrip=
+set __UseManagedIlasm=
set __PrintLastResultsOnly=
set LogsDirArg=
set RunInUnloadableContext=
@@ -73,6 +74,7 @@ if /i "%1" == "gcstresslevel" (set DOTNET_GCStress=%2&
if /i "%1" == "gcsimulator" (set __GCSimulatorTests=1&shift&goto Arg_Loop)
if /i "%1" == "longgc" (set __LongGCTests=1&shift&goto Arg_Loop)
if /i "%1" == "ilasmroundtrip" (set __IlasmRoundTrip=1&shift&goto Arg_Loop)
+if /i "%1" == "usemanagedilasm" (set __IlasmRoundTrip=1&set __UseManagedIlasm=1&shift&goto Arg_Loop)
if /i "%1" == "timeout" (set __TestTimeout=%2&shift&shift&goto Arg_Loop)
if /i "%1" == "runincontext" (set RunInUnloadableContext=1&shift&goto Arg_Loop)
if /i "%1" == "tieringtest" (set TieringTest=1&shift&goto Arg_Loop)
@@ -152,6 +154,10 @@ if defined __IlasmRoundTrip (
set __RuntestPyArgs=%__RuntestPyArgs% --ilasmroundtrip
)
+if defined __UseManagedIlasm (
+ set __RuntestPyArgs=%__RuntestPyArgs% --use_managed_ilasm
+)
+
if defined __TestEnv (
set __RuntestPyArgs=%__RuntestPyArgs% -test_env %__TestEnv%
)
diff --git a/src/tests/run.py b/src/tests/run.py
index 1cfc74d4c6ec51..7fb32639f11a45 100755
--- a/src/tests/run.py
+++ b/src/tests/run.py
@@ -101,6 +101,7 @@
parser.add_argument("--long_gc", dest="long_gc", action="store_true", default=False)
parser.add_argument("--gcsimulator", dest="gcsimulator", action="store_true", default=False)
parser.add_argument("--ilasmroundtrip", dest="ilasmroundtrip", action="store_true", default=False)
+parser.add_argument("--use_managed_ilasm", dest="use_managed_ilasm", action="store_true", default=False)
parser.add_argument("--run_crossgen2_tests", dest="run_crossgen2_tests", action="store_true", default=False)
parser.add_argument("--large_version_bubble", dest="large_version_bubble", action="store_true", default=False)
parser.add_argument("--synthesize_pgo", dest="synthesize_pgo", action="store_true", default=False)
@@ -829,6 +830,15 @@ def run_tests(args,
print("Setting RunningIlasmRoundTrip=1")
os.environ["RunningIlasmRoundTrip"] = "1"
+ if args.use_managed_ilasm:
+ if not args.ilasmroundtrip:
+ print("--use_managed_ilasm implies --ilasmroundtrip; enabling ilasm round trip.")
+ print("Setting RunningIlasmRoundTrip=1")
+ os.environ["RunningIlasmRoundTrip"] = "1"
+ print("Using managed ILasm for round trip.")
+ print("Setting IlasmRoundTripUseManagedIlasm=1")
+ os.environ["IlasmRoundTripUseManagedIlasm"] = "1"
+
if args.run_crossgen2_tests:
print("Running tests R2R (Crossgen2)")
print("Setting RunCrossGen2=1")
@@ -978,6 +988,11 @@ def setup_args(args):
lambda arg: True,
"Error setting ilasmroundtrip")
+ coreclr_setup_args.verify(args,
+ "use_managed_ilasm",
+ lambda arg: True,
+ "Error setting use_managed_ilasm")
+
coreclr_setup_args.verify(args,
"large_version_bubble",
lambda arg: True,