summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyungwoo Lee <kyulee@microsoft.com>2016-01-01 06:25:29 -0800
committerKyungwoo Lee <kyulee@microsoft.com>2016-01-01 06:31:57 -0800
commite380f2c2751ec539a1acd4cf0c027ab62d845328 (patch)
treede82e1e142cc4d93bc4bc9d095ee2c1ca4fc29ea
parenta9dc13887582351bcb2796b1be0c6a23ced07642 (diff)
downloadcoreclr-e380f2c2751ec539a1acd4cf0c027ab62d845328.tar.gz
coreclr-e380f2c2751ec539a1acd4cf0c027ab62d845328.tar.bz2
coreclr-e380f2c2751ec539a1acd4cf0c027ab62d845328.zip
Enable ilasm round trip test for xPlatforms
1. Enable CLRTest.Execute.Bash.targets similar to CLRTest.Execute.Batch.targets. 2. _IlasmSwitches uses '-' instead of '/' 3. Disable optimization on the prebuilt asmparse.c due to https://github.com/dotnet/coreclr/issues/2305
-rw-r--r--src/ilasm/CMakeLists.txt2
-rw-r--r--tests/src/CLRTest.Execute.Bash.targets64
-rw-r--r--tests/src/IL.targets14
3 files changed, 63 insertions, 17 deletions
diff --git a/src/ilasm/CMakeLists.txt b/src/ilasm/CMakeLists.txt
index eb84533770..bd7934965f 100644
--- a/src/ilasm/CMakeLists.txt
+++ b/src/ilasm/CMakeLists.txt
@@ -25,11 +25,13 @@ set_source_files_properties( prebuilt/asmparse.c PROPERTIES LANGUAGE CXX )
if(CLR_CMAKE_PLATFORM_UNIX)
add_compile_options(-x c++)
# Need generate a right form of asmparse.c to avoid the following options.
+ # Clang also produces a bad-codegen on this prebuilt file with optimization.
# https://github.com/dotnet/coreclr/issues/2305
add_compile_options(-Wno-delete-non-virtual-dtor)
add_compile_options(-Wno-deprecated-register)
add_compile_options(-Wno-array-bounds)
add_compile_options(-Wno-unused-label)
+ set_source_files_properties( prebuilt/asmparse.c PROPERTIES COMPILE_FLAGS -O0 )
endif(CLR_CMAKE_PLATFORM_UNIX)
add_executable(ilasm
diff --git a/tests/src/CLRTest.Execute.Bash.targets b/tests/src/CLRTest.Execute.Bash.targets
index f0543f714a..042aa8b7da 100644
--- a/tests/src/CLRTest.Execute.Bash.targets
+++ b/tests/src/CLRTest.Execute.Bash.targets
@@ -52,6 +52,41 @@ fi
</PropertyGroup>
</Target>
+ <Target
+ Name="GetIlasmRoundTripBashScript"
+ Returns="$(IlasmRoundTripBashScript)">
+ <PropertyGroup>
+ <InputAssemblyName Condition="'$(CLRTestKind)' == 'RunOnly'">$([MSBuild]::MakeRelative($(OutputPath), $(_CLRTestToRunFileFullPath)).Replace("\","/"))</InputAssemblyName>
+ <InputAssemblyName Condition="'$(CLRTestKind)' == 'BuildAndRun'">$(MSBuildProjectName).exe</InputAssemblyName>
+ <DisassemblyName>$(MSBuildProjectName).dasm.il</DisassemblyName>
+ <TargetAssemblyName>$(MSBuildProjectName).asm.exe</TargetAssemblyName>
+
+ <IlasmRoundTrip Condition="'$(ReferenceLocalMscorlib)'!=''">false</IlasmRoundTrip>
+
+ <IlasmRoundTripBashScript Condition="'$(IlasmRoundTrip)'=='true'">
+ <![CDATA[
+echo "$CORE_ROOT/ildasm" -raweh -out=$(DisassemblyName) $(InputAssemblyName)
+"$CORE_ROOT/ildasm" -raweh -out=$(DisassemblyName) $(InputAssemblyName)
+_ERRORLEVEL=$?
+if [ ! $ERRORLEVEL == 0 ]
+then
+ echo EXECUTION OF ILDASM - FAILED $ERRORLEVEL
+ exit 1
+fi
+
+echo "$CORE_ROOT/ilasm" -output=$(TargetAssemblyName) $(_IlasmSwitches) $(DisassemblyName)
+"$CORE_ROOT/ilasm" -output=$(TargetAssemblyName) $(_IlasmSwitches) $(DisassemblyName)
+_ERRORLEVEL=$?
+if [ ! $ERRORLEVEL == 0 ]
+then
+ echo EXECUTION OF ILASM - FAILED $ERRORLEVEL
+ exit 1
+fi
+ ]]>
+ </IlasmRoundTripBashScript>
+ </PropertyGroup>
+ </Target>
+
<!-- This is here because of this bug: http://blogs.msdn.com/b/msbuild/archive/2006/01/03/508629.aspx-->
<Target Name="FetchExternalProperties">
<!--Call GetExecuteShFullPath to get ToRunProject cmd file Path -->
@@ -95,7 +130,7 @@ fi
<Target Name="GenerateBashExecutionScript"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(OutputPath)\$(MSBuildProjectName).sh"
- DependsOnTargets="FetchExternalProperties;GetCrossgenBashScript">
+ DependsOnTargets="FetchExternalProperties;GetCrossgenBashScript;GetIlasmRoundTripBashScript">
<Message Text="Project depends on $(_CLRTestToRunFileFullPath)." Condition="'$(_CLRTestNeedsProjectToRun)' == 'True'" />
@@ -148,15 +183,22 @@ fi
</ItemGroup>
<PropertyGroup>
- <_CLRTestRunFile Condition="'$(_CLRTestNeedsProjectToRun)' == 'true'">$(_CLRTestToRunFileFullPath)</_CLRTestRunFile>
- <_CLRTestRunFile Condition=" '$(CLRTestIsHosted)'=='true' AND $(_CLRTestNeedsProjectToRun) ">"$CORE_ROOT/corerun" $([MSBuild]::MakeRelative($(OutputPath), $(_CLRTestToRunFileFullPath)).Replace("\","/"))</_CLRTestRunFile>
-
- <_CLRTestRunFile Condition="'$(_CLRTestNeedsProjectToRun)' == 'false'">"$(MSBuildProjectName).exe"</_CLRTestRunFile>
- <_CLRTestRunFile Condition=" '$(CLRTestIsHosted)'=='true' AND !$(_CLRTestNeedsProjectToRun) ">"$CORE_ROOT/corerun" $(_CLRTestRunFile)</_CLRTestRunFile>
+ <_CLRTestRunFile Condition="'$(CLRTestIsHosted)'=='true'">"$CORE_ROOT/corerun"</_CLRTestRunFile>
+ <BashCLRTestLaunchCmds Condition="'$(IlasmRoundTrip)'=='true'"><![CDATA[
+echo $(_CLRTestRunFile) $(TargetAssemblyName) $CLRTestExecutionArguments $Host_Args
+$(_CLRTestRunFile) $(TargetAssemblyName) $CLRTestExecutionArguments $Host_Args
+if [ ! $? == $CLRTestExpectedExitCode ]
+then
+ echo END EXECUTION OF IL{D}ASM BINARY - FAILED $? vs $CLRTestExpectedExitCode
+ echo FAILED
+ exit 1
+fi
+ ]]></BashCLRTestLaunchCmds>
- <BashCLRTestLaunchCmds Condition=" '$(BashCLRTestLaunchCmds)'=='' "><![CDATA[
-echo $(_CLRTestRunFile) $CLRTestExecutionArguments $Host_Args
-$_DebuggerFullPath $(_CLRTestRunFile) $CLRTestExecutionArguments $Host_Args
+ <BashCLRTestLaunchCmds><![CDATA[
+$(BashCLRTestLaunchCmds)
+echo $_DebuggerFullPath $(_CLRTestRunFile) $(InputAssemblyName) $CLRTestExecutionArguments $Host_Args
+$_DebuggerFullPath $(_CLRTestRunFile) $(InputAssemblyName) $CLRTestExecutionArguments $Host_Args
CLRTestExitCode=$?
]]></BashCLRTestLaunchCmds>
</PropertyGroup>
@@ -232,6 +274,8 @@ $(BashCLRTestArgPrep)
$(BashCLRTestExitCodePrep)
# CrossGen Script (when /p:CrossGen=true)
$(CrossgenBashScript)
+# IlasmRoundTrip Script
+$(IlasmRoundTripBashScript)
# PreCommands
$(_BashCLRTestPreCommands)
# Launch
@@ -255,4 +299,4 @@ $(BashCLRTestExitCodeCheck)
Overwrite="true" />
</Target>
-</Project> \ No newline at end of file
+</Project>
diff --git a/tests/src/IL.targets b/tests/src/IL.targets
index e85d9695d8..e2be21742d 100644
--- a/tests/src/IL.targets
+++ b/tests/src/IL.targets
@@ -13,13 +13,13 @@
<PropertyGroup>
<_OutputTypeArgument Condition="'$(OutputType)' == 'Library'">/DLL</_OutputTypeArgument>
<_OutputTypeArgument Condition="'$(OutputType)' == 'Exe'">/EXE</_OutputTypeArgument>
- <_IlasmSwitches>/QUIET /NOLOGO</_IlasmSwitches>
- <_IlasmSwitches Condition="'$(FoldIdenticalMethods)' == 'True'">$(_IlasmSwitches) /FOLD</_IlasmSwitches>
- <_IlasmSwitches Condition="'$(SizeOfStackReserve)' != ''">$(_IlasmSwitches) /STACK=$(SizeOfStackReserve)</_IlasmSwitches>
- <_IlasmSwitches Condition="'$(DebugType)' == 'Full'">$(_IlasmSwitches) /DEBUG</_IlasmSwitches>
- <_IlasmSwitches Condition="'$(DebugType)' == 'Impl'">$(_IlasmSwitches) /DEBUG=IMPL</_IlasmSwitches>
- <_IlasmSwitches Condition="'$(DebugType)' == 'PdbOnly'">$(_IlasmSwitches) /DEBUG=OPT</_IlasmSwitches>
- <_IlasmSwitches Condition="'$(Optimize)' == 'True'">$(_IlasmSwitches) /OPTIMIZE</_IlasmSwitches>
+ <_IlasmSwitches>-QUIET -NOLOGO</_IlasmSwitches>
+ <_IlasmSwitches Condition="'$(FoldIdenticalMethods)' == 'True'">$(_IlasmSwitches) -FOLD</_IlasmSwitches>
+ <_IlasmSwitches Condition="'$(SizeOfStackReserve)' != ''">$(_IlasmSwitches) -STACK=$(SizeOfStackReserve)</_IlasmSwitches>
+ <_IlasmSwitches Condition="'$(DebugType)' == 'Full'">$(_IlasmSwitches) -DEBUG</_IlasmSwitches>
+ <_IlasmSwitches Condition="'$(DebugType)' == 'Impl'">$(_IlasmSwitches) -DEBUG=IMPL</_IlasmSwitches>
+ <_IlasmSwitches Condition="'$(DebugType)' == 'PdbOnly'">$(_IlasmSwitches) -DEBUG=OPT</_IlasmSwitches>
+ <_IlasmSwitches Condition="'$(Optimize)' == 'True'">$(_IlasmSwitches) -OPTIMIZE</_IlasmSwitches>
</PropertyGroup>
<Exec Command="$(__BinDir)\ilasm $(_OutputTypeArgument) /OUTPUT=@(IntermediateAssembly) $(_IlasmSwitches) @(Compile)">