diff options
author | Senthil <schellap@microsoft.com> | 2015-11-18 03:40:18 +0300 |
---|---|---|
committer | Senthil <schellap@microsoft.com> | 2015-12-02 05:34:21 +0300 |
commit | a8199d3bfeb14dd44e45bbd598eef75cf6e5ef70 (patch) | |
tree | 2cd661422184b4e74c55f5bab0b3cb15ae6f6bb7 | |
parent | 9dacc6dd120e6579ae84c9fd41cae48ddc63035f (diff) |
Switch to dotnet tools and add unix testing
- Fix few issues and produce xunit format
- Set HOME if undefined and DOTNET_HOME
- Enable CPP and JIT for all platforms except OSX
o CLI has no support for RyuJIT.
37 files changed, 784 insertions, 149 deletions
diff --git a/Documentation/how-to-build-and-run-ilcompiler-in-console-shell-prompt.md b/Documentation/how-to-build-and-run-ilcompiler-in-console-shell-prompt.md index 2e6d27904..dcc3dac88 100644 --- a/Documentation/how-to-build-and-run-ilcompiler-in-console-shell-prompt.md +++ b/Documentation/how-to-build-and-run-ilcompiler-in-console-shell-prompt.md @@ -27,7 +27,7 @@ This will result in the following: * Ensure that you have done a repo build per the instructions above. * Install the contents of `<repo_root>/bin/product/<OS>.<Arch>.<BuildType>/.nuget/toolchain.<nupkg-rid>.Microsoft.DotNet.ILCompiler.Development*.nupkg` to a folder, say, **c:\newilc** using NuGet - * Example: `<repo_root>/packages/NuGet.exe install -Source <repo_root>/bin/Product/<OS>.<Arch>.<BuildType>/.nuget/ toolchain.win7-x64.Microsoft.DotNet.ILCompiler.Development -Version 1.0.0-prerelease -prerelease -OutputDirectory c:\newilc` + * Example: `<repo_root>/packages/NuGet.exe install -Source <repo_root>/bin/Product/<OS>.<Arch>.<BuildType>/.nuget/ toolchain.win7-x64.Microsoft.DotNet.ILCompiler.Development -Version 1.0.2-prerelease-00001 -prerelease -OutputDirectory c:\newilc` * On OSX/Ubuntu, use `mono` to run `NuGet.exe`. * Create a new folder and switch into it. * Issue the command, `dotnet init`, on the command/shell prompt. This will add a template source file and corresponding project.json. If you get an error, please ensure the [pre-requisites](prerequisites-for-building.md) are installed. diff --git a/Documentation/how-to-build-and-run-ilcompiler-in-visual-studio-2015.md b/Documentation/how-to-build-and-run-ilcompiler-in-visual-studio-2015.md index 36bf0f519..b1537716f 100644 --- a/Documentation/how-to-build-and-run-ilcompiler-in-visual-studio-2015.md +++ b/Documentation/how-to-build-and-run-ilcompiler-in-visual-studio-2015.md @@ -12,7 +12,7 @@ _Note_: - Set "desktop" project in solution explorer as your startup project - Set startup command line to: -`c:\corert\src\ILCompiler\repro\bin\Debug\repro.exe -r c:\corert\bin\Product\Windows_NT.x64.Debug\System.Private.CoreLib.dll -r c:\corert\bin\tests\package\toolchain.win7-x64.Microsoft.DotNet.AppDep.1.0.1-prerelease\*.dll -out c:\corert\src\ILCompiler\reproNative\repro.obj` +`c:\corert\src\ILCompiler\repro\bin\Debug\repro.exe -r c:\corert\bin\Product\Windows_NT.x64.Debug\System.Private.CoreLib.dll -r c:\corert\bin\tests\package\toolchain.win7-x64.Microsoft.DotNet.AppDep.1.0.2-prerelease-00002\*.dll -out c:\corert\src\ILCompiler\reproNative\repro.obj` - Copy ryujit.dll from `c:\corert\bin\tests\package\toolchain.win7-x64.Microsoft.DotNet.RyuJit\1.0.*\runtimes\win7-x64\native\ryujit.dll` to `c:\corert\src\ILCompiler\desktop\bin\Debug` - Copy objwriter.dll from `c:\corert\bin\tests\package\toolchain.win7-x64.Microsoft.DotNet.ObjectWriter\1.0.*\runtimes\win7-x64\native\objwriter.dll` to `c:\corert\src\ILCompiler\desktop\bin\Debug` @@ -37,7 +37,7 @@ _Note_: - Set "desktop" project in solution explorer as your startup project - Set startup command line to: -`c:\corert\src\ILCompiler\repro\bin\Debug\repro.exe -r c:\corert\bin\Product\Windows_NT.x64.Debug\System.Private.CoreLib.dll -r c:\corert\bin\tests\package\toolchain.win7-x64.Microsoft.DotNet.AppDep.1.0.1-prerelease\*.dll -out C:\corert\src\ILCompiler\reproNative\repro.cpp -cpp` +`c:\corert\src\ILCompiler\repro\bin\Debug\repro.exe -r c:\corert\bin\Product\Windows_NT.x64.Debug\System.Private.CoreLib.dll -r c:\corert\bin\tests\package\toolchain.win7-x64.Microsoft.DotNet.AppDep.1.0.2-prerelease-00002\*.dll -out C:\corert\src\ILCompiler\reproNative\repro.cpp -cpp` - `-nolinenumbers` command line option can be used to suppress generation of line number mappings in C++ files - useful for debugging @@ -49,4 +49,4 @@ _Note_: 2. Open C:\corert\src\ILCompiler\reproNative\reproNativeCpp.vcxproj - Set breakpoint at repro::Program::Main in main.cpp - - Build, run & step through as with any other C++ program
\ No newline at end of file + - Build, run & step through as with any other C++ program diff --git a/Documentation/nuget-dependencies-for-the-toolchain.md b/Documentation/nuget-dependencies-for-the-toolchain.md index 679680bfc..45a19bf4a 100644 --- a/Documentation/nuget-dependencies-for-the-toolchain.md +++ b/Documentation/nuget-dependencies-for-the-toolchain.md @@ -5,23 +5,23 @@ The following packages redirect to platform specific packages further below: -Microsoft.DotNet.AppDep 1.0.0-prerelease +Microsoft.DotNet.AppDep 1.0.2-prerelease-00002 -Microsoft.DotNet.ObjectWriter 1.0.2-prerelease +Microsoft.DotNet.ObjectWriter 1.0.3-prerelease-00001 -Microsoft.DotNet.RyuJit 1.0.0-prerelease +Microsoft.DotNet.RyuJit 1.0.1-prerelease-00002 ## Linux -toolchain.ubuntu.14.04-x64.Microsoft.DotNet.AppDep 1.0.0-prerelease +toolchain.ubuntu.14.04-x64.Microsoft.DotNet.AppDep 1.0.2-prerelease-00002 -toolchain.ubuntu.14.04-x64.Microsoft.DotNet.ObjectWriter 1.0.2-prerelease +toolchain.ubuntu.14.04-x64.Microsoft.DotNet.ObjectWriter 1.0.3-prerelease-00001 -toolchain.ubuntu.14.04-x64.Microsoft.DotNet.RyuJit 1.0.0-prerelease +toolchain.ubuntu.14.04-x64.Microsoft.DotNet.RyuJit 1.0.1-prerelease-00002 ## Windows -toolchain.win7-x64.Microsoft.DotNet.AppDep 1.0.0-prerelease +toolchain.win7-x64.Microsoft.DotNet.AppDep 1.0.2-prerelease-00002 -toolchain.win7-x64.Microsoft.DotNet.ObjectWriter 1.0.2-prerelease +toolchain.win7-x64.Microsoft.DotNet.ObjectWriter 1.0.3-prerelease-00001 -toolchain.win7-x64.Microsoft.DotNet.RyuJit 1.0.0-prerelease +toolchain.win7-x64.Microsoft.DotNet.RyuJit 1.0.1-prerelease-00002 @@ -142,6 +142,20 @@ setlocal rem Explicitly set Platform causes conflicts in managed project files. Clear it to allow building from VS x64 Native Tools Command Prompt set Platform= +:: Obtain dotnet CLI tools to perform restore packages/test runs +:GetDotNetCli + +set "__DotNetCliPath=%__RootBinDir%\tools\cli" +if not exist "%__DotNetCliPath%" ( + for /f "delims=" %%a in ('powershell -NoProfile -ExecutionPolicy RemoteSigned "& "%__SourceDir%\scripts\install-cli.ps1" -installdir "%__RootBinDir%\tools""') do ( + echo "" > nul + ) +) +if not exist "%__DotNetCliPath%" ( + echo DotNet CLI could not be downloaded or installed. + exit /b 1 +) + :: Set the environment for the managed build call "!VS%__VSProductVersion%COMNTOOLS!\VsDevCmd.bat" echo Commencing build of managed components for %__BuildOS%.%__BuildArch%.%__BuildType% @@ -52,6 +52,62 @@ check_managed_prereqs() fi } +download_file() +{ + which curl wget > /dev/null 2> /dev/null + if [ $? -ne 0 -a $? -ne 1 ]; then + echo "cURL or wget is required to build corert." + exit 1 + fi + echo "Downloading... $2" + + # curl has HTTPS CA trust-issues less often than wget, so lets try that first. + which curl > /dev/null 2> /dev/null + if [ $? -ne 0 ]; then + wget -q -O $1 $2 + else + curl -sSL --create-dirs -o $1 $2 + fi + if [ $? -ne 0 ]; then + echo "Failed to download into $1 from $2." + exit 1 + fi +} + +install_dotnet_cli() +{ + echo "Installing the dotnet/cli..." + local __tools_dir=${__scriptpath}/bin/tools + local __cli_dir=${__tools_dir}/cli + + if [ ! -d "${__cli_dir}" ]; then + mkdir -p "${__cli_dir}" + fi + if [ ! -f "${__cli_dir}/bin/dotnet" ]; then + local __build_os_lowercase=$(echo "${__BuildOS}" | tr '[:upper:]' '[:lower:]') + local __build_arch_lowercase=$(echo "${__BuildArch}" | tr '[:upper:]' '[:lower:]') + local __cli_tarball=dotnet-${__build_os_lowercase}-${__build_arch_lowercase}.latest.tar.gz + local __cli_tarball_path=${__tools_dir}/${__cli_tarball} + download_file ${__cli_tarball_path} "https://dotnetcli.blob.core.windows.net/dotnet/dev/Binaries/Latest/${__cli_tarball}" + tar -xzf ${__cli_tarball_path} -C ${__cli_dir} + export DOTNET_HOME=${__cli_dir} + # + # Workaround: Setting "HOME" for now to a dir in repo, as "dotnet restore" + # depends on "HOME" to be set for its .dnx cache. + # + # See https://github.com/dotnet/cli/blob/5f5e3ad74c0c1de7071ba1309dca2ea289691163/scripts/ci_build.sh#L24 + # https://github.com/dotnet/cli/issues/354 + # + if [ -n ${HOME:+1} ]; then + export HOME=${__tools_dir} + fi + fi + if [ ! -f "${__cli_dir}/bin/dotnet" ]; then + echo "CLI could not be installed or not present." + exit 1 + fi +} + check_native_prereqs() { echo "Checking pre-requisites..." @@ -69,26 +125,8 @@ prepare_managed_build() { # Pull NuGet.exe down if we don't have it already if [ ! -e "$__nugetpath" ]; then - which curl wget > /dev/null 2> /dev/null - if [ $? -ne 0 -a $? -ne 1 ]; then - echo "cURL or wget is required to build corert." - exit 1 - fi - echo "Restoring NuGet.exe..." - - # curl has HTTPS CA trust-issues less often than wget, so lets try that first. - which curl > /dev/null 2> /dev/null - if [ $? -ne 0 ]; then - mkdir -p $__packageroot - wget -q -O $__nugetpath https://api.nuget.org/downloads/nuget.exe - else - curl -sSL --create-dirs -o $__nugetpath https://api.nuget.org/downloads/nuget.exe - fi - - if [ $? -ne 0 ]; then - echo "Failed to restore NuGet.exe." - exit 1 - fi + mkdir -p $__packageroot + download_file $__nugetpath https://api.nuget.org/downloads/nuget.exe fi # Grab the MSBuild package if we don't have it already @@ -100,6 +138,9 @@ prepare_managed_build() exit 1 fi fi + + # Obtain dotnet CLI to perform restore + install_dotnet_cli } prepare_native_build() @@ -395,6 +436,15 @@ if [ $BUILDERRORLEVEL != 0 ]; then exit $BUILDERRORLEVEL fi +pushd ${__scriptpath}/tests +source ${__scriptpath}/tests/runtest.sh $__BuildOS $__BuildArch $__BuildType +TESTERRORLEVEL=$? +popd + +if [ $TESTERRORLEVEL != 0 ]; then + exit $TESTERRORLEVEL +fi + echo "Product binaries are available at $__ProductBinDir" exit $BUILDERRORLEVEL @@ -11,9 +11,6 @@ <!-- Build Tools Versions --> <PropertyGroup> <BuildToolsVersion>1.0.25-prerelease-00104</BuildToolsVersion> - <DnxVersion>1.0.0-beta8</DnxVersion> - <DnxPackageName Condition="'$(DnxPackageName)' == '' and '$(OsEnvironment)'!='Unix'">dnx-coreclr-win-x86.$(DnxVersion)</DnxPackageName> - <DnxPackageName Condition="'$(DnxPackageName)' == '' and '$(OsEnvironment)'=='Unix'">dnx-mono.$(DnxVersion)</DnxPackageName> <RoslynVersion>1.0.0-rc3-20150510-01</RoslynVersion> <RoslynPackageName>Microsoft.Net.ToolsetCompilers</RoslynPackageName> </PropertyGroup> @@ -169,9 +166,7 @@ </ItemGroup> <PropertyGroup> - <DnxPackageDir Condition="'$(DnxPackageDir)'==''">$(PackagesDir)/$(DnxPackageName)/</DnxPackageDir> - <DnuToolPath Condition="'$(DnuToolPath)'=='' and '$(OsEnvironment)'!='Unix'">$(DnxPackageDir)\bin\dnu.cmd</DnuToolPath> - <DnuToolPath Condition="'$(DnuToolPath)'=='' and '$(OsEnvironment)'=='Unix'">$(DnxPackageDir)/bin/dnu</DnuToolPath> + <DnuToolPath Condition="'$(DnuToolPath)'==''">$(BinDir)/tools/cli/bin/dotnet</DnuToolPath> <DnuRestoreSource>@(DnuSourceList -> '--source %(Identity)', ' ')</DnuRestoreSource> <DnuRestoreDirs>@(DnuRestoreDir -> '%(Identity)', ' ')</DnuRestoreDirs> diff --git a/dir.targets b/dir.targets index b24dcdffa..105a7702d 100644 --- a/dir.targets +++ b/dir.targets @@ -94,11 +94,7 @@ <!-- Restore build tools --> <Exec Command="$(_RestoreBuildToolsCommand)" StandardOutputImportance="Low" /> - <!-- Add DNU and Roslyn tool execute rights --> - <Exec Condition="'$(OsEnvironment)'=='Unix'" - Command="chmod a+x "$(DnxPackageDir)/bin/dnu"" /> - <Exec Condition="'$(OsEnvironment)'=='Unix'" - Command="chmod a+x "$(DnxPackageDir)/bin/dnx"" /> + <!-- Add Roslyn tool execute rights --> <Exec Condition="'$(OsEnvironment)'=='Unix'" Command="find '$(RoslynPackageDir)tools' -name "*.exe" -exec chmod "+x" '{}' ';'" /> diff --git a/netci.groovy b/netci.groovy index dcb27d2f1..26c2affac 100644 --- a/netci.groovy +++ b/netci.groovy @@ -59,10 +59,8 @@ def osList = ['Ubuntu', 'OSX', 'Windows_NT'] } } - if (os == 'Windows_NT') { - // This call performs test run checks for the CI. - Utilities.addXUnitDotNETResults(newJob, '**/testResults.xml') - } + // This call performs test run checks for the CI. + Utilities.addXUnitDotNETResults(newJob, '**/testResults.xml') // This call performs remaining common job setup on the newly created job. // This is used most commonly for simple inner loop testing. diff --git a/src/.nuget/Microsoft.DotNet.ILCompiler.nuspec b/src/.nuget/Microsoft.DotNet.ILCompiler.nuspec index 507cec247..d2e0a5591 100644 --- a/src/.nuget/Microsoft.DotNet.ILCompiler.nuspec +++ b/src/.nuget/Microsoft.DotNet.ILCompiler.nuspec @@ -2,7 +2,7 @@ <package > <metadata> <id>Microsoft.DotNet.ILCompiler</id> - <version>1.0.0-prerelease</version> + <version>1.0.2-prerelease-00001</version> <title>Microsoft .NET Native Toolchain</title> <authors>Microsoft</authors> <owners>Microsoft</owners> @@ -14,6 +14,32 @@ <releaseNotes>Initial release</releaseNotes> <copyright>Copyright © Microsoft Corporation</copyright> <dependencies> + <dependency id="Microsoft.DiaSymReader" version="1.0.6" /> + <dependency id="Microsoft.DotNet.ObjectWriter" version="1.0.3-prerelease-00001" /> + <dependency id="Microsoft.DotNet.RyuJit" version="1.0.1-prerelease-00002" /> + <dependency id="System.AppContext" version="4.0.0" /> + <dependency id="System.Collections" version="4.0.10" /> + <dependency id="System.Collections.Concurrent" version="4.0.10" /> + <dependency id="System.Collections.Immutable" version="1.1.37" /> + <dependency id="System.Console" version="4.0.0-beta-23419" /> + <dependency id="System.Diagnostics.Debug" version="4.0.10" /> + <dependency id="System.Diagnostics.Tracing" version="4.0.20" /> + <dependency id="System.IO" version="4.0.10" /> + <dependency id="System.IO.FileSystem" version="4.0.0" /> + <dependency id="System.Linq" version="4.0.0" /> + <dependency id="System.Reflection" version="4.0.10" /> + <dependency id="System.Reflection.Extensions" version="4.0.0" /> + <dependency id="System.Reflection.Metadata" version="1.0.22" /> + <dependency id="System.Reflection.Primitives" version="4.0.0" /> + <dependency id="System.Resources.ResourceManager" version="4.0.0" /> + <dependency id="System.Runtime" version="4.0.20" /> + <dependency id="System.Runtime.Extensions" version="4.0.10" /> + <dependency id="System.Runtime.InteropServices" version="4.0.20" /> + <dependency id="System.Text.Encoding" version="4.0.10" /> + <dependency id="System.Text.Encoding.Extensions" version="4.0.10" /> + <dependency id="System.Threading" version="4.0.10" /> + <dependency id="System.Threading.Tasks" version="4.0.10" /> + <dependency id="System.Xml.ReaderWriter" version="4.0.0" /> </dependencies> </metadata> <files> diff --git a/src/.nuget/packages.Windows_NT.config b/src/.nuget/packages.Windows_NT.config index 09cb80393..743c47bf6 100644 --- a/src/.nuget/packages.Windows_NT.config +++ b/src/.nuget/packages.Windows_NT.config @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> <packages> <package id="Microsoft.DotNet.BuildTools" version="1.0.25-prerelease-00104" /> - <package id="dnx-coreclr-win-x86" version="1.0.0-beta8" /> <package id="Microsoft.DotNet.BuildTools.ApiTools" version="1.0.0-prerelease" /> </packages> diff --git a/src/.nuget/runtime.json b/src/.nuget/runtime.json index 95449b38c..da5d94d6c 100644 --- a/src/.nuget/runtime.json +++ b/src/.nuget/runtime.json @@ -2,17 +2,17 @@ "runtimes": { "win7-x64": { "Microsoft.DotNet.ILCompiler": { - "toolchain.win7-x64.Microsoft.DotNet.ILCompiler": "1.0.0-prerelease" + "toolchain.win7-x64.Microsoft.DotNet.ILCompiler": "1.0.2-prerelease-00001" } }, - "ubuntu.14.04-x64": { + "osx.10.10-x64": { "Microsoft.DotNet.ILCompiler": { - "toolchain.ubuntu.14.04-x64.Microsoft.DotNet.ILCompiler": "1.0.0-prerelease" + "toolchain.osx.10.10-x64.Microsoft.DotNet.ILCompiler": "1.0.2-prerelease-00001" } }, - "osx.10.10-x64": { + "ubuntu.14.04-x64": { "Microsoft.DotNet.ILCompiler": { - "toolchain.osx.10.10-x64.Microsoft.DotNet.ILCompiler": "1.0.0-prerelease" + "toolchain.ubuntu.14.04-x64.Microsoft.DotNet.ILCompiler": "1.0.2-prerelease-00001" } } } diff --git a/src/.nuget/toolchain.osx.10.10-x64.Microsoft.DotNet.ILCompiler.Development.nuspec b/src/.nuget/toolchain.osx.10.10-x64.Microsoft.DotNet.ILCompiler.Development.nuspec index 57e06f065..5d936c863 100644 --- a/src/.nuget/toolchain.osx.10.10-x64.Microsoft.DotNet.ILCompiler.Development.nuspec +++ b/src/.nuget/toolchain.osx.10.10-x64.Microsoft.DotNet.ILCompiler.Development.nuspec @@ -2,7 +2,7 @@ <package > <metadata> <id>toolchain.osx.10.10-x64.Microsoft.DotNet.ILCompiler.Development</id> - <version>1.0.0-prerelease</version> + <version>1.0.2-prerelease-00001</version> <title>Microsoft .NET Native Toolchain - Development Version</title> <authors>Microsoft</authors> <owners>Microsoft</owners> @@ -29,7 +29,7 @@ <file src="../lib/libSystem.Private.CoreLib.Native.a" target="libSystem.Private.CoreLib.Native.a" /> <file src="../System.Private.Corelib.dll" target="System.Private.Corelib.dll" /> <file src="../ToolRuntime/*.dll" /> - <file src="../ToolRuntime/*.so" /> + <file src="../ToolRuntime/*.dylib" /> <file src="../ToolRuntime/corerun" target="corerun" /> <file src="../../../../packages/Microsoft.DiaSymReader/1.0.6/lib/portable-net45+win8/Microsoft.DiaSymReader.dll" /> </files> diff --git a/src/.nuget/toolchain.osx.10.10-x64.Microsoft.DotNet.ILCompiler.nuspec b/src/.nuget/toolchain.osx.10.10-x64.Microsoft.DotNet.ILCompiler.nuspec index 2877bef3d..ddc8f4411 100644 --- a/src/.nuget/toolchain.osx.10.10-x64.Microsoft.DotNet.ILCompiler.nuspec +++ b/src/.nuget/toolchain.osx.10.10-x64.Microsoft.DotNet.ILCompiler.nuspec @@ -2,7 +2,7 @@ <package > <metadata> <id>toolchain.osx.10.10-x64.Microsoft.DotNet.ILCompiler</id> - <version>1.0.0-prerelease</version> + <version>1.0.2-prerelease-00001</version> <title>Microsoft .NET Native Toolchain</title> <authors>Microsoft</authors> <owners>Microsoft</owners> @@ -15,6 +15,8 @@ <copyright>Copyright © Microsoft Corporation</copyright> <dependencies> <dependency id="Microsoft.DiaSymReader" version="1.0.6" /> + <dependency id="Microsoft.DotNet.ObjectWriter" version="1.0.3-prerelease-00001" /> + <dependency id="Microsoft.DotNet.RyuJit" version="1.0.1-prerelease-00002" /> <dependency id="System.AppContext" version="4.0.0" /> <dependency id="System.Collections" version="4.0.10" /> <dependency id="System.Collections.Concurrent" version="4.0.10" /> diff --git a/src/.nuget/toolchain.ubuntu.14.04-x64.Microsoft.DotNet.ILCompiler.Development.nuspec b/src/.nuget/toolchain.ubuntu.14.04-x64.Microsoft.DotNet.ILCompiler.Development.nuspec index 29e8399da..a97b44f4f 100644 --- a/src/.nuget/toolchain.ubuntu.14.04-x64.Microsoft.DotNet.ILCompiler.Development.nuspec +++ b/src/.nuget/toolchain.ubuntu.14.04-x64.Microsoft.DotNet.ILCompiler.Development.nuspec @@ -2,7 +2,7 @@ <package > <metadata> <id>toolchain.ubuntu.14.04-x64.Microsoft.DotNet.ILCompiler.Development</id> - <version>1.0.0-prerelease</version> + <version>1.0.2-prerelease-00001</version> <title>Microsoft .NET Native Toolchain - Development Version</title> <authors>Microsoft</authors> <owners>Microsoft</owners> @@ -31,8 +31,8 @@ <file src="../ToolRuntime/*.dll" /> <file src="../ToolRuntime/*.so" /> <file src="../ToolRuntime/corerun" target="corerun" /> - <file src="../../../../packages/toolchain.ubuntu.14.04-x64.Microsoft.DotNet.RyuJit/1.0.0-prerelease/runtimes/ubuntu.14.04-x64/native/libryujit.so" target="ryujit.so" /> - <file src="../../../../packages/toolchain.ubuntu.14.04-x64.Microsoft.DotNet.ObjectWriter/1.0.2-prerelease/runtimes/ubuntu.14.04-x64/native/libobjwriter.so" target="objwriter.so" /> + <file src="../../../../packages/toolchain.ubuntu.14.04-x64.Microsoft.DotNet.RyuJit/1.0.1-prerelease-00002/runtimes/ubuntu.14.04-x64/native/libryujit.so" target="ryujit.so" /> + <file src="../../../../packages/toolchain.ubuntu.14.04-x64.Microsoft.DotNet.ObjectWriter/1.0.3-prerelease-00001/runtimes/ubuntu.14.04-x64/native/libobjwriter.so" target="objwriter.so" /> <file src="../../../../packages/Microsoft.DiaSymReader/1.0.6/lib/portable-net45+win8/Microsoft.DiaSymReader.dll" /> </files> </package> diff --git a/src/.nuget/toolchain.ubuntu.14.04-x64.Microsoft.DotNet.ILCompiler.nuspec b/src/.nuget/toolchain.ubuntu.14.04-x64.Microsoft.DotNet.ILCompiler.nuspec index c8decc1bd..1a6034d3f 100644 --- a/src/.nuget/toolchain.ubuntu.14.04-x64.Microsoft.DotNet.ILCompiler.nuspec +++ b/src/.nuget/toolchain.ubuntu.14.04-x64.Microsoft.DotNet.ILCompiler.nuspec @@ -2,7 +2,7 @@ <package > <metadata> <id>toolchain.ubuntu.14.04-x64.Microsoft.DotNet.ILCompiler</id> - <version>1.0.0-prerelease</version> + <version>1.0.2-prerelease-00001</version> <title>Microsoft .NET Native Toolchain</title> <authors>Microsoft</authors> <owners>Microsoft</owners> @@ -15,6 +15,8 @@ <copyright>Copyright © Microsoft Corporation</copyright> <dependencies> <dependency id="Microsoft.DiaSymReader" version="1.0.6" /> + <dependency id="Microsoft.DotNet.ObjectWriter" version="1.0.3-prerelease-00001" /> + <dependency id="Microsoft.DotNet.RyuJit" version="1.0.1-prerelease-00002" /> <dependency id="System.AppContext" version="4.0.0" /> <dependency id="System.Collections" version="4.0.10" /> <dependency id="System.Collections.Concurrent" version="4.0.10" /> diff --git a/src/.nuget/toolchain.win7-x64.Microsoft.DotNet.ILCompiler.Development.nuspec b/src/.nuget/toolchain.win7-x64.Microsoft.DotNet.ILCompiler.Development.nuspec index 766cb5284..ed6cb15a6 100644 --- a/src/.nuget/toolchain.win7-x64.Microsoft.DotNet.ILCompiler.Development.nuspec +++ b/src/.nuget/toolchain.win7-x64.Microsoft.DotNet.ILCompiler.Development.nuspec @@ -2,7 +2,7 @@ <package > <metadata> <id>toolchain.win7-x64.Microsoft.DotNet.ILCompiler.Development</id> - <version>1.0.0-prerelease</version> + <version>1.0.2-prerelease-00001</version> <title>Microsoft .NET Native Toolchain - Development Version</title> <authors>Microsoft</authors> <owners>Microsoft</owners> @@ -35,8 +35,8 @@ <file src="..\toolruntime\*.dll" /> <file src="..\toolruntime\corerun.exe" target="corerun.exe" /> <file src="..\..\..\..\packages\Microsoft.DiaSymReader\1.0.6\lib\portable-net45+win8\Microsoft.DiaSymReader.dll" /> - <file src="..\..\..\..\packages\toolchain.win7-x64.Microsoft.DotNet.RyuJit\1.0.0-prerelease\runtimes\win7-x64\native\ryujit.dll" /> - <file src="..\..\..\..\packages\toolchain.win7-x64.Microsoft.DotNet.ObjectWriter\1.0.2-prerelease\runtimes\win7-x64\native\objwriter.dll" /> + <file src="..\..\..\..\packages\toolchain.win7-x64.Microsoft.DotNet.RyuJit\1.0.1-prerelease-00002\runtimes\win7-x64\native\ryujit.dll" /> + <file src="..\..\..\..\packages\toolchain.win7-x64.Microsoft.DotNet.ObjectWriter\1.0.3-prerelease-00001\runtimes\win7-x64\native\objwriter.dll" /> <file src="..\..\..\..\src\scripts\dotnet-compile-native.bat" /> </files> </package> diff --git a/src/.nuget/toolchain.win7-x64.Microsoft.DotNet.ILCompiler.nuspec b/src/.nuget/toolchain.win7-x64.Microsoft.DotNet.ILCompiler.nuspec index 121f90e20..d3ea3b4a8 100644 --- a/src/.nuget/toolchain.win7-x64.Microsoft.DotNet.ILCompiler.nuspec +++ b/src/.nuget/toolchain.win7-x64.Microsoft.DotNet.ILCompiler.nuspec @@ -2,7 +2,7 @@ <package > <metadata> <id>toolchain.win7-x64.Microsoft.DotNet.ILCompiler</id> - <version>1.0.0-prerelease</version> + <version>1.0.2-prerelease-00001</version> <title>Microsoft .NET Native Toolchain</title> <authors>Microsoft</authors> <owners>Microsoft</owners> @@ -15,6 +15,8 @@ <copyright>Copyright © Microsoft Corporation</copyright> <dependencies> <dependency id="Microsoft.DiaSymReader" version="1.0.6" /> + <dependency id="Microsoft.DotNet.ObjectWriter" version="1.0.3-prerelease-00001" /> + <dependency id="Microsoft.DotNet.RyuJit" version="1.0.1-prerelease-00002" /> <dependency id="System.AppContext" version="4.0.0" /> <dependency id="System.Collections" version="4.0.10" /> <dependency id="System.Collections.Concurrent" version="4.0.10" /> diff --git a/src/ILCompiler.Compiler/src/Compiler/Compilation.cs b/src/ILCompiler.Compiler/src/Compiler/Compilation.cs index c47104fb2..5c13208c9 100644 --- a/src/ILCompiler.Compiler/src/Compiler/Compilation.cs +++ b/src/ILCompiler.Compiler/src/Compiler/Compilation.cs @@ -26,6 +26,7 @@ namespace ILCompiler public bool NoLineNumbers; public string DgmlLog; public bool FullLog; + public bool Verbose; } public partial class Compilation diff --git a/src/ILCompiler.Compiler/src/CppCodeGen/CppWriter.cs b/src/ILCompiler.Compiler/src/CppCodeGen/CppWriter.cs index b8027eef7..366be379e 100644 --- a/src/ILCompiler.Compiler/src/CppCodeGen/CppWriter.cs +++ b/src/ILCompiler.Compiler/src/CppCodeGen/CppWriter.cs @@ -845,7 +845,7 @@ namespace ILCompiler.CppCodeGen Out.WriteLine("__reverse_pinvoke_return(&frame);"); Out.WriteLine("__shutdown_runtime();"); - if (voidReturn) Out.WriteLine(voidReturn ? "return 0;" : "return ret;"); + Out.WriteLine(voidReturn ? "return 0;" : "return ret;"); Out.WriteLine("}"); } diff --git a/src/ILCompiler/src/Program.cs b/src/ILCompiler/src/Program.cs index 39677bb18..f9c6a206a 100644 --- a/src/ILCompiler/src/Program.cs +++ b/src/ILCompiler/src/Program.cs @@ -77,6 +77,10 @@ namespace ILCompiler _options.FullLog = true; break; + case "verbose": + _options.Verbose = true; + break; + case "r": case "reference": parser.AppendExpandedPaths(_referenceFilePaths, false); @@ -129,7 +133,7 @@ namespace ILCompiler } Compilation compilation = new Compilation(_compilerTypeSystemContext, _options); - compilation.Log = Console.Out; + compilation.Log = _options.Verbose ? Console.Out : TextWriter.Null; compilation.OutputPath = _outputPath; if (_options.IsCppCodeGen) { diff --git a/src/ILCompiler/src/project.json b/src/ILCompiler/src/project.json index 50e502d44..41f010f5d 100644 --- a/src/ILCompiler/src/project.json +++ b/src/ILCompiler/src/project.json @@ -19,8 +19,8 @@ "System.Collections.Immutable": "1.1.37", "System.Reflection.Metadata": "1.0.22", "System.Runtime.InteropServices.RuntimeInformation": "4.0.0-beta-23409", - "Microsoft.DotNet.RyuJit": "1.0.0-prerelease", - "Microsoft.DotNet.ObjectWriter": "1.0.2-prerelease", + "Microsoft.DotNet.RyuJit": "1.0.1-prerelease-00002", + "Microsoft.DotNet.ObjectWriter": "1.0.3-prerelease-00001", }, "frameworks": { "dotnet": { diff --git a/src/Native/Bootstrap/main.cpp b/src/Native/Bootstrap/main.cpp index bf8a39b3f..c49b2d556 100644 --- a/src/Native/Bootstrap/main.cpp +++ b/src/Native/Bootstrap/main.cpp @@ -376,13 +376,6 @@ extern "C" void RhRethrow() throw "RhRethrow"; } -#ifdef CPPCODEGEN -extern "C" void RhpBulkWriteBarrier() -{ - throw 42; -} -#endif - #ifndef CPPCODEGEN SimpleModuleHeader __module = { NULL, NULL /* &__gcStatics, &__gcStaticsDescs */ }; diff --git a/src/scripts/install-cli.ps1 b/src/scripts/install-cli.ps1 new file mode 100644 index 000000000..76ee087fb --- /dev/null +++ b/src/scripts/install-cli.ps1 @@ -0,0 +1,98 @@ +# +# Copyright (c) .NET Foundation and contributors. All rights reserved. +# Licensed under the MIT license. See LICENSE file in the project root for full license information. +# + +param ( + [string] $InstallDir = $null, + [string] $TargetPlatform = "x64" +) + +# The below code is from dotnet/cli install.ps1 + +$ErrorActionPreference="Stop" +$ProgressPreference="SilentlyContinue" + +$Feed="https://dotnetcli.blob.core.windows.net/dotnet" +$Channel="dev" +$DotNetFileName="dotnet-win-" + $TargetPlatform + ".latest.zip" +$DotNetUrl="$Feed/$Channel/Binaries/Latest" + +function say($str) +{ + Write-Host "dotnet_install: $str" +} + +if (!$InstallDir) { + $InstallDir = "$env:LocalAppData\Microsoft\dotnet" +} + +say "Preparing to install .NET Tools to $InstallDir" + +# Check if we need to bother +$LocalFile = "$InstallDir\cli\.version" +if (Test-Path $LocalFile) +{ + $LocalData = @(cat $LocalFile) + $LocalHash = $LocalData[0].Trim() + $LocalVersion = $LocalData[1].Trim() + if ($LocalVersion -and $LocalHash) + { + $RemoteResponse = Invoke-WebRequest -UseBasicParsing "$Feed/$Channel/dnvm/latest.win.version" + $RemoteData = @([Text.Encoding]::UTF8.GetString($RemoteResponse.Content).Split()); + $RemoteHash = $RemoteData[0].Trim() + $RemoteVersion = $RemoteData[1].Trim() + + if (!$RemoteVersion -or !$RemoteHash) { + throw "Invalid response from feed" + } + + say "Latest version: $RemoteVersion" + say "Local Version: $LocalVersion" + + if($LocalHash -eq $RemoteHash) + { + say "You already have the latest version" + exit 0 + } + } +} + +# Set up the install location +if (!(Test-Path $InstallDir)) { + mkdir $InstallDir | Out-Null +} + +# De-powershell the path before passing to .NET APIs +$InstallDir = Convert-Path $InstallDir + +say "Downloading $DotNetFileName from $DotNetUrl" +$resp = Invoke-WebRequest -UseBasicParsing "$DotNetUrl/$DotNetFileName" -OutFile "$InstallDir\$DotNetFileName" + +say "Extracting zip" + +# Create the destination +if (Test-Path "$InstallDir\cli_new") { + del -rec -for "$InstallDir\cli_new" +} +mkdir "$InstallDir\cli_new" | Out-Null + +Add-Type -Assembly System.IO.Compression.FileSystem | Out-Null +[System.IO.Compression.ZipFile]::ExtractToDirectory("$InstallDir\$DotNetFileName", "$InstallDir\cli_new") + +# Replace the old installation (if any) +if (Test-Path "$InstallDir\cli") { + del -rec -for "$InstallDir\cli" +} +mv "$InstallDir\cli_new" "$InstallDir\cli" + +# Clean the zip +if (Test-Path "$InstallDir\$DotNetFileName") { + del -for "$InstallDir\$DotNetFileName" +} + +say "The .NET Tools have been installed to $InstallDir\cli!" + +# New layout +say "Add '$InstallDir\cli\bin' to your PATH to use dotnet" + diff --git a/tests/restore.cmd b/tests/restore.cmd index 713e39afa..1adec1673 100644 --- a/tests/restore.cmd +++ b/tests/restore.cmd @@ -7,13 +7,9 @@ if not defined CoreRT_BuildArch ((call :Fail "Set CoreRT_BuildArch to x86/x64/ar if not defined CoreRT_BuildType ((call :Fail "Set CoreRT_BuildType to Debug or Release") & exit /b -1) set CoreRT_ToolchainPkg=toolchain.win7-%CoreRT_BuildArch%.Microsoft.DotNet.ILCompiler.Development -set CoreRT_ToolchainVer=1.0.0-prerelease +set CoreRT_ToolchainVer=1.0.2-prerelease-00001 set CoreRT_AppDepSdkPkg=toolchain.win7-%CoreRT_BuildArch%.Microsoft.DotNet.AppDep -set CoreRT_AppDepSdkVer=1.0.1-prerelease -set CoreRT_RyuJitPkg=toolchain.win7-%CoreRT_BuildArch%.Microsoft.DotNet.RyuJit -set CoreRT_RyuJitVer=1.0.0-prerelease -set CoreRT_ObjWriterPkg=toolchain.win7-%CoreRT_BuildArch%.Microsoft.DotNet.ObjectWriter -set CoreRT_ObjWriterVer=1.0.2-prerelease +set CoreRT_AppDepSdkVer=1.0.2-prerelease-00002 setlocal EnableExtensions set __ScriptDir=%~dp0 @@ -31,11 +27,6 @@ echo Invalid command line argument: %1 goto Usage :ArgsDone -:SetTempFolder -set __TempFolder=%TMP%\unpack-%RANDOM%-%RANDOM% -if exist "%__TempFolder%" goto :SetTempFolder -set __NuPkgUnpackDir=%__TempFolder% - if not exist %__NuGetExeDir%\NuGet.exe ((call :Fail "No NuGet.exe found at %__NuGetExeDir%. Specify /nugetexedir option") & exit /b -1) if "%__NuPkgInstallDir%"=="" ((call :Fail "Specify /installdir option") & exit /b -1) if not exist "%__BuiltNuPkgDir%" ((call :Fail "Specify /nupkgdir to point to the built toolchain path") & exit /b -1) @@ -55,18 +46,12 @@ echo Installing CoreRT external dependencies %__NuGetExeDir%\NuGet.exe install -Source %__NuGetFeedUrl% -OutputDir %__NuPkgInstallDir% -Version %CoreRT_AppDepSdkVer% %CoreRT_AppDepSdkPkg% -prerelease %__NuGetOptions% REM ** Install the built toolchain from product dir +set __BuiltNuPkgPath=%__BuiltNuPkgDir%\%CoreRT_ToolchainPkg%.%CoreRT_ToolchainVer%.nupkg echo. echo Installing ILCompiler from %__BuiltNuPkgPath% into %__NuPkgInstallDir% - -set __BuiltNuPkgPath=%__BuiltNuPkgDir%\%CoreRT_ToolchainPkg%.%CoreRT_ToolchainVer%.nupkg if not exist "%__BuiltNuPkgPath%" ((call :Fail "Did not find a built %__BuiltNuPkgPath%. Did you run build.cmd?") & exit /b -1) -mkdir %__NuPkgUnpackDir% -if not exist %__NuPkgUnpackDir% ((call :Fail "Could not make install dir") & exit /b -1) -copy /y %__BuiltNuPkgPath% %__NuPkgUnpackDir% > nul -echo ^<packages^>^<package id="%CoreRT_ToolchainPkg%" version="%CoreRT_ToolchainVer%"/^>^</packages^> > %__NuPkgUnpackDir%\packages.config -%__NuGetExeDir%\NuGet.exe install "%__NuPkgUnpackDir%\packages.config" -Source "%__NuPkgUnpackDir%" -OutputDir "%__NuPkgInstallDir%" -prerelease %__NuGetOptions% -rmdir /s /q %__NuPkgUnpackDir% +%__NuGetExeDir%\NuGet.exe install %CoreRT_ToolchainPkg% -Version %CoreRT_ToolchainVer% -Source "%__BuiltNuPkgDir%" -OutputDir "%__NuPkgInstallDir%" -prerelease %__NuGetOptions% set __ToolchainDir=%__NuPkgInstallDir%\%CoreRT_ToolchainPkg%.%CoreRT_ToolchainVer% diff --git a/tests/restore.sh b/tests/restore.sh new file mode 100755 index 000000000..2e080cf99 --- /dev/null +++ b/tests/restore.sh @@ -0,0 +1,113 @@ +#!/usr/bin/env bash + +usage() +{ + echo "Usage: $0 [dbg^|rel] [x86^|amd64^|arm] [-?]" + exit -8 +} + + +source $(cd "$(dirname "$0")"; pwd -P)/testenv.sh "$@" + +if [ -z ${CoreRT_BuildOS} ]; then + export CoreRT_BuildOS=Linux +fi + +if [ -z ${CoreRT_BuildArch} ]; then + echo "Set CoreRT_BuildArch to x86/x64/arm/arm64" + exit -1 +fi + +if [ -z ${CoreRT_BuildType} ]; then + echo "Set CoreRT_BuildType to Debug or Release" + exit -1 +fi + +__build_os_lowcase=$(echo "${CoreRT_BuildOS}" | tr '[:upper:]' '[:lower:]') +if [ ${__build_os_lowcase} != "osx" ]; then + __BuildRid=ubuntu.14.04 +else + __BuildRid=osx.10.10 +fi +export CoreRT_ToolchainPkg=toolchain.${__BuildRid}-${CoreRT_BuildArch}.Microsoft.DotNet.ILCompiler.Development +export CoreRT_ToolchainVer=1.0.2-prerelease-00001 +export CoreRT_AppDepSdkPkg=toolchain.${__BuildRid}-${CoreRT_BuildArch}.Microsoft.DotNet.AppDep +export CoreRT_AppDepSdkVer=1.0.2-prerelease-00002 + +__ScriptDir=$(cd "$(dirname "$0")"; pwd -P) +__BuildStr=${CoreRT_BuildOS}.${CoreRT_BuildArch}.${CoreRT_BuildType} + +while test $# -gt 0 + do + lowerI="$(echo $1 | awk '{print tolower($0)}')" + case $lowerI in + -h|-help) + usage + exit 1 + ;; + -nugetexedir) + shift + __NuGetExeDir=$1 + ;; + -nupkgdir) + shift + __BuiltNuPkgDir=$1 + ;; + -installdir) + shift + __NuPkgInstallDir=$1 + ;; + -nugetopt) + shift + __NuGetOptions=$1 + ;; + *) + ;; + esac + shift +done + +if [ ! -f ${__NuGetExeDir}/NuGet.exe ] ; then + echo "No NuGet.exe found at ${__NuGetExeDir}. Specify -nugetexedir option" + exit -1 +fi + +if [ -z ${__NuPkgInstallDir} ] ; then + echo "Specify -installdir option" + exit -1 +fi + +if [ ! -d ${__BuiltNuPkgDir} ] ; then + echo "Specify -nupkgdir to point to the build toolchain path" + echo ${__BuiltNuPkgDir} + exit -1 +fi + +echo "Cleaning up ${__NuPkgInstallDir}" +rm -rf ${__NuPkgInstallDir} +mkdir -p ${__NuPkgInstallDir} +if [ ! -d ${__NuPkgInstallDir} ]; then + echo "Could not make install dir" + exit -1 +fi + +__NuGetFeedUrl="https://www.myget.org/F/dotnet/auth/3e4f1dbe-f43a-45a8-b029-3ad4d25605ac/api/v2" + +echo Installing CoreRT external dependencies +mono ${__NuGetExeDir}/NuGet.exe install -Source ${__NuGetFeedUrl} -OutputDir ${__NuPkgInstallDir} -Version ${CoreRT_AppDepSdkVer} ${CoreRT_AppDepSdkPkg} -prerelease ${__NuGetOptions} -nocache + +__BuiltNuPkgPath=${__BuiltNuPkgDir}/${CoreRT_ToolchainPkg}.${CoreRT_ToolchainVer}.nupkg +echo Installing ILCompiler from ${__BuiltNuPkgPath} into ${__NuPkgInstallDir} + +if [ ! -f ${__BuiltNuPkgPath} ]; then + echo "Did not find a build ${__BuiltNuPkgPath}. Did you run build.sh?" + exit -1 +fi + +mono ${__NuGetExeDir}/NuGet.exe install -Source "${__BuiltNuPkgDir}" -OutputDir "${__NuPkgInstallDir}" ${CoreRT_ToolchainPkg} -Version ${CoreRT_ToolchainVer} -prerelease ${__NuGetOptions} +chmod +x ${__NuPkgInstallDir}/${CoreRT_ToolchainPkg}.${CoreRT_ToolchainVer}/corerun + +export CoreRT_AppDepSdkDir=${__NuPkgInstallDir}/${CoreRT_AppDepSdkPkg}.${CoreRT_AppDepSdkVer} +export CoreRT_ToolchainDir=${__NuPkgInstallDir}/${CoreRT_ToolchainPkg}.${CoreRT_ToolchainVer} +export CoreRT_RyuJitDir=${CoreRT_ToolchainDir} +export CoreRT_ObjWriterDir=${CoreRT_ToolchainDir} diff --git a/tests/runtest.cmd b/tests/runtest.cmd index 644c2d057..f241c49c9 100644 --- a/tests/runtest.cmd +++ b/tests/runtest.cmd @@ -1,6 +1,7 @@ @echo off set CoreRT_TestRoot=%~dp0 +set CoreRT_CliDir=%CoreRT_TestRoot%..\bin\tools\cli\bin set CoreRT_BuildArch=x64 set CoreRT_BuildType=Debug set CoreRT_BuildOS=Windows_NT @@ -40,9 +41,9 @@ exit /b 2 setlocal EnableDelayedExpansion set __BuildStr=%CoreRT_BuildOS%.%CoreRT_BuildArch%.%CoreRT_BuildType% -set __BinDir=%CoreRT_TestRoot%..\bin\tests +set __TestBinDir=%CoreRT_TestRoot%..\bin\tests set __LogDir=%CoreRT_TestRoot%\..\bin\Logs\%__BuildStr%\tests -set __NuPkgInstallDir=%__BinDir%\package +set __NuPkgInstallDir=%__TestBinDir%\package set __BuiltNuPkgDir=%CoreRT_TestRoot%..\bin\Product\%__BuildStr%\.nuget set __PackageRestoreCmd=restore.cmd @@ -66,67 +67,85 @@ if /i "%__BuildType%"=="Debug" ( set __LinkLibs=msvcrt.lib ) -echo. > %__BinDir%\testResults.tmp +echo. > %__TestBinDir%\testResults.tmp -set /a __TotalTests=0 -set /a __PassedTests=0 +set /a __CppTotalTests=0 +set /a __CppPassedTests=0 +set /a __JitTotalTests=0 +set /a __JitPassedTests=0 for /f "delims=" %%a in ('dir /s /aD /b src\*') do ( set __SourceFolder=%%a set __SourceFileName=%%~na set __RelativePath=!__SourceFolder:%CoreRT_TestRoot%=! - if exist "!__SourceFolder!\!__SourceFileName!.cs" ( + if exist "!__SourceFolder!\project.json" ( + %CoreRT_CliDir%\dotnet restore !__SourceFolder! + + set __Mode=Jit call :CompileFile !__SourceFolder! !__SourceFileName! %__LogDir%\!__RelativePath! - set /a __TotalTests=!__TotalTests!+1 - ) else (echo !__SourceFolder!\!__SourceFileName!) -) -set /a __FailedTests=%__TotalTests%-%__PassedTests% + set /a __JitTotalTests=!__JitTotalTests!+1 -echo ^<?xml version="1.0" encoding="utf-8"?^> > %__BinDir%\testResults.xml -echo ^<assemblies^> >> %__BinDir%\testResults.xml -echo ^<assembly name="ILCompiler" total="%__TotalTests%" passed="%__PassedTests%" failed="%__FailedTests%" skipped="0"^> >> %__BinDir%\testResults.xml -echo ^<collection total="%__TotalTests%" passed="%__PassedTests%" failed="%__FailedTests%" skipped="0"^> >> %__BinDir%\testResults.xml -type %__BinDir%\testResults.tmp >> %__BinDir%\testResults.xml -echo ^</collection^> >> %__BinDir%\testResults.xml -echo ^</assembly^> >> %__BinDir%\testResults.xml -echo ^</assemblies^> >> %__BinDir%\testResults.xml + set __Mode=Cpp + call :CompileFile !__SourceFolder! !__SourceFileName! %__LogDir%\!__RelativePath! --cpp + set /a __CppTotalTests=!__CppTotalTests!+1 + ) +) +set /a __CppFailedTests=%__CppTotalTests%-%__CppPassedTests% +set /a __JitFailedTests=%__JitTotalTests%-%__JitPassedTests% +set /a __TotalTests=%__JitTotalTests%+%__CppTotalTests% +set /a __PassedTests=%__JitPassedTests%+%__CppPassedTests% +set /a __FailedTests=%__JitFailedTests%+%__CppFailedTests% + +echo ^<?xml version="1.0" encoding="utf-8"?^> > %__TestBinDir%\testResults.xml +echo ^<assemblies^> >> %__TestBinDir%\testResults.xml +echo ^<assembly name="ILCompiler" total="%__TotalTests%" passed="%__PassedTests%" failed="%__FailedTests%" skipped="0"^> >> %__TestBinDir%\testResults.xml +echo ^<collection total="%__TotalTests%" passed="%__PassedTests%" failed="%__FailedTests%" skipped="0"^> >> %__TestBinDir%\testResults.xml +type %__TestBinDir%\testResults.tmp >> %__TestBinDir%\testResults.xml +echo ^</collection^> >> %__TestBinDir%\testResults.xml +echo ^</assembly^> >> %__TestBinDir%\testResults.xml +echo ^</assemblies^> >> %__TestBinDir%\testResults.xml echo. -set "__ConsoleOut=TOTAL: %__TotalTests% PASSED: %__PassedTests%" - -if %__TotalTests% EQU %__PassedTests% (set __StatusPassed=1) -if %__TotalTests% EQU 0 (set __StatusPassed=0) -if "%__StatusPassed%"=="1" ( - powershell -Command Write-Host "%__ConsoleOut%" -foreground "Black" -background "Green" - exit /b 0 +set __JitStatusPassed=0 +if %__JitTotalTests% EQU %__JitPassedTests% (set __JitStatusPassed=1) +if %__JitTotalTests% EQU 0 (set __JitStatusPassed=0) +call :PassFail %__JitStatusPassed% "JIT - TOTAL: %__JitTotalTests% PASSED: %__JitPassedTests%" + +set __CppStatusPassed=0 +if %__CppTotalTests% EQU %__CppPassedTests% (set __CppStatusPassed=1) +if %__CppTotalTests% EQU 0 (set __CppStatusPassed=0) +call :PassFail %__CppStatusPassed% "CPP - TOTAL: %__CppTotalTests% PASSED: %__CppPassedTests%" + +if not %__JitStatusPassed% EQU 1 (exit /b 1) +if not %__CppStatusPassed% EQU 1 (exit /b 1) +exit /b 0 + +:PassFail +set __Green=%~1 +set __OutStr=%~2 +if "%__Green%"=="1" ( + powershell -Command Write-Host %__OutStr% -foreground "Black" -background "Green" ) else ( - powershell -Command Write-Host "%__ConsoleOut%" -foreground "White" -background "Red" - exit /b 1 + powershell -Command Write-Host %__OutStr% -foreground "White" -background "Red" ) +goto :eof :CompileFile echo. - echo Compiling directory %~1 set __SourceFolder=%~1 set __SourceFileName=%~2 set __CompileLogPath=%~3 + set __ExtraCompileArgs=%~4 + echo Compiling directory !__SourceFolder! !__ExtraCompileArgs! if not exist "!__CompileLogPath!" (mkdir !__CompileLogPath!) - endlocal set __SourceFile=!__SourceFolder!\!__SourceFileName! - call :DeleteFile "!__SourceFile!.S" - call :DeleteFile "!__SourceFile!.compiled.exe" - call :DeleteFile "!__SourceFile!.obj" - call :DeleteFile "!__SourceFile!.exe" - set __VSProductVersion=140 - setlocal - echo. - echo Begin managed build of !__SourceFile!.cs - call "!VS%__VSProductVersion%COMNTOOLS!\VsDevCmd.bat" - csc.exe /nologo /noconfig /unsafe+ /nowarn:1701,1702,2008 /langversion:5 /nostdlib+ /errorreport:prompt /warn:4 /define:TRACE;DEBUG;SIGNED /errorendlocation /preferreduilang:en-US /reference:..\packages\System.Collections\4.0.0\ref\dotnet\System.Collections.dll /reference:..\packages\System.Console\4.0.0-beta-23419\ref\dotnet\System.Console.dll /reference:..\packages\System.Diagnostics.Debug\4.0.0\ref\dotnet\System.Diagnostics.Debug.dll /reference:..\packages\System.Globalization\4.0.0\ref\dotnet\System.Globalization.dll /reference:..\packages\System.IO\4.0.10\ref\dotnet\System.IO.dll /reference:..\packages\System.IO.FileSystem\4.0.0\ref\dotnet\System.IO.FileSystem.dll /reference:..\packages\System.IO.FileSystem.Primitives\4.0.0\ref\dotnet\System.IO.FileSystem.Primitives.dll /reference:..\packages\System.Reflection\4.0.0\ref\dotnet\System.Reflection.dll /reference:..\packages\System.Reflection.Extensions\4.0.0\ref\dotnet\System.Reflection.Extensions.dll /reference:..\packages\System.Reflection.Primitives\4.0.0\ref\dotnet\System.Reflection.Primitives.dll /reference:..\packages\System.Resources.ResourceManager\4.0.0\ref\dotnet\System.Resources.ResourceManager.dll /reference:..\packages\System.Runtime\4.0.20\ref\dotnet\System.Runtime.dll /reference:..\packages\System.Runtime.Extensions\4.0.10\ref\dotnet\System.Runtime.Extensions.dll /reference:..\packages\System.Runtime.Handles\4.0.0\ref\dotnet\System.Runtime.Handles.dll /reference:..\packages\System.Runtime.InteropServices\4.0.10\ref\dotnet\System.Runtime.InteropServices.dll /reference:..\packages\System.Text.Encoding\4.0.0\ref\dotnet\System.Text.Encoding.dll /reference:..\packages\System.Text.Encoding.Extensions\4.0.0\ref\dotnet\System.Text.Encoding.Extensions.dll /reference:..\packages\System.Threading\4.0.0\ref\dotnet\System.Threading.dll /reference:..\packages\System.Threading.Overlapped\4.0.0\ref\dotnet\System.Threading.Overlapped.dll /reference:..\packages\System.Threading.Tasks\4.0.10\ref\dotnet\System.Threading.Tasks.dll /debug+ /debug:full /filealign:512 /optimize- /out:!__SourceFile!.exe /target:exe /warnaserror+ /utf8output !__SourceFile!.cs + rmdir /s /q !__SourceFolder!\bin + rmdir /s /q !__SourceFolder!\obj - echo. - echo Compiling ILCompiler !__SourceFile!.exe - call !CoreRT_ToolchainDir!\dotnet-compile-native.bat %__BuildArch% %__BuildType% /mode %CoreRT_TestCompileMode% /appdepsdk %CoreRT_AppDepSdkDir% /codegenpath %CoreRT_RyuJitDir% /objgenpath %CoreRT_ObjWriterDir% /logpath %__CompileLogPath% /linklibs %__LinkLibs% /in !__SourceFile!.exe /out !__SourceFile!.compiled.exe + setlocal + REM TODO: Add AppDepSDK argument after CLI build picks up: PR dotnet/cli #336 + call "!VS140COMNTOOLS!\..\..\VC\vcvarsall.bat" %CoreRT_BuildArch% + "%CoreRT_CliDir%\dotnet" compile --native --ilcpath "%CoreRT_ToolchainDir%" !__ExtraCompileArgs! !__SourceFolder! -c %CoreRT_BuildType% endlocal set __SavedErrorLevel=%ErrorLevel% @@ -135,20 +154,20 @@ if "%__StatusPassed%"=="1" ( if "%__SavedErrorLevel%"=="0" ( echo. echo Running test !__SourceFileName! - call !__SourceFile!.cmd + call !__SourceFile!.cmd %CoreRT_BuildType% set __SavedErrorLevel=!ErrorLevel! ) :SkipTestRun if "%__SavedErrorLevel%"=="0" ( - set /a __PassedTests=%__PassedTests%+1 - echo ^<test name="!__SourceFile!" type="Program" method="Main" result="Pass" /^> >> %__BinDir%\testResults.tmp + set /a __%__Mode%PassedTests=!__%__Mode%PassedTests!+1 + echo ^<test name="!__SourceFile!" type="!__SourceFileName!:%__Mode%" method="Main" result="Pass" /^> >> %__TestBinDir%\testResults.tmp ) ELSE ( - echo ^<test name="!__SourceFile!" type="Program" method="Main" result="Fail"^> >> %__BinDir%\testResults.tmp - echo ^<failure exception-type="Exit code: %ERRORLEVEL%" ^> >> %__BinDir%\testResults.tmp - echo ^<message^>See !__SourceFile!.*.log ^</message^> >> %__BinDir%\testResults.tmp - echo ^</failure^> >> %__BinDir%\testResults.tmp - echo ^</test^> >> %__BinDir%\testResults.tmp + echo ^<test name="!__SourceFile!" type="!__SourceFileName!:%__Mode%" method="Main" result="Fail"^> >> %__TestBinDir%\testResults.tmp + echo ^<failure exception-type="Exit code: %ERRORLEVEL%" ^> >> %__TestBinDir%\testResults.tmp + echo ^<message^>See !__SourceFile! \bin or \obj for logs ^</message^> >> %__TestBinDir%\testResults.tmp + echo ^</failure^> >> %__TestBinDir%\testResults.tmp + echo ^</test^> >> %__TestBinDir%\testResults.tmp ) goto :eof diff --git a/tests/runtest.sh b/tests/runtest.sh new file mode 100755 index 000000000..43d8c3de3 --- /dev/null +++ b/tests/runtest.sh @@ -0,0 +1,219 @@ +#!/usr/bin/env bash + +usage() +{ + echo "Usage: $0 [OS] [arch] [flavor] [-extrepo] [-buildextrepo] [-mode] [-runtest]" + echo " -mode : Compilation mode. Specify cpp/ryujit. Default: ryujit" + echo " -runtest : Should just compile or run compiled bianry? Specify: true/false. Default: true." + echo " -extrepo : Path to external repo, currently supports: GitHub: dotnet/coreclr. Specify full path. If unspecified, runs corert tests" + echo " -buildextrepo : Should build at root level of external repo? Specify: true/false. Default: true" + echo " -nocache : When restoring toolchain packages, obtain them from the feed not the cache." + exit 1 +} + +runtest() +{ + echo "Running test $1 $2" + __SourceFolder=$1 + __SourceFileName=$2 + __SourceFile=${__SourceFolder}/${__SourceFileName} + ${__SourceFile}.sh $1 $2 ${CoreRT_BuildType} + return $? +} + +restore() +{ + ${CoreRT_CliBinDir}/dotnet restore $1 +} + +compiletest() +{ + echo "Compiling dir $1 with dotnet compile $2" + rm -rf $1/bin $1/obj + ${CoreRT_CliBinDir}/dotnet compile --native -c ${CoreRT_BuildType} --ilcpath ${CoreRT_ToolchainDir} $1 $2 +} + +run_test_dir() +{ + local __test_dir=$1 + local __restore=$2 + local __mode=$3 + local __dir_path=`dirname ${__test_dir}` + local __filename=`basename ${__dir_path}` + if [ ${__restore} == 1 ]; then + restore ${__dir_path} + fi + local __compile_args="" + if [ "${__mode}" = "Cpp" ]; then + __compile_args="--cpp" + fi + compiletest ${__dir_path} ${__compile_args} + runtest ${__dir_path} ${__filename} + local __exitcode=$? + if [ ${__exitcode} == 0 ]; then + local __pass_var=__${__mode}PassedTests + eval ${__pass_var}=$((${__pass_var} + 1)) + echo "<test name=\"${__dir_path}\" type=\"${__filename}:${__mode}\" method=\"Main\" result=\"Pass\" />" >> ${__TestBinDir}/testResults.tmp + else + echo "<test name=\"${__dir_path}\" type=\"${__filename}:${__mode}\" method=\"Main\" result=\"Fail\" />" >> ${__TestBinDir}/testResults.tmp + echo "<failure exception-type=\"Exit code: ${__exitcode}\">" >> ${__TestBinDir}/testResults.tmp + echo "<message>See ${__dir_path} /bin or /obj for logs </message>" >> ${__TestBinDir}/testResults.tmp + echo "</failure>" >> ${__TestBinDir}/testResults.tmp + echo "</test>" >> ${__TestBinDir}/testResults.tmp + fi + local __total_var=__${__mode}TotalTests + eval ${__total_var}=$((${__total_var} + 1)) + return $? +} + +CoreRT_TestRoot=$(cd "$(dirname "$0")"; pwd -P) +CoreRT_CliBinDir=${CoreRT_TestRoot}/../bin/tools/cli/bin +CoreRT_BuildArch=x64 +CoreRT_BuildType=Debug +CoreRT_TestRun=true +CoreRT_TestCompileMode=ryujit +CoreRT_TestExtRepo= +CoreRT_BuildExtRepo= + +# Use uname to determine what the OS is. +OSName=$(uname -s) +case $OSName in + Linux) + CoreRT_BuildOS=Linux + ;; + + Darwin) + CoreRT_BuildOS=OSX + ;; + + FreeBSD) + CoreRT_BuildOS=FreeBSD + ;; + + *) + echo "Unsupported OS $OSName detected, configuring as if for Linux" + CoreRT_BuildOS=Linux + ;; +esac + +for i in "$@" + do + lowerI="$(echo $i | awk '{print tolower($0)}')" + case $lowerI in + -?|-h|--help) + usage + exit 1 + ;; + x86) + CoreRT_BuildArch=x86 + ;; + x64) + CoreRT_BuildArch=x64 + ;; + arm) + CoreRT_BuildArch=arm + ;; + arm64) + CoreRT_BuildArch=arm64 + ;; + debug) + CoreRT_BuildType=Debug + ;; + release) + CoreRT_BuildType=Release + ;; + -extrepo) + shift + CoreRT_TestExtRepo=$i + ;; + -mode) + shift + CoreRT_TestCompileMode=$i + ;; + -runtest) + shift + CoreRT_TestRun=$i + ;; + -nocache) + CoreRT_NuGetOptions=-nocache + ;; + *) + ;; + esac +done + +__BuildStr=${CoreRT_BuildOS}.${CoreRT_BuildArch}.${CoreRT_BuildType} +__TestBinDir=${CoreRT_TestRoot}/../bin/tests +__LogDir=${CoreRT_TestRoot}/../bin/Logs/${__BuildStr}/tests +__NuPkgInstallDir=${__TestBinDir}/package +__BuiltNuPkgDir=${CoreRT_TestRoot}/../bin/Product/${__BuildStr}/.nuget +__PackageRestoreCmd=$CoreRT_TestRoot/restore.sh +source ${__PackageRestoreCmd} -nugetexedir ${CoreRT_TestRoot}/../packages -installdir ${__NuPkgInstallDir} -nupkgdir ${__BuiltNuPkgDir} -nugetopt ${CoreRT_NuGetOptions} + +if [ ! -d ${CoreRT_AppDepSdkDir} ]; then + echo "AppDep SDK not installed at ${CoreRT_AppDepSdkDir}" + exit -1 +fi + +if [ ! -d ${CoreRT_ToolchainDir} ]; then + echo "Toolchain not found in ${CoreRT_ToolchainDir}" + exit -1 +fi + +__CppTotalTests=0 +__CppPassedTests=0 +__JitTotalTests=0 +__JitPassedTests=0 + +echo > ${__TestBinDir}/testResults.tmp + +__BuildOsLowcase=$(echo "${CoreRT_BuildOS}" | tr '[:upper:]' '[:lower:]') + +for json in $(find src -iname 'project.json') +do + __restore=1 + # Disable RyuJIT for OSX. + if [ ${__BuildOsLowcase} != "osx" ]; then + run_test_dir ${json} ${__restore} "Jit" + __restore=0 + fi + run_test_dir ${json} ${__restore} "Cpp" +done + +__TotalTests=$((${__JitTotalTests} + ${__CppTotalTests})) +__PassedTests=$((${__JitPassedTests} + ${__CppPassedTests})) +__FailedTests=$((${__TotalTests} - ${__PassedTests})) + +echo "<?xml version=\"1.0\" encoding=\"utf-8\"?^>" > ${__TestBinDir}/testResults.xml +echo "<assemblies>" >> ${__TestBinDir}/testResults.xml +echo "<assembly name=\"ILCompiler\" total=\"${__TotalTests}\" passed=\"${__PassedTests}\" failed=\"${__FailedTests}\" skipped=\"0\">" >> ${__TestBinDir}/testResults.xml +echo "<collection total=\"${__TotalTests}\" passed=\"${__PassedTests}\" failed=\"${__FailedTests}\" skipped=\"0\">" >> ${__TestBinDir}/testResults.xml +cat "${__TestBinDir}/testResults.tmp" >> ${__TestBinDir}/testResults.xml +echo "</collection>" >> ${__TestBinDir}/testResults.xml +echo "</assembly>" >> ${__TestBinDir}/testResults.xml +echo "</assemblies>" >> ${__TestBinDir}/testResults.xml + + +echo "JIT - TOTAL: ${__JitTotalTests} PASSED: ${__JitPassedTests}" +echo "CPP - TOTAL: ${__CppTotalTests} PASSED: ${__CppPassedTests}" + +# Disable RyuJIT for OSX. +if [ ${__BuildOsLowcase} != "osx" ]; then + if [ ${__JitTotalTests} == 0 ]; then + exit 1 + fi +fi + +if [ ${__CppTotalTests} == 0 ]; then + exit 1 +fi +if [ ${__JitTotalTests} -gt ${__JitPassedTests} ]; then + exit 1 +fi +if [ ${__CppTotalTests} -gt ${__CppPassedTests} ]; then + exit 1 +fi + +exit 0 + + diff --git a/tests/src/Simple/Add1/Add1.cmd b/tests/src/Simple/Add1/Add1.cmd index a5a423e4f..c56cb5cd8 100644 --- a/tests/src/Simple/Add1/Add1.cmd +++ b/tests/src/Simple/Add1/Add1.cmd @@ -1,6 +1,6 @@ @echo off setlocal -%~dp0\%~n0.compiled.exe +%~dp0\bin\%1\dnxcore50\native\%~n0.exe set ErrorCode=%ERRORLEVEL% IF "%ErrorCode%"=="100" ( echo %~n0: pass diff --git a/tests/src/Simple/Add1/Add1.sh b/tests/src/Simple/Add1/Add1.sh new file mode 100755 index 000000000..9db770428 --- /dev/null +++ b/tests/src/Simple/Add1/Add1.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +$1/bin/$3/dnxcore50/native/$2 +if [ $? == 100 ]; then + echo pass + exit 0 +else + echo fail + exit 1 +fi diff --git a/tests/src/Simple/Add1/project.json b/tests/src/Simple/Add1/project.json new file mode 100644 index 000000000..f28ba3972 --- /dev/null +++ b/tests/src/Simple/Add1/project.json @@ -0,0 +1,15 @@ +{ + "version": "1.0.0-*", + "compilationOptions": { + "emitEntryPoint": true + }, + + "dependencies": { + "System.Console": "4.0.0-beta-*", + "System.Runtime": "4.0.21-beta-*" + }, + + "frameworks": { + "dnxcore50": { } + } +} diff --git a/tests/src/Simple/AsgAdd1/AsgAdd1.cmd b/tests/src/Simple/AsgAdd1/AsgAdd1.cmd index 9a8965945..d1eb3e147 100644 --- a/tests/src/Simple/AsgAdd1/AsgAdd1.cmd +++ b/tests/src/Simple/AsgAdd1/AsgAdd1.cmd @@ -1,6 +1,6 @@ @echo off setlocal -%~dp0\%~n0.compiled.exe +%~dp0\bin\%1\dnxcore50\native\%~n0.exe set ErrorCode=%ERRORLEVEL% IF "%ErrorCode%"=="100" ( echo %~n0: pass diff --git a/tests/src/Simple/AsgAdd1/AsgAdd1.sh b/tests/src/Simple/AsgAdd1/AsgAdd1.sh new file mode 100755 index 000000000..9db770428 --- /dev/null +++ b/tests/src/Simple/AsgAdd1/AsgAdd1.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +$1/bin/$3/dnxcore50/native/$2 +if [ $? == 100 ]; then + echo pass + exit 0 +else + echo fail + exit 1 +fi diff --git a/tests/src/Simple/AsgAdd1/project.json b/tests/src/Simple/AsgAdd1/project.json new file mode 100644 index 000000000..f28ba3972 --- /dev/null +++ b/tests/src/Simple/AsgAdd1/project.json @@ -0,0 +1,15 @@ +{ + "version": "1.0.0-*", + "compilationOptions": { + "emitEntryPoint": true + }, + + "dependencies": { + "System.Console": "4.0.0-beta-*", + "System.Runtime": "4.0.21-beta-*" + }, + + "frameworks": { + "dnxcore50": { } + } +} diff --git a/tests/src/Simple/Hello/Hello.cmd b/tests/src/Simple/Hello/Hello.cmd index 91298c750..b49b82e22 100644 --- a/tests/src/Simple/Hello/Hello.cmd +++ b/tests/src/Simple/Hello/Hello.cmd @@ -1,7 +1,7 @@ @echo off setlocal set ErrorCode=100 -for /f "usebackq delims=;" %%F in (`%~dp0\%~n0.compiled.exe`) do ( +for /f "usebackq delims=;" %%F in (`%~dp0\bin\%1\dnxcore50\native\%~n0.exe`) do ( if "%%F"=="Hello world" set ErrorCode=0 ) IF "%ErrorCode%"=="0" ( diff --git a/tests/src/Simple/Hello/Hello.sh b/tests/src/Simple/Hello/Hello.sh new file mode 100755 index 000000000..c7facb6ea --- /dev/null +++ b/tests/src/Simple/Hello/Hello.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +dir=$1 +file=$2 +cmp=`$dir/bin/$3/dnxcore50/native/$file | tr '\r' ';'` +if [[ $cmp = "Hello world;" ]]; then + echo pass + exit 0 +else + echo fail + exit 1 +fi diff --git a/tests/src/Simple/Hello/project.json b/tests/src/Simple/Hello/project.json new file mode 100644 index 000000000..f28ba3972 --- /dev/null +++ b/tests/src/Simple/Hello/project.json @@ -0,0 +1,15 @@ +{ + "version": "1.0.0-*", + "compilationOptions": { + "emitEntryPoint": true + }, + + "dependencies": { + "System.Console": "4.0.0-beta-*", + "System.Runtime": "4.0.21-beta-*" + }, + + "frameworks": { + "dnxcore50": { } + } +} diff --git a/tests/testenv.sh b/tests/testenv.sh new file mode 100755 index 000000000..ff98e7111 --- /dev/null +++ b/tests/testenv.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash + +usage() +{ + echo "$0 [arch: x86/x64/arm/arm64] [flavor: debug/release]" + exit 1 + +} + +for i in "$@" + do + lowerI="$(echo $i | awk '{print tolower($0)}')" + case $lowerI in + -?|-h|-help) + usage + exit 1 + ;; + x86) + export CoreRT_BuildArch=x86 + ;; + x64) + export CoreRT_BuildArch=x64 + ;; + arm) + export CoreRT_BuildArch=arm + ;; + arm64) + export CoreRT_BuildArch=arm64 + ;; + dbg) + export CoreRT_BuildType=Debug + ;; + debug) + export CoreRT_BuildType=Debug + ;; + rel) + export CoreRT_BuildType=Release + ;; + release) + export CoreRT_BuildType=Release + ;; + *) + ;; + esac +done |