1 ifneq ($(wildcard config.make
),)
5 NETCORETESTS_VERSION
:= $(shell cat ..
/eng
/Versions.props | sed
-n
's/.*MicrosoftPrivateCoreFxNETCoreAppVersion>\(.*\)<\/MicrosoftPrivateCoreFxNETCoreAppVersion.*/\1/p' )
6 NETCOREAPP_VERSION
:= $(shell cat ..
/eng
/Versions.props | sed
-n
's/.*MicrosoftNETCoreAppVersion>\(.*\)<\/MicrosoftNETCoreAppVersion.*/\1/p' )
7 ROSLYN_VERSION
:= $(shell cat ..
/eng
/Versions.props | sed
-n
's/.*MicrosoftNetCompilersVersion>\(.*\)<\/MicrosoftNetCompilersVersion.*/\1/p' )
9 # runtime version used by $(DOTNET) - local .net core sdk to bootstrap stuff
10 # it doesn't match NETCOREAPP_VERSION
11 BOOTSTRAP_RUNTIME
= $(shell ls ..
/.dotnet
/shared
/Microsoft.NETCore.App | tail
-1)
13 ifeq ($(HOST_PLATFORM
),win32
)
14 PLATFORM_AOT_SUFFIX
:= .dll
15 PLATFORM_AOT_PREFIX
:=
17 UNZIPCMD
= python
-c
"import zipfile,sys; zipfile.ZipFile(sys.argv[1], 'r').extractall()"
18 XUNIT_FLAGS
= -notrait category
=nonwindowstests @..
/..
/..
/..
/CoreFX.issues_windows.rsp
19 TESTS_PLATFORM
= Windows_NT.x64
20 ON_RUNTIME_EXTRACT
= chmod
-R
755 {host
,shared
,.
/dotnet
}
21 DOTNET
:= $(shell powershell
-ExecutionPolicy Bypass
-Command
"./init-tools.ps1")/dotnet.exe
22 DOTNET
:= "$(subst \,/,$(DOTNET))"
25 ifeq ($(HOST_PLATFORM
),macos
)
26 PLATFORM_AOT_SUFFIX
:= .dylib
27 PLATFORM_AOT_PREFIX
:= lib
28 NETCORESDK_EXT
= tar.gz
30 XUNIT_FLAGS
= -notrait category
=nonosxtests
31 TESTS_PLATFORM
= OSX.x64
32 DOTNET
:= $(shell .
/init-tools.sh | tail
-1)
35 ifeq ($(HOST_PLATFORM
),linux
)
36 PLATFORM_AOT_SUFFIX
:= .so
37 PLATFORM_AOT_PREFIX
:= lib
38 NETCORESDK_EXT
= tar.gz
40 XUNIT_FLAGS
= -notrait category
=nonlinuxtests @..
/..
/..
/..
/CoreFX.issues_linux.rsp
41 ifeq ($(COREARCH
), arm64
)
42 XUNIT_FLAGS
+= @..
/..
/..
/..
/CoreFX.issues_linux_arm64.rsp
44 TESTS_PLATFORM
= Linux.x64
45 DOTNET
:= $(shell .
/init-tools.sh | tail
-1)
48 NETCORESDK_FILE
:= dotnet-runtime-
$(NETCOREAPP_VERSION
)-$(RID
).
$(NETCORESDK_EXT
)
49 NETCORE_URL
:= https
://dotnetcli.blob.core.windows.net
/dotnet
/Runtime
/$(NETCOREAPP_VERSION
)/$(NETCORESDK_FILE
)
50 FEED_BASE_URL
:= https
://dotnetfeed.blob.core.windows.net
/dotnet-core
51 TEST_ASSETS_PATH
:= corefx-tests
/$(NETCORETESTS_VERSION
)/$(TESTS_PLATFORM
)/netcoreapp
/corefx-test-assets.xml
53 # used to calculate exact version number for generating nupkg
54 BLAME
= $(shell git blame ..
/configure.ac | grep AC_INIT | cut
-f1
-d
' ')
55 VERSTUB
= .
$(shell git rev-list
--count
$(BLAME
)..HEAD
)
60 curl
$(NETCORE_URL
) --output
$(NETCORESDK_FILE
)
61 rm -rf shared
/Microsoft.NETCore.App
62 $(UNZIPCMD
) $(NETCORESDK_FILE
)
65 update-corefx
: corefx
/.stamp-dl-corefx-
$(NETCORETESTS_VERSION
)
67 corefx
/.stamp-dl-corefx-
$(NETCORETESTS_VERSION
): corefx-restore.csproj
68 $(DOTNET
) build corefx-restore.csproj
--runtime
$(RID
) --packages corefx
/packages
-p
:MicrosoftPrivateCoreFxNETCoreAppVersion
=$(NETCORETESTS_VERSION
) -p
:OutputPath
=corefx
/restore
/
71 update-roslyn
: roslyn
/packages
/microsoft.net.compilers.toolset
/$(ROSLYN_VERSION
)/microsoft.net.compilers.toolset.nuspec
73 roslyn
/packages
/microsoft.net.compilers.toolset
/$(ROSLYN_VERSION
)/microsoft.net.compilers.toolset.nuspec
:
74 $(DOTNET
) restore roslyn-restore.csproj
-p
:RoslynVersion
=$(ROSLYN_VERSION
) --packages roslyn
/packages
-p
:OutputPath
=roslyn
/restore
/
77 $(DOTNET
) build sample
/HelloWorld
78 MONO_ENV_OPTIONS
="--debug" COMPlus_DebugWriteToStdErr
=1 .
/dotnet
--fx-version
"$(NETCOREAPP_VERSION)" sample
/HelloWorld
/bin
/netcoreapp3.0
/HelloWorld.dll
80 run-sample-dbg
: prepare
81 $(DOTNET
) build sample
/HelloWorld
82 MONO_ENV_OPTIONS
="--debug --debugger-agent=transport=dt_socket,address=127.0.0.1:1235,server=y,suspend=y" COMPlus_DebugWriteToStdErr
=1 .
/dotnet
--fx-version
"$(NETCOREAPP_VERSION)" sample
/HelloWorld
/bin
/netcoreapp3.0
/HelloWorld.dll
85 cd sample
/HelloWorld
&& $(DOTNET
) run
87 # build any app in "self contained" mode and patch coreclr.dll and corelib with mono bits
88 # e.g. `make patch-app APP_PATH=/my/aspnetapp`
90 @if
test -z
"$(APP_PATH)"; then echo
"APP_PATH is not set"; exit
1; fi
91 cp NuGet.config
$(APP_PATH
)
92 cd
$(APP_PATH
) && $(DOTNET
) publish
-c Release
-r
$(RID
) -f netcoreapp3.0
93 cp ..
/mono
/mini
/.libs
/libmonosgen-2.0
$(PLATFORM_AOT_SUFFIX
) $(APP_PATH
)/bin
/Release
/netcoreapp3.0
/$(RID
)/publish
/$(PLATFORM_AOT_PREFIX
)coreclr
$(PLATFORM_AOT_SUFFIX
)
94 cp System.Private.CoreLib
/bin
/$(COREARCH
)/System.Private.CoreLib.dll
$(APP_PATH
)/bin
/Release
/netcoreapp3.0
/$(RID
)/publish
95 cp System.Private.CoreLib
/bin
/$(COREARCH
)/System.Private.CoreLib.pdb
$(APP_PATH
)/bin
/Release
/netcoreapp3.0
/$(RID
)/publish
97 # makes $(DOTNET) to use mono runtime (to run real-world apps using '$(DOTNET) run')
98 patch-local-dotnet
: prepare
99 cp ..
/mono
/mini
/.libs
/libmonosgen-2.0
$(PLATFORM_AOT_SUFFIX
) ..
/.dotnet
/shared
/Microsoft.NETCore.App
/$(BOOTSTRAP_RUNTIME
)/$(PLATFORM_AOT_PREFIX
)coreclr
$(PLATFORM_AOT_SUFFIX
)
100 cp System.Private.CoreLib
/bin
/$(COREARCH
)/System.Private.CoreLib.dll ..
/.dotnet
/shared
/Microsoft.NETCore.App
/$(BOOTSTRAP_RUNTIME
)
101 cp System.Private.CoreLib
/bin
/$(COREARCH
)/System.Private.CoreLib.pdb ..
/.dotnet
/shared
/Microsoft.NETCore.App
/$(BOOTSTRAP_RUNTIME
)
103 # Precompile BCL libs in $(DOTNET) using LLVM (requires `--enable-llvm` build)
104 patch-local-dotnet-aot-llvm
: patch-local-dotnet
105 for assembly in ..
/.dotnet
/shared
/Microsoft.NETCore.App
/$(BOOTSTRAP_RUNTIME
)/*.dll
; do \
106 echo
"[AOT] $$assembly"; \
107 PATH
="../llvm/usr/bin/:$(PATH)" \
108 MONO_ENV_OPTIONS
="--aot=llvm,llvmllc=\"-mcpu=native\"" \
109 $(DOTNET
) $$assembly ; \
112 # run 'dotnet/performance' benchmarks
113 # e.g. 'make run-benchmarks DOTNET_PERF_REPO=/prj/performance'
114 # you can append BDN parameters at the end, e.g. ` -- --filter Burgers --keepFiles`
115 # NOTE: we have to delete a couple of System.Drawing files to make it work
116 run-benchmarks
: patch-local-dotnet
117 cd
$(DOTNET_PERF_REPO
)/src
/benchmarks
/micro
/ && \
118 > corefx
/System.Drawing
/Perf_Color.cs
&& \
119 > corefx
/System.Drawing
/Perf_Graphics_DrawBeziers.cs
&& \
120 > corefx
/System.Drawing
/Perf_Graphics_Transforms.cs
&& \
121 > corefx
/System.Drawing
/Perf_Image_Load.cs
&& \
122 $(DOTNET
) run
-c Release
-f netcoreapp5.0
--cli
$(CURDIR
)/..
/.dotnet
/dotnet
124 # run HelloWorld using --aot=llvm (requires `--enable-llvm` build)
125 run-sample-local-dotnet-llvm
: patch-local-dotnet
126 $(DOTNET
) build
-c Release sample
/HelloWorld
127 PATH
="../llvm/usr/bin/:$(PATH)" \
128 MONO_ENV_OPTIONS
="--aot=llvm,llvmllc=\"-mcpu=native\"" \
129 $(DOTNET
) sample
/HelloWorld
/bin
/netcoreapp3.0
/HelloWorld.dll
130 $(DOTNET
) sample
/HelloWorld
/bin
/netcoreapp3.0
/HelloWorld.dll
133 SHAREDRUNTIME
:= shared
/Microsoft.NETCore.App
/$(NETCOREAPP_VERSION
)
135 System.Private.CoreLib
/src
/System
/Environment.Mono.cs
: System.Private.CoreLib
/src
/System
/Environment.Mono.in config.make
136 test -n
'$(MONO_CORLIB_VERSION)'
137 sed
-e
's,@''MONO_CORLIB_VERSION@,$(MONO_CORLIB_VERSION),' $< > $@
139 CORLIB_BUILD_FLAGS?
=-c Release
141 bcl
: update-roslyn System.Private.CoreLib
/src
/System
/Environment.Mono.cs
142 $(DOTNET
) build
$(CORETARGETS
) $(CORLIB_BUILD_FLAGS
) -p
:BuildArch
=$(COREARCH
) \
143 -p
:OutputPath
=bin
/$(COREARCH
) \
144 -p
:RoslynPropsFile
="../roslyn/packages/microsoft.net.compilers.toolset/$(ROSLYN_VERSION)/build/Microsoft.Net.Compilers.Toolset.props" \
145 System.Private.CoreLib
/System.Private.CoreLib.csproj
148 $(MAKE
) bcl CORLIB_BUILD_FLAGS
="-c Debug"
153 link-mono
: $(SHAREDRUNTIME
)/.stamp-link-mono
155 $(SHAREDRUNTIME
)/.stamp-link-mono
: ..
/mono
/mini
/.libs
/libmonosgen-2.0
$(PLATFORM_AOT_SUFFIX
) System.Private.CoreLib
/bin
/$(COREARCH
)/System.Private.CoreLib.dll System.Private.CoreLib
/bin
/$(COREARCH
)/System.Private.CoreLib.pdb
156 cp ..
/mono
/mini
/.libs
/libmonosgen-2.0
$(PLATFORM_AOT_SUFFIX
) $(SHAREDRUNTIME
)/$(PLATFORM_AOT_PREFIX
)coreclr
$(PLATFORM_AOT_SUFFIX
)
157 cp System.Private.CoreLib
/bin
/$(COREARCH
)/System.Private.CoreLib.dll
$(SHAREDRUNTIME
)
158 cp System.Private.CoreLib
/bin
/$(COREARCH
)/System.Private.CoreLib.pdb
$(SHAREDRUNTIME
)
161 prepare
: $(NETCORESDK_FILE
) update-corefx update-roslyn link-mono
164 $(DOTNET
) pack roslyn-restore.csproj
-p
:IsPackable
=true
-p
:NuspecFile
=runtime.nuspec
-p
:NuspecProperties
=\"RID
=$(RID
)\
;VERSION
=$(VERSION
)$(VERSTUB
)\
;PLATFORM_AOT_SUFFIX
=$(PLATFORM_AOT_SUFFIX
)\
;COREARCH
=$(COREARCH
)\
;PLATFORM_AOT_PREFIX
=$(PLATFORM_AOT_PREFIX
)\" --output ..
/artifacts
/ --no-build
165 $(DOTNET
) pack roslyn-restore.csproj
-p
:IsPackable
=true
-p
:NuspecFile
=metapackage.nuspec
-p
:NuspecProperties
=\"RID
=$(RID
)\
;VERSION
=$(VERSION
)$(VERSTUB
)\
;PLATFORM_AOT_SUFFIX
=$(PLATFORM_AOT_SUFFIX
)\
;COREARCH
=$(COREARCH
)\
;PLATFORM_AOT_PREFIX
=$(PLATFORM_AOT_PREFIX
)\" --output ..
/artifacts
/ --no-build
168 rm -rf .configured ..
/.dotnet sdk shared host dotnet tests obj corefx roslyn LICENSE.txt ThirdPartyNotices.txt
$(NETCORESDK_FILE
)
171 update-tests-corefx
: corefx
/.stamp-dl-corefx-tests-
$(NETCORETESTS_VERSION
)
173 corefx
/.stamp-dl-corefx-tests-
$(NETCORETESTS_VERSION
):
175 $(DOTNET
) msbuild corefx-tests-restore.proj
-m
-t
:DownloadAllTests
-p
:TEST_ASSETS_PATH
="$(TEST_ASSETS_PATH)" -p
:FEED_BASE_URL
="$(FEED_BASE_URL)"
176 rm -rf corefx
/tests
/extracted
/System.Utf8String.Experimental.Tests
180 # Running CoreFX tests
182 # You can run either individual test assembly or run all CoreFX tests. The tests are automatically downloaded
183 # from the shared location and built locally.
185 # Running all test: `make run-tests-corefx`
187 # Running individual test: MONO_ENV_OPTIONS="--debug" make run-tests-corefx-System.Collections.Tests
190 run-tests-corefx
: prepare update-tests-corefx
193 tests_count
=$(words $(dir $(wildcard corefx
/tests
/extracted
/*/))); \
194 for testdir in corefx
/tests
/extracted
/*; do \
195 counter
=$$((counter
+1)); \
196 testname
=$$(basename $$testdir); \
197 if
[ -n
"$$USE_TIMEOUT" ]; then timeoutcmd
="../scripts/ci/run-step.sh --label=$$testname --timeout=10m --fatal"; fi
; \
198 $$timeoutcmd $(MAKE
) run-tests-corefx-
$$testname TEST_COUNTER
="($$counter / $$tests_count) " || echo
$$testname >> .failures
; \
200 $(MAKE
) xunit-summary
; \
201 if
[ -e
".failures" ]; then \
203 echo
"Failures in test suites:"; \
209 run-tests-corefx-
%: prepare update-tests-corefx
211 @echo
"***************** $* $${TEST_COUNTER}*********************"
212 @cp corefx
/restore
/corefx-restore.deps.json corefx
/tests
/extracted
/$*/xunit.console.deps.json
213 @cp corefx
/restore
/corefx-restore.deps.json corefx
/tests
/extracted
/$*/Microsoft.DotNet.RemoteExecutorHost.deps.json
214 @cp corefx
/restore
/corefx-restore.runtimeconfig.dev.json corefx
/tests
/extracted
/$*/$*.runtimeconfig.dev.json
215 @cp corefx
/restore
/corefx-restore.dll corefx
/tests
/extracted
/$*/corefx-restore.dll
216 @sed
-i
-e
's/5.0.0\"/$(NETCOREAPP_VERSION)\"/g' corefx
/tests
/extracted
/$*/*.runtimeconfig.json
217 cd corefx
/tests
/extracted
/$* && \
218 COMPlus_DebugWriteToStdErr
=1 $(CURDIR
)/.
/dotnet exec
--runtimeconfig
$*.runtimeconfig.json
--fx-version
"$(NETCOREAPP_VERSION)" xunit.console.dll
$*.dll \
219 -html ..
/..
/TestResult-
$*.html
-xml ..
/..
/TestResult-
$*-netcore-xunit.xml \
220 $(XUNIT_FLAGS
) @..
/..
/..
/..
/CoreFX.issues.rsp \
223 # build a test assembly in COREFX_ROOT (path to a fully built corefx repo) and copy it to corefx/tests/extracted
224 # e.g. `make build-test-corefx-System.Runtime COREFX_ROOT=/prj/corefx-master`
226 cd
$(COREFX_ROOT
)/src
/$*/tests
&& $(DOTNET
) msbuild
/p
:OutputPath
=tmp
227 cp
$(COREFX_ROOT
)/src
/$*/tests
/tmp
/$*.Tests.
{dll
,pdb
} $(CURDIR
)/corefx
/tests
/extracted
/$*.Tests
/
228 rm -rf
$(COREFX_ROOT
)/src
/$*/tests
/tmp
231 .
/xunit-summary.py
"corefx/tests"