Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorBo committed Feb 3, 2020
1 parent 344b05e commit 695c25c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 43 deletions.
31 changes: 12 additions & 19 deletions src/mono/mono.proj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<PropertyGroup>
<MonoObjDir>$(ArtifactsObjDir)mono/$(PlatformConfigPathPart)/</MonoObjDir>
<MonoEnableLLVM Condition=" '$(MonoEnableLLVM)' == '' ">false</MonoEnableLLVM>
<TestHostPath>$(ArtifactsDir)bin\testhost\$(NetCoreAppCurrent)-$(OSGroup)-$(Configuration)-$(Platform)</TestHostPath>
<DotNetExec Condition="'$(OS)' == 'Windows_NT'">dotnet.exe</DotNetExec>
<DotNetExec Condition="'$(DotNetExec)' == ''">dotnet</DotNetExec>
<LocalDotnetDir>..\..\.dotnet</LocalDotnetDir>
Expand Down Expand Up @@ -89,7 +88,7 @@
<Target Name="Test" />

<!-- Copy Mono runtime bits to the local .dotnet dir for local experiments (temp solution) -->
<Target Name="PatchLocalDotnet" DependsOnTargets="ValidateTestHost">
<Target Name="PatchLocalDotnet" DependsOnTargets="ValidateLocalDotnet">
<PropertyGroup>
<LocalDotnetRuntimeDir>$([System.IO.Directory]::GetDirectories("$(LocalDotnetDir)\shared\Microsoft.NETCore.App")[0])</LocalDotnetRuntimeDir>
</PropertyGroup>
Expand All @@ -102,16 +101,7 @@
SkipUnchangedFiles="true" />
</Target>

<Target Name="PatchTestHost" DependsOnTargets="ValidateTestHost">
<ItemGroup>
<_MonoRuntimeArtifacts Include="$(BinDir)\*.*" />
</ItemGroup>
<Copy SourceFiles="@(_MonoRuntimeArtifacts)"
DestinationFolder="$(TestHostPath)\shared\Microsoft.NETCore.App\$(ProductVersion)"
SkipUnchangedFiles="true"/>
</Target>

<Target Name="PatchCoreClrCoreRoot" DependsOnTargets="ValidateTestHost">
<Target Name="PatchCoreClrCoreRoot" DependsOnTargets="ValidateLocalDotnet">
<Error Condition="!Exists('$(ArtifactsDir)/tests/coreclr/$(OSGroup).$(Platform).Checked/Tests/Core_Root')" Text="Core_Root doesn't exist. Have you built coreclr tests in Checked configuration?" />
<ItemGroup>
<_MonoRuntimeArtifacts Include="$(BinDir)\*.*" />
Expand All @@ -122,35 +112,38 @@
</Target>

<!-- Run netcore\sample\HelloWorld sample using Mono Runtime -->
<Target Name="RunSample" DependsOnTargets="ValidateTestHost;PatchTestHost">
<MSBuild Projects="$(MonoProjectRoot)netcore\sample\HelloWorld\HelloWorld.csproj" Targets="Restore;Build" />
<Exec Command="$(TestHostPath)\$(DotNetExec) $(MonoProjectRoot)netcore\sample\HelloWorld\bin\HelloWorld.dll" />
<Target Name="RunSample" DependsOnTargets="PatchLocalDotnet">
<Exec Command="$(LocalDotnet) run -c Release -p $(MonoProjectRoot)netcore\sample\HelloWorld" />
</Target>

<!-- Run CoreCLR runtime test using testhost -->
<Target Name="RunCoreClrTest" DependsOnTargets="ValidateTestHost;PatchCoreClrCoreRoot">
<Target Name="RunCoreClrTest" DependsOnTargets="ValidateLocalDotnet;PatchCoreClrCoreRoot">
<Error Condition="$(CoreClrTest) == ''" Text="'CoreClrTest' is not set. E.g. set it to `$(ArtifactsDir)tests/coreclr/Windows_NT.x64.Checked/JIT/opt/InstructionCombining/DivToMul/DivToMul$(ScriptExt)` in order to run DivToMul test." />
<Exec Command="$(CoreClrTest) -coreroot=&quot;$(ArtifactsDir)/tests/coreclr/$(OSGroup).$(Platform).Checked/Tests/Core_Root&quot;"/>
</Target>

<!-- Make sure coreclr tests are built (in Checked configuration), e.g.
*nix: `cd ../coreclr && ./build.sh -checked && ./build-testh.sh -checked`
Windows: `cd ../coreclr && build.cmd -checked` -->
<Target Name="RunCoreClrTests" DependsOnTargets="ValidateTestHost;PatchCoreClrCoreRoot">
<Target Name="RunCoreClrTests" DependsOnTargets="ValidateLocalDotnet;PatchCoreClrCoreRoot">
<ItemGroup>
<CoreClrTests Include="$(ArtifactsDir)tests\coreclr\$(OSGroup).$(Platform).Checked\**\*$(ScriptExt)" />
</ItemGroup>
<Exec Command="bash &quot;%(CoreClrTests.Identity)&quot; -coreroot=&quot;$(ArtifactsDir)/tests/coreclr/$(OSGroup).$(Platform).Checked/Tests/Core_Root&quot;" ContinueOnError="WarnAndContinue" />
</Target>

<!-- Show summary for coreclr tests -->
<Target Name="CoreClrTestsSummary">
<Exec Command="python $(MonoProjectRoot)../coreclr/tests/runtest.py --analyze_results_only -test_location $(ArtifactsDir)tests/coreclr/$(OSGroup).$(Platform).Checked -build_type Checked" />
</Target>

<Target Name="RunBenchmarks">
<Error Condition="$(BenchmarksRepo) == ''" Text="BenchmarksRepo variable is not set" />
<Exec WorkingDirectory="$(BenchmarksRepo)\src\benchmarks\micro" Command="$(LocalDotnet) run -c Release -f $(NetCoreAppCurrent) --cli $(LocalDotnet)" />
</Target>

<Target Name="ValidateTestHost">
<Target Name="ValidateLocalDotnet">
<Error Condition="!Exists('$(LocalDotnet)')" Text="'$(LocalDotnet)' doesn't exist." />
<Error Condition="!Exists('$(TestHostPath)')" Text="'$(TestHostPath)' doesn't exist. Try to set Configuration, OSGroup and Platform variables if neccesary." />
</Target>

</Project>
41 changes: 17 additions & 24 deletions src/mono/netcore/Makefile
Original file line number Diff line number Diff line change
@@ -1,39 +1,32 @@
DOTNET=../../../.dotnet/dotnet
TESTHOST_PATH=../../../artifacts/bin/testhost/

# let's check ../../../artifacts/bin/testhost/ for available configurations
# it's expected to see there only a single config, e.g. "netcoreapp5.0-OSX-Release-x64"
# otherwise you have to set these variables for desired config
ifeq ($(words $(wildcard $(TESTHOST_PATH)/*)), 1)
TESTHOST_CFG := $(subst -, ,$(notdir $(wildcard $(TESTHOST_PATH)/*)))
CONFIGURATION := $(word 3,$(TESTHOST_CFG))
MONO_PROPS := /p:Configuration=$(CONFIGURATION)
endif
# run sample using local .dotnet (will be patched with Mono Runtime)
run-sample:
$(DOTNET) msbuild /t:RunSample ../mono.proj

check-config:
@if test -z "$(CONFIGURATION)"; then echo "CONFIGURATION is not set"; exit 1; fi

run-sample: check-config
$(DOTNET) msbuild /t:RunSample $(MONO_PROPS) ../mono.proj

run-sample-coreclr: check-config
$(DOTNET) run -c Release -p sample/HelloWorld
# run sample using dotnet from PATH
run-sample-coreclr:
dotnet run -c Release -p sample/HelloWorld

runtime:
$(DOTNET) msbuild /t:Build $(MONO_PROPS) ../mono.proj
$(DOTNET) msbuild /t:Build ../mono.proj

# temp: makes $(DOTNET) to use mono runtime (to run real-world apps using '$(DOTNET) run')
patch-local-dotnet: check-config
$(DOTNET) msbuild /t:PatchLocalDotnet $(MONO_PROPS) ../mono.proj
patch-local-dotnet:
$(DOTNET) msbuild /t:PatchLocalDotnet ../mono.proj

# run specific coreclr test, e.g.:
# make run-tests-coreclr CoreClrTest="bash ../../artifacts/tests/coreclr/OSX.x64.Checked/JIT/opt/InstructionCombining/DivToMul/DivToMul.sh"
run-tests-coreclr: check-config
$(DOTNET) msbuild /t:RunCoreClrTest /p:CoreClrTest="$(CoreClrTest)" $(MONO_PROPS) ../mono.proj
run-tests-coreclr:
$(DOTNET) msbuild /t:RunCoreClrTest /p:CoreClrTest="$(CoreClrTest)" ../mono.proj

# show summary for coreclr tests
tests-coreclr-summary:
$(DOTNET) msbuild /t:CoreClrTestsSummary ../mono.proj

# run all coreclr tests
run-tests-coreclr-all: check-config
$(DOTNET) msbuild /t:RunCoreClrTests $(MONO_PROPS) ../mono.proj
run-tests-coreclr-all:
$(DOTNET) msbuild /t:RunCoreClrTests ../mono.proj

# run 'dotnet/performance' benchmarks
# e.g. 'make run-benchmarks BenchmarksRepo=/prj/performance'
Expand Down

0 comments on commit 695c25c

Please sign in to comment.