This repository has been archived by the owner on Nov 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 508
[WIP] Enable CoreFX tests on CoreRT #5287
Closed
Closed
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
1c4a957
Generate Test projects - Intermittent checkin
A-And c5c3901
Intermittent check-in running exe, tests need restoring
A-And 6f9bfab
Add Test utitilites project
A-And d81f654
End-to-End test build Windows
A-And 88a8d07
Change structure
A-And 4c5c1e2
Fix RDXML and add reflectable types
A-And ca4b774
Add json parsing and xml logs
A-And 16ec04b
End-to-end test run and display
A-And 1d7e420
Helper project style changes
A-And b4c1b7c
Remove direct dll references add package dependencies
A-And d0a6b8a
Stylistic changes + deps
A-And ca7fb82
Style fixup
A-And 067d611
XML reader escape
A-And f39867a
Dependency and comment cleanup
A-And 48d4acc
Respond to PR feedback
A-And d1cb32e
Intermittent checkin - Build helper projects
A-And File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
:: Test build and execution wrapper for CoreFX tests | ||
:: | ||
:: This wrapper is called for each of CoreFX's tests by runtest.cmd | ||
:: | ||
:: %1 contains test folder | ||
:: %2 contains test exe name | ||
:: | ||
@echo OFF | ||
setlocal ENABLEDELAYEDEXPANSION | ||
|
||
set TestFolder=%1 | ||
|
||
:: | ||
:: We're only interested in referencing the xunit runner - the test dlls will be imported by the test wrapper project | ||
:: | ||
set TestExecutable=xunit.console.netcore | ||
set TestFileName=%2 | ||
|
||
|
||
:: Copy the artefacts we need to compile and run the xunit exe | ||
copy /Y "%~dp0\runtest\CoreFXTestHarness\*" "%TestFolder%" >nul | ||
|
||
:: Create log dir if it doesn't exist | ||
if not exist %XunitLogDir% md %XunitLogDir% | ||
|
||
if not exist %TestFolder%\%TestExecutable%.exe ( | ||
:: Not a test we support yet, exit silently | ||
exit /b 0 | ||
) | ||
|
||
:: Workaround until we have a better reflection engine | ||
:: Add name of currently executing test to rd.xml | ||
powershell -Command "(Get-Content %TestFolder%\default.rd.xml).replace('*Application*', '%TestFileName%') | Set-Content %TestFolder%\default.rd.xml" | ||
|
||
if "%CoreRT_BuildArch%" == "x64" ( | ||
call "%VS140COMNTOOLS%\..\..\VC\bin\amd64\vcvars64.bat" >nul | ||
) | ||
|
||
echo Build %TestFileName% | ||
|
||
call "%CoreRT_CliDir%\dotnet.exe" publish %TestFolder%\Test.csproj /ConsoleLoggerParameters:ForceNoAlign "/p:IlcPath=%CoreRT_ToolchainDir%" "/p:DebugSymbols=false" "/p:Configuration=%CoreRT_BuildType%" "/p:FrameworkLibPath=%~dp0..\..\bin\%CoreRT_BuildOS%.%CoreRT_BuildArch%.%CoreRT_BuildType%\lib" "/p:FrameworkObjPath=%~dp0..\..\bin\obj\%CoreRT_BuildOS%.%CoreRT_BuildArch%.%CoreRT_BuildType%\Framework" /p:DisableFrameworkLibGeneration=true /p:TestRootDir=%~dp0 /p:ExecutableName=%TestExecutable% /nologo | ||
if errorlevel 1 ( | ||
echo Building %TestFileName% failed | ||
exit /b 1 | ||
) | ||
|
||
echo Executing %TestFileName% | ||
|
||
call %TestFolder%\native\%TestExecutable% %TestFolder%\%TestFileName%.dll -xml %XunitLogDir%\%TestFileName%.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This is the Unix equivalent of build-and-run-test.cmd | ||
# It is invoked by each test's bash script. The reason it's called corerun is that | ||
# the unix CoreCLR tests don't have a custom runner override environment variable. | ||
# See issue https://github.com/dotnet/coreclr/issues/9007 | ||
# The CoreFX alternative is named corerun to keep parity with CoreCLR's testing infrastructure | ||
|
||
#!/usr/bin/env bash | ||
|
||
# This is the Unix equivalent of build-and-run-test.cmd | ||
# It is invoked by each test's bash script. The reason it's called corerun is that | ||
# the unix CoreCLR tests don't have a custom runner override environment variable. | ||
# See issue https://github.com/dotnet/coreclr/issues/9007 | ||
|
||
export TestExecutable=$1 | ||
export TestFileName=${TestExecutable%.*} | ||
|
||
source "$CoreRT_TestRoot/coredump_handling.sh" | ||
|
||
if [[ $CoreRT_EnableCoreDumps == 1 ]]; then | ||
set_up_core_dump_generation | ||
fi | ||
|
||
cp -ar $CoreRT_TestRoot/CoreCLR/. . | ||
|
||
# Workaround until we have a better reflection engine | ||
# Add name of currently executing test to rd.xml | ||
|
||
$__dotnetclipath/dotnet publish | ||
|
||
|
||
__msbuild_dir=${CoreRT_TestRoot}/../Tools | ||
echo ${__msbuild_dir}/msbuild.sh /m /p:IlcPath=${CoreRT_ToolchainDir} /p:Configuration=${CoreRT_BuildType} Test.csproj | ||
${__msbuild_dir}/msbuild.sh /m /p:IlcPath=${CoreRT_ToolchainDir} /p:Configuration=${CoreRT_BuildType} Test.csproj | ||
|
||
if [[ $CoreRT_EnableCoreDumps == 1 ]]; then | ||
# Handle any core files generated when running the test IL through the toolchain. | ||
inspect_and_delete_core_files $CoreRT_ToolchainDir/corerun "$CoreRT_ToolchainDir" | ||
fi | ||
|
||
# Remove the test executable from the arg list so it isn't passed to test execution | ||
shift | ||
|
||
testExtRepo=$( dirname ${CoreRT_TestRoot} )/tests_downloaded/CoreCLR/ | ||
nativeArtifactRepo=${testExtRepo}native/ | ||
dirSuffix=$(dirname ${PWD#$testExtRepo})/ | ||
nativeDir=${nativeArtifactRepo}tests/src/${dirSuffix} | ||
|
||
# In OSX we copy the native component to the directory where the exectuable resides. | ||
# However, in Linux dlopen doesn't seem to look for current directory to resolve the dynamic library. | ||
# So instead we point LD_LIBRARY_PATH to the directory where the native component is. | ||
if [ -e ${nativeDir} ]; then | ||
if [ "${CoreRT_BuildOS}" == "OSX" ]; then | ||
echo "Copying native component from :"${nativeDir} | ||
cp ${nativeDir}*.dylib native/ 2>/dev/null | ||
fi | ||
if [ "${CoreRT_BuildOS}" == "Linux" ]; then | ||
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${nativeDir} | ||
export LD_LIBRARY_PATH | ||
fi | ||
fi | ||
|
||
if [[ ! -f native/${TestFileName} ]]; then | ||
echo "ERROR: Native binary not found. Unable to run test." | ||
exit -1 | ||
fi | ||
|
||
pushd native/ | ||
./${TestFileName} "$@" | ||
testScriptExitCode=$? | ||
popd | ||
|
||
if [[ $CoreRT_EnableCoreDumps == 1 ]]; then | ||
# Handle any core files generated when running the test. | ||
inspect_and_delete_core_files native/$TestFileName "$CoreRT_ToolchainDir" | ||
fi | ||
|
||
# Clean up test binary artifacts to save space | ||
rm -r native 2>/dev/null | ||
|
||
exit $testScriptExitCode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<Project DefaultTargets="Build" | ||
xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="..\..\dependencies.props" /> | ||
|
||
<!-- Package version dependencies in test helper projects. --> | ||
<PropertyGroup> | ||
<SystemCommandLineVersion>0.1.0-e160909-1</SystemCommandLineVersion> | ||
<NewtonsoftJsonVersion>10.0.1</NewtonsoftJsonVersion> | ||
<XunitPackageVersion>2.2.0-beta2-build3300</XunitPackageVersion> | ||
<XunitAbstractionsVersion>2.0.1-rc2</XunitAbstractionsVersion> | ||
<XunitNetcoreExtensionsVersion>1.0.1-prerelease-02104-02</XunitNetcoreExtensionsVersion> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<Project DefaultTargets="LinkNative"> | ||
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" /> | ||
|
||
<Import Project="$(TestRootDir)\dependencies.props" /> | ||
|
||
<!-- Override Default MSBuild properties--> | ||
<PropertyGroup> | ||
<TargetName>$(ExecutableName)</TargetName> | ||
<TargetExt>.exe</TargetExt> | ||
<OutputType>Exe</OutputType> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<!-- TODO - need a general way to specify version without relying on the test directory structure being intact, i.e. import dependencies from \tests\ --> | ||
<ToolsDir>$(FrameworkLibPath)\..\tools\</ToolsDir> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The only place where |
||
<TargetFramework>netcoreapp2.0</TargetFramework> | ||
<!-- Don't warn if some dependencies were rolled forward --> | ||
<NoWarn>$(NoWarn);NU1603</NoWarn> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<RdXmlFile Include="default.rd.xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="xunit.abstractions"> | ||
<Version>$(XunitAbstractionsVersion)</Version> | ||
</PackageReference> | ||
<PackageReference Include="xunit.assert"> | ||
<Version>$(XunitPackageVersion)</Version> | ||
</PackageReference> | ||
<PackageReference Include="xunit.extensibility.core"> | ||
<Version>$(XunitPackageVersion)</Version> | ||
</PackageReference> | ||
<PackageReference Include="xunit.core"> | ||
<Version>$(XunitPackageVersion)</Version> | ||
</PackageReference> | ||
<PackageReference Include="xunit.runner.utility"> | ||
<Version>$(XunitPackageVersion)</Version> | ||
</PackageReference> | ||
<PackageReference Include="xunit.extensibility.execution"> | ||
<Version>$(XunitPackageVersion)</Version> | ||
</PackageReference> | ||
<PackageReference Include="microsoft.xunit.netcore.extensions"> | ||
<Version>$(XunitNetcoreExtensionsVersion)</Version> | ||
</PackageReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<!-- Some tests consist of multiple assemblies - make sure ILC sees them --> | ||
<IlcCompileInput Include="$(MSBuildProjectDirectory)\*.dll" /> | ||
</ItemGroup> | ||
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" /> | ||
|
||
<!-- Set OutputPath after the SDK targets have been imported--> | ||
<PropertyGroup> | ||
<OutputPath>$(MSBuildProjectDirectory)\</OutputPath> | ||
<IntermediateOutputPath>$(MSBuildProjectDirectory)\</IntermediateOutputPath> | ||
</PropertyGroup> | ||
|
||
<!-- Import CoreRT build targets --> | ||
<Import Project="$(IlcPath)\build\Microsoft.NETCore.Native.targets" /> | ||
|
||
<!-- Since tests are already compiled, override Compile target to prevent CSC running --> | ||
<Target Name="Compile" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<Directives | ||
xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata"> | ||
<Application> | ||
<Assembly Name="*Application*" Dynamic="Required All" /> | ||
<Assembly Name="xunit.abstractions" Dynamic="Required All" /> | ||
<Assembly Name="System.Private.CoreLib"> | ||
<Type Name="System.Runtime.CompilerServices.CompilationRelaxationsAttribute" Dynamic="Required All" /> | ||
<Type Name="System.Runtime.CompilerServices.RuntimeCompatibilityAttribute" Dynamic="Required All" /> | ||
<Type Name="System.Runtime.CompilerServices.ExtensionAttribute" Dynamic="Required All" /> | ||
<Type Name="System.Runtime.CompilerServices.IntrinsicAttribute" Dynamic="Required All" /> | ||
<Type Name="System.Diagnostics.DebuggableAttribute" Dynamic="Required All" /> | ||
<Type Name="System.Reflection.AssemblyInformationalVersionAttribute" Dynamic="Required All" /> | ||
<Type Name="System.Reflection.AssemblyTitleAttribute" Dynamic="Required All" /> | ||
<Type Name="System.Reflection.AssemblyFileVersionAttribute" Dynamic="Required All" /> | ||
<Type Name="System.Reflection.AssemblyDescriptionAttribute" Dynamic="Required All" /> | ||
<Type Name="System.Reflection.AssemblyCompanyAttribute" Dynamic="Required All" /> | ||
<Type Name="System.Reflection.AssemblyCopyrightAttribute" Dynamic="Required All" /> | ||
<Type Name="System.Reflection.AssemblyProductAttribute" Dynamic="Required All" /> | ||
<Type Name="System.Reflection.AssemblyDefaultAliasAttribute" Dynamic="Required All" /> | ||
<Type Name="System.Reflection.AssemblyMetadataAttribute" Dynamic="Required All" /> | ||
<Type Name="System.AttributeUsageAttribute" Dynamic="Required All" /> | ||
<Type Name="System.AttributeUsageAttribute[]" Dynamic="Required All" /> | ||
<Type Name="System.Runtime.InteropServices.ComVisibleAttribute" Dynamic="Required All" /> | ||
<Type Name="System.CLSCompliantAttribute" Dynamic="Required All" /> | ||
</Assembly> | ||
<Assembly Name="mscorlib"> | ||
<Type Name="System.IO.File" Dynamic="Required All"/> | ||
<Type Name="System.Threading.ExecutionContext" Dynamic="Required All"/> | ||
<Type Name="System.Threading.ContextCallback" Dynamic="Required All"/> | ||
</Assembly> | ||
<Assembly Name="xunit.core" Dynamic="Required All" /> | ||
<Assembly Name="xunit.runner.utility.dotnet" Dynamic="Required All" /> | ||
<Assembly Name="xunit.execution.dotnet" Dynamic="Required All" /> | ||
<Assembly Name="xunit.abstractions" Dynamic="Required All" /> | ||
<Assembly Name="xunit.core" Dynamic="Required All"> | ||
<Type Name="Xunit.Sdk.BeforeAfterTestAttribute[]" Dynamic="Required All" /> | ||
</Assembly> | ||
<Assembly Name="Xunit.NetCore.Extensions" Dynamic="Required All" /> | ||
<Assembly Name="System.Linq.Expressions" Dynamic="Required All" /> | ||
</Application> | ||
</Directives> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
|
||
<!-- Don't import the project's parent dir.props - all other projects in the CoreRT repo are set up for the old project format --> | ||
|
||
<!-- | ||
$(OS) is set to Unix/Windows_NT. This comes from an environment variable on Windows and MSBuild on Unix. | ||
--> | ||
<PropertyGroup> | ||
<OsEnvironment Condition="'$(OsEnvironment)'==''">$(OS)</OsEnvironment> | ||
</PropertyGroup> | ||
|
||
<!-- Common repo directories --> | ||
<PropertyGroup> | ||
<CopyNuGetImplementations Condition="'$(CopyNuGetImplementations)'==''">false</CopyNuGetImplementations> | ||
<ProjectDir>$(MSBuildThisFileDirectory)\</ProjectDir> | ||
<SourceDir>$(ProjectDir)src\</SourceDir> | ||
<PackagesDir>$(ProjectDir)..\..\..\packages\</PackagesDir> | ||
<ToolsDir Condition="'$(ToolsDir)'==''">$(ProjectDir)..\Tools\</ToolsDir> | ||
<DotnetCliPath Condition="'$(DotnetCliPath)'==''">$(ToolsDir)dotnetcli/</DotnetCliPath> | ||
<SkipImportILTargets>true</SkipImportILTargets> | ||
</PropertyGroup> | ||
|
||
<!-- Provides properties for dependency versions and configures dependency verification/auto-upgrade. --> | ||
<Import Project="$(MSBuildThisFileDirectory)\..\dependencies.props" /> | ||
|
||
<!-- list of nuget package sources passed to dnu --> | ||
<ItemGroup> | ||
<!-- Need to escape double forward slash (%2F) or MSBuild will normalize to one slash on Unix. --> | ||
<DotnetSourceList Include="https:%2F%2Fdotnet.myget.org/F/dotnet-core/api/v3/index.json" /> | ||
<DotnetSourceList Include="https:%2F%2Fapi.nuget.org/v3/index.json" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are these tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests not run by Helix (e.g. AssemblyResolve). Technically, this shouldn't ever happen, but in case the test format changes, this degrades more gracefully.
Ideally, the need for this will be completely eliminated once we add a CoreRT parallel to the uap-aot target for CoreFX.