summaryrefslogtreecommitdiff
path: root/tests/src
diff options
context:
space:
mode:
authorSwaroop Sridhar <swaroops@microsoft.com>2017-03-22 18:09:05 -0700
committerSwaroop Sridhar <Swaroop.Sridhar@microsoft.com>2017-03-28 11:31:25 -0700
commit5f05a462321923ee6d9975cc3f88a233b3143332 (patch)
tree7a5d5fac3e1aa0166bc0702be2cdc075f3f335a6 /tests/src
parentc9a0d6d510e92dc4ebd4b78f766c706abce0a9af (diff)
downloadcoreclr-5f05a462321923ee6d9975cc3f88a233b3143332.tar.gz
coreclr-5f05a462321923ee6d9975cc3f88a233b3143332.tar.bz2
coreclr-5f05a462321923ee6d9975cc3f88a233b3143332.zip
Add support for CoreCLR testing via ILLINK on Linux
Made changes to the test infrastructure to 1) Generate <test>.sh with commands to invoke ILLINK and run the output 2) Add runtest.sh --link=<path-to-illink> to invoke the ILLINK testing
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/CLRTest.Execute.Bash.targets146
-rw-r--r--tests/src/CLRTest.Execute.Batch.targets8
2 files changed, 125 insertions, 29 deletions
diff --git a/tests/src/CLRTest.Execute.Bash.targets b/tests/src/CLRTest.Execute.Bash.targets
index 4471055e57..4f5cee8949 100644
--- a/tests/src/CLRTest.Execute.Bash.targets
+++ b/tests/src/CLRTest.Execute.Bash.targets
@@ -29,23 +29,29 @@ WARNING: When setting properties based on their current state (for example:
<IlasmRoundTripBashScript Condition="'$(IlasmRoundTrip)'=='true'">
<![CDATA[
-echo "$CORE_ROOT/ildasm" -raweh -out=$(DisassemblyName) $(InputAssemblyName)
-"$CORE_ROOT/ildasm" -raweh -out=$(DisassemblyName) $(InputAssemblyName)
-ERRORLEVEL=$?
-if [ $ERRORLEVEL -ne 0 ]
+# Disable Ilasm round-tripping for Linker tests.
+# Todo: Ilasm round-trip on linked binaries.
+
+if [ -z "$DoLink" ];
then
- echo EXECUTION OF ILDASM - FAILED $ERRORLEVEL
- exit 1
-fi
+ echo "$CORE_ROOT/ildasm" -raweh -out=$(DisassemblyName) $(InputAssemblyName)
+ "$CORE_ROOT/ildasm" -raweh -out=$(DisassemblyName) $(InputAssemblyName)
+ ERRORLEVEL=$?
+ if [ $ERRORLEVEL -ne 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 -ne 0 ]
-then
- echo EXECUTION OF ILASM - FAILED $ERRORLEVEL
- exit 1
-fi
+ echo "$CORE_ROOT/ilasm" -output=$(TargetAssemblyName) $(_IlasmSwitches) $(DisassemblyName)
+ "$CORE_ROOT/ilasm" -output=$(TargetAssemblyName) $(_IlasmSwitches) $(DisassemblyName)
+ ERRORLEVEL=$?
+ if [ $ERRORLEVEL -ne 0 ]
+ then
+ echo EXECUTION OF ILASM - FAILED $ERRORLEVEL
+ exit 1
+ fi
+fi
]]>
</IlasmRoundTripBashScript>
</PropertyGroup>
@@ -181,25 +187,113 @@ fi
</BashCLRTestExecutionScriptArgument>
</ItemGroup>
+ <PropertyGroup>
+ <ReflectionRootsXml>$(MSBuildProjectName).reflect.xml</ReflectionRootsXml>
+ <BashLinkerTestLaunchCmds>
+ <![CDATA[
+# Linker commands
+
+LinkBin=__Link
+Assemblies="-a System.Private.CoreLib"
+ReflectionRoots=
+
+shopt -s nullglob
+
+if [ ! -z "$DoLink" ];
+then
+ if [ ! -x "$ILLINK" ];
+ then
+ echo "Illink executable [$ILLINK] Invalid"
+ exit 1
+ fi
+
+ # Clean up old Linked binaries, if any
+ rm -rf $LinkBin
- <PropertyGroup>
+ # Remove Native images, since the goal is to run from Linked binaries
+ rm -f *.ni.*
+
+ # Use hints for reflection roots, if provided in $(ReflectionRootsXml)
+ if [ -f $(ReflectionRootsXml) ];
+ then
+ ReflectionRoots="-x $(ReflectionRootsXml)"
+ fi
+
+ # Include all .exe files in this directory as entry points (some tests had multiple .exe file modules)
+ for bin in *.exe *.dll;
+ do
+ Assemblies="$Assemblies -a $bin"
+ done
+
+ # Run dotnet-linker
+ # Run the Linker such that all assemblies except System.Private.Corlib.dll are linked
+ # Debug symbol generation needs some fixes, and is currently omitted.
+ # Once this is fixed, add -b true option.
+ echo "$ILLINK -out $LinkBin -d $CORE_ROOT -c link -l none -t $Assemblies $ReflectionRoots"
+ $ILLINK -out $LinkBin -d $CORE_ROOT -c link -l none -t $Assemblies $ReflectionRoots
+ ERRORLEVEL=$?
+ if [ $ERRORLEVEL -ne 0 ]
+ then
+ echo ILLINK FAILED $ERRORLEVEL
+ if [ ! -z "$KeepLinkedBinaries" ];
+ then
+ rm -rf $LinkBin
+ fi
+ exit 1
+ fi
+
+ # Copy CORECLR native binaries to $LinkBin, so that we can run the test based on that directory
+ cp $CORE_ROOT/clrjit.dll $LinkBin
+ cp $CORE_ROOT/coreclr.dll $LinkBin
+ cp $CORE_ROOT/mscorrc.dll $LinkBin
+ cp $CORE_ROOT/CoreRun.exe $LinkBin
+ # Copy some files that may be arguments
+ cp *.txt $LinkBin
+
+ ExePath=$LinkBin/$(InputAssemblyName)
+ export CORE_ROOT=$PWD/$LinkBin
+fi
+]]>
+ </BashLinkerTestLaunchCmds>
+ <BashLinkerTestCleanupCmds>
+ <![CDATA[
+# Clean up the LinkBin directories after test execution.
+# Otherwise, RunTests may run out of disk space.
+
+if [ ! -z "$DoLink" ];
+then
+ if [ ! -z "$KeepLinkedBinaries" ];
+ then
+ rm -rf $LinkBin
+ fi
+fi
+]]>
+ </BashLinkerTestCleanupCmds>
+ </PropertyGroup>
+ <PropertyGroup>
<_CLRTestRunFile Condition="'$(CLRTestIsHosted)'=='true'">"$CORE_ROOT/corerun"</_CLRTestRunFile>
<BashCLRTestLaunchCmds Condition="'$(IlasmRoundTrip)'=='true'"><![CDATA[
-echo $(_CLRTestRunFile) $(TargetAssemblyName) $CLRTestExecutionArguments
-$(_CLRTestRunFile) $(TargetAssemblyName) $CLRTestExecutionArguments
-if [ $? -ne $CLRTestExpectedExitCode ]
-then
- echo END EXECUTION OF IL{D}ASM BINARY - FAILED $? vs $CLRTestExpectedExitCode
- echo FAILED
- exit 1
+if [ -z "$DoLink" ]; then
+ echo $(_CLRTestRunFile) $(TargetAssemblyName) $CLRTestExecutionArguments
+ $(_CLRTestRunFile) $(TargetAssemblyName) $CLRTestExecutionArguments
+ if [ $? -ne $CLRTestExpectedExitCode ]
+ then
+ echo END EXECUTION OF IL{D}ASM BINARY - FAILED $? vs $CLRTestExpectedExitCode
+ echo FAILED
+ exit 1
+ fi
fi
]]></BashCLRTestLaunchCmds>
- <BashCLRTestLaunchCmds Condition="'$(CLRTestKind)' == 'BuildAndRun'"><![CDATA[
+ <BashCLRTestLaunchCmds Condition="'$(CLRTestKind)' == 'BuildAndRun'">
+ <![CDATA[
+ExePath=$(InputAssemblyName)
+$(BashLinkerTestLaunchCmds)
$(BashCLRTestLaunchCmds)
-echo $_DebuggerFullPath $(_CLRTestRunFile) $(InputAssemblyName) $CLRTestExecutionArguments
-$_DebuggerFullPath $(_CLRTestRunFile) $(InputAssemblyName) $CLRTestExecutionArguments
+echo $_DebuggerFullPath $(_CLRTestRunFile) $ExePath $CLRTestExecutionArguments
+$_DebuggerFullPath $(_CLRTestRunFile) $ExePath $CLRTestExecutionArguments
CLRTestExitCode=$?
+$(BashLinkerTestCleanupCmds)
]]></BashCLRTestLaunchCmds>
<BashCLRTestLaunchCmds Condition="'$(CLRTestKind)' == 'RunOnly'"><![CDATA[
$(BashCLRTestLaunchCmds)
diff --git a/tests/src/CLRTest.Execute.Batch.targets b/tests/src/CLRTest.Execute.Batch.targets
index b16e648908..db2a17425d 100644
--- a/tests/src/CLRTest.Execute.Batch.targets
+++ b/tests/src/CLRTest.Execute.Batch.targets
@@ -214,7 +214,7 @@ set Assemblies=-a System.Private.CoreLib
IF defined DoLink (
IF NOT EXIST !ILLINK! (
- ECHO ILLink [%ILLINK%] Not Found
+ ECHO ILLink executable [%ILLINK%] Invalid
Exit /b 1
)
@@ -237,8 +237,10 @@ IF defined DoLink (
ECHO %ILLINK% -out %LinkBin% -d %CORE_ROOT% -c link -l none -t !Assemblies! !ReflectionRoots!
%ILLINK% -out %LinkBin% -d %CORE_ROOT% -c link -l none -t !Assemblies! !ReflectionRoots!
IF NOT "!ERRORLEVEL!"=="0" (
- ECHO EXECUTION OF %DOTNETLINK% - FAILED !ERRORLEVEL!
- IF EXIST %LinkBin% rmdir /s /q %LinkBin%
+ ECHO ILLINK FAILED !ERRORLEVEL!
+ IF NOT defined KeepLinkedBinaries (
+ IF EXIST %LinkBin% rmdir /s /q %LinkBin%
+ )
Exit /b 1
)