public class Benchmark
{
public string Name;
- public bool ShouldRun;
+ public bool doRun;
+ public bool runByDefault;
public string ProjFile;
public string UnlinkedDir;
public string LinkedDir;
private double certDiff;
const double MB = 1024 * 1024;
- public Benchmark(string _Name, string _UnlinkedDir, string _LinkedDir, SetupDelegate _setup = null, bool _shouldRun = false)
+ public Benchmark(string _Name, string _UnlinkedDir, string _LinkedDir, SetupDelegate _setup = null, bool _default = true)
{
Name = _Name;
UnlinkedDir = _UnlinkedDir;
LinkedDir = _LinkedDir;
unlinkedDirInfo = new DirectoryInfo(UnlinkedDir);
linkedDirInfo = new DirectoryInfo(LinkedDir);
- ShouldRun = _shouldRun;
+ doRun = false;
+ runByDefault = _default;
Setup = _setup;
}
public void SetToRun()
{
- ShouldRun = true;
+ doRun = true;
Environment.SetEnvironmentVariable("__test_" + Name, "true");
}
var xdoc = XDocument.Load(csproj);
var ns = xdoc.Root.GetDefaultNamespace();
bool added = false;
+ string illinkTasksVersion = "0.1.4-preview-981901";
foreach (var el in xdoc.Root.Elements(ns + "ItemGroup"))
{
if (el.Elements(ns + "PackageReference").Any())
{
el.Add(new XElement(ns + "PackageReference",
new XAttribute("Include", "ILLink.Tasks"),
- new XAttribute("Version", "0.1.4-preview")));
+ new XAttribute("Version", illinkTasksVersion)));
added = true;
break;
}
xdoc.Root.Add(new XElement(ns + "ItemGroup",
new XElement(ns + "PackageReference",
new XAttribute("Include", "ILLink.Tasks"),
- new XAttribute("Version", "0.1.4-preview-737646"))));
+ new XAttribute("Version", illinkTasksVersion))));
added = true;
}
using (var fs = new FileStream(csproj, FileMode.Create))
private static Benchmark[] Benchmarks =
{
+ // If no benchmark name is specified at the command line,
+ // all benchmarks are set to be run by default.
+ // However, some temporary exceptions are noted below, if any:
+ // CoreFX is not enabled by default, because the lab cannot run it yet.
+ // Jenkins runs on an older OS with path-length limit, which causes CoreFX build to fail.
+ // MusicStore build currently has a failure, turned off till it is fixed.
+
new Benchmark("HelloWorld",
"HelloWorld\\bin\\release\\netcoreapp2.0\\win10-x64\\unlinked",
"HelloWorld\\bin\\release\\netcoreapp2.0\\win10-x64\\linked",
- () => Benchmark.AddLinkerReference("HelloWorld\\HelloWorld.csproj")),
+ () => Benchmark.AddLinkerReference("HelloWorld\\HelloWorld.csproj"), true),
new Benchmark("WebAPI",
"WebAPI\\bin\\release\\netcoreapp2.0\\win10-x64\\unlinked",
"WebAPI\\bin\\release\\netcoreapp2.0\\win10-x64\\linked",
() => { Benchmark.AddLinkerReference("WebAPI\\WebAPI.csproj");
- Benchmark.PreventPublishFiltering("WebAPI\\WebAPI.csproj"); }),
+ Benchmark.PreventPublishFiltering("WebAPI\\WebAPI.csproj"); }, true),
new Benchmark("MusicStore",
"JitBench\\src\\MusicStore\\bin\\release\\netcoreapp2.0\\win10-x64\\unlinked",
"JitBench\\src\\MusicStore\\bin\\release\\netcoreapp2.0\\win10-x64\\linked",
() => { Benchmark.AddLinkerReference("JitBench\\src\\MusicStore\\MusicStore.csproj");
- Benchmark.SetRuntimeFrameworkVersion("JitBench\\src\\MusicStore\\MusicStore.csproj"); }),
+ Benchmark.SetRuntimeFrameworkVersion("JitBench\\src\\MusicStore\\MusicStore.csproj"); }, false),
new Benchmark("MusicStore_R2R",
"JitBench\\src\\MusicStore\\bin\\release\\netcoreapp2.0\\win10-x64\\R2R\\unlinked",
- "JitBench\\src\\MusicStore\\bin\\release\\netcoreapp2.0\\win10-x64\\R2R\\linked"),
+ "JitBench\\src\\MusicStore\\bin\\release\\netcoreapp2.0\\win10-x64\\R2R\\linked", null, false),
new Benchmark("Corefx",
"corefx\\bin\\ILLinkTrimAssembly\\netcoreapp-Windows_NT-Release-x64\\pretrimmed",
- "corefx\\bin\\ILLinkTrimAssembly\\netcoreapp-Windows_NT-Release-x64\\trimmed"),
+ "corefx\\bin\\ILLinkTrimAssembly\\netcoreapp-Windows_NT-Release-x64\\trimmed", null, false),
new Benchmark("Roslyn",
- "roslyn\\Binaries\\Release\\Exes\\CscCore\\win7-x64\\publish",
- "roslyn\\Binaries\\Release\\Exes\\CscCore\\win7-x64\\Linked")
+ "roslyn\\Binaries\\release\\Exes\\csc\\netcoreapp2.0\\win10-x64\\Unlinked",
+ "roslyn\\Binaries\\release\\Exes\\csc\\netcoreapp2.0\\win10-x64\\Linked",
+ () => Benchmark.AddLinkerReference("roslyn\\src\\Compilers\\CSharp\\csc\\csc.csproj"), true)
};
static int UsageError()
bool doSetup = true;
bool doBuild = true;
string runId = "";
- string outputdir = "";
+ string outputdir = ".";
string runOne = null;
bool benchmarkSpecified = false;
}
}
- // If benchmarks are not explicitly specified, run all benchmarks
+ // If benchmarks are not explicitly specified, run the default set of benchmarks
if (!benchmarkSpecified)
{
foreach (Benchmark benchmark in Benchmarks)
{
- if (String.Compare(benchmark.Name, "CoreFX", true) == 0)
+ if (benchmark.runByDefault)
{
- // CoreFX is not enabled by default, because the lab cannot run it yet.
- // Jenkins runs on an older OS with path-length limit, which causes
- // CoreFX build to fail.
- continue;
+ benchmark.SetToRun();
}
-
- benchmark.SetToRun();
}
}
Environment.SetEnvironmentVariable("LinkBenchRoot", LinkBenchRoot);
Environment.SetEnvironmentVariable("__dotnet", LinkBenchRoot + "\\.Net\\dotnet.exe");
- Environment.SetEnvironmentVariable("__dotnet1", LinkBenchRoot + "\\.Net1\\dotnet.exe");
+ Environment.SetEnvironmentVariable("__dotnet2", LinkBenchRoot + "\\.Net2\\dotnet.exe");
+
// Update the build files to facilitate the link step
if (doSetup)
foreach (Benchmark benchmark in Benchmarks)
{
- if (benchmark.ShouldRun && benchmark.Setup != null)
+ if (benchmark.doRun && benchmark.Setup != null)
{
benchmark.Setup();
}
for (int i = 0; i < Benchmarks.Length; i++)
{
CurrentBenchmark = Benchmarks[i];
- if (!CurrentBenchmark.ShouldRun)
+ if (!CurrentBenchmark.doRun)
{
continue;
}
:Roslyn
echo Build ** Roslyn **
-pushd %LinkBenchRoot%\roslyn
-
-REM Fetch ILLink
-if not exist illink mkdir illink
-cd illink
-copy %AssetDir%\Roslyn\illinkcsproj illink.csproj
-call %__dotnet% restore --packages pkg
-if errorlevel 1 set ExitCode=1&&echo Roslyn: IlLink fetch failed
-set __IlLinkDll=%cd%\pkg\microsoft.netcore.illink\0.1.9-preview\lib\netcoreapp1.1\illink.dll
-cd ..
-
-REM Build CscCore
-call Restore.cmd
-REM Fetch the appropriate version of MSBuild to build and publish CscCore
-for /f "delims=`" %%i in ('powershell -noprofile -executionPolicy RemoteSigned -command "& { . build\scripts\build-utils.ps1;Ensure-MSBuild }"') do set MSBUILD=%%i
-REM publish CscCore for win7-x64
-"%MSBUILD%" src\Compilers\CSharp\CscCore\CscCore.csproj /t:Publish /p:RuntimeIdentifier=win7-x64 /p:Configuration=Release /p:TreatWarningsAsErrors=true /warnaserror /nologo /nodeReuse:false /m
-if errorlevel 1 set ExitCode=1&& echo Roslyn: publish failed
-REM Published CscCore to Binaries\Release\Exes\CscCore\win7-x64\publish
-
-REM Create Linker Directory
-cd Binaries\Release\Exes\CscCore\win7-x64\
-mkdir Linked
-
-REM Copy Unmanaged Assets
-cd publish
-FOR /F "delims=" %%I IN ('DIR /b *') DO (
- %__CORFLAGS% %%I
- if errorlevel 1 copy %%I ..\Linked
-)
-copy *.ni.dll ..\Linked
-
-REM Run Linker
-echo Running %__dotnet1% %__IlLinkDll% -t -c link -a @%AssetDir%\Roslyn\RoslynRoots.txt -x %AssetDir%\Roslyn\RoslynRoots.xml -l none -out ..\Linked
-call %__dotnet1% %__IlLinkDll% -t -c link -a @%AssetDir%\Roslyn\RoslynRoots.txt -x %AssetDir%\Roslyn\RoslynRoots.xml -l none -out ..\Linked
-if errorlevel 1 set ExitCode=1&& echo Roslyn: ILLink failed
-
+pushd %LinkBenchRoot%\roslyn\
+call restore.cmd
+cd src\Compilers\CSharp\csc
+call %__dotnet2% restore -r win10-x64
+call %__dotnet2% publish -c release -r win10-x64 -f netcoreapp2.0 /p:LinkDuringPublish=false --output ..\..\..\..\Binaries\release\Exes\csc\netcoreapp2.0\win10-x64\Unlinked
+if errorlevel 1 set ExitCode=1&&echo Roslyn: publish failed
+call %__dotnet2% publish -c release -r win10-x64 -f netcoreapp2.0 --output ..\..\..\..\Binaries\release\Exes\csc\netcoreapp2.0\win10-x64\Linked
+if errorlevel 1 set ExitCode=1&&echo Roslyn: publish-iLLink failed
popd
exit /b
REM the master branch, because the latest CLI generates R2R images for
REM system binaries, while ILLink cannot yet. We need pure MSIL images
REM in the unlinked version in order to be able to do a fair dir-size comparison.
-REM .Net1 => This is .Net CLI v 1.1.0
-REM Since Roslyn targets netcoreapp v1, it cannot use the IlLink.Tasks package.
-REM We use the ILLink package to get the linker and run it manually.
-REM Since IlLink.exe from this package only runs on .Net v1
+REM .Net2 => .Net 2.0.0-preview3-006923
+REM Roslyn needs to build using the dotnet SDK 2.0, because it needs the
+REM latest C#7 compiler. However, this means that the directory size comparison
+REM is off, because the system-binaries are R2R in the unlinked directory,
+REM but MSIL in the linked directory.
+REM TODO: Get the correct version of Crossgen, and manually R2R the system
+REM binaries in the linked directory.
powershell -noprofile -executionPolicy RemoteSigned wget https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.ps1 -OutFile dotnet-install.ps1
-if not exist %__dotnet% mkdir .Net && powershell -noprofile -executionPolicy RemoteSigned -file dotnet-install.ps1 -Channel master -InstallDir .Net -version 2.0.0-preview2-005905
-if not exist %__dotnet1% mkdir .Net1 && powershell -noprofile -executionPolicy RemoteSigned -file dotnet-install.ps1 -InstallDir .Net1
+if not exist %__dotnet% mkdir .Net && powershell -noprofile -executionPolicy RemoteSigned -file dotnet-install.ps1 -Channel master -InstallDir .Net -version 2.0.0-preview2-005905
+if not exist %__dotnet2% mkdir .Net2 && powershell -noprofile -executionPolicy RemoteSigned -file dotnet-install.ps1 -Channel master -InstallDir .Net2 -version 2.0.0-preview3-006923
if not exist %__dotnet% set EXITCODE=1&& echo DotNet not installed
-if not exist %__dotnet1% set EXITCODE=1&& echo DotNet.1 not installed
+if not exist %__dotnet2% set EXITCODE=1&& echo DotNet2 not installed
exit /b
:HelloWorld