summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Keldorph <russ.keldorph@microsoft.com>2017-01-27 02:59:28 -0800
committerGitHub <noreply@github.com>2017-01-27 02:59:28 -0800
commit1ba64840b54c98781d9536d4ac6052c2c1ba5242 (patch)
tree5ae1927fed0eabe4f6730e14eb921124b4827aa2
parentc01abca4e3d47f53ed973848d822877defaa99ce (diff)
parentd32a829c127be5195b3bf666ec063f2d9134e521 (diff)
downloadcoreclr-1ba64840b54c98781d9536d4ac6052c2c1ba5242.tar.gz
coreclr-1ba64840b54c98781d9536d4ac6052c2c1ba5242.tar.bz2
coreclr-1ba64840b54c98781d9536d4ac6052c2c1ba5242.zip
Merge pull request #9130 from RussKeldorph/corefx
Support new corefx workflow
-rw-r--r--Documentation/building/testing-with-corefx.md25
-rw-r--r--tests/scripts/run-corefx-tests.py110
2 files changed, 79 insertions, 56 deletions
diff --git a/Documentation/building/testing-with-corefx.md b/Documentation/building/testing-with-corefx.md
index 4f9886f78d..defc8f8e8b 100644
--- a/Documentation/building/testing-with-corefx.md
+++ b/Documentation/building/testing-with-corefx.md
@@ -3,18 +3,23 @@ Testing with CoreFX
It may be valuable to use CoreFX tests to validate your changes to CoreCLR or mscorlib.
-**Windows**
+**NOTE:** The `BUILDTOOLS_OVERRIDE_RUNTIME` property no longer works.
-As part of building tests, CoreFX restores a copy of the runtime from myget, in order to update the runtime that is deployed, a special build property `BUILDTOOLS_OVERRIDE_RUNTIME` can be used. If this is set, the CoreFX testing targets will copy all the files in the folder it points to into the test folder, overwriting any files that exist.
+**Replace runtime between build.[cmd|sh] and build-tests.[cmd|sh]**
-To run tests, follow the procedure for [running tests in CoreFX](https://github.com/dotnet/corefx/blob/master/Documentation/building/windows-instructions.md). You can pass `/p:BUILDTOOLS_OVERRIDE_RUNTIME=<path-to-coreclr>\bin\Product\Windows_NT.x64.Release` to build.cmd to set this property, e.g. (note the space between the "--" and the "/p" option):
+Use the following instructions to test a change to the dotnet/coreclr repo using dotnet/corefx tests. Refer to the [CoreFx Developer Guide](https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/developer-guide.md) for information about CoreFx build scripts.
-```
-build.cmd -Release -- /p:BUILDTOOLS_OVERRIDE_RUNTIME=<root of coreclr repo>\bin\Product\Windows_NT.x64.Checked
-```
+1. Build the CoreClr runtime you wish to test under `<coreclr_root>`
+2. Build the CoreFx repo (`build.[cmd|sh]`) under `<corefx_root>`, but don't build tests yet
+3. Copy the contents of the CoreCLR binary root you wish to test into the CoreFx runtime folder (`<flavor>` below) created in step #2. For example:
-**FreeBSD, Linux, NetBSD, OS X**
+ `copy <coreclr_root>\bin\Product\Windows_NT.<arch>.<build_type>\* <corefx_root>\bin\runtime\<flavor>`
+ -or-
+ `cp <coreclr_root>/bin/Product/<os>.<arch>.<build_type>/* <corefx_root>/bin/runtime/<flavor>`
+
+4. Run the CoreFx `build-tests.[cmd|sh]` script as described in the Developer Guide.
+
+**CI Script**
+
+[run-corefx-tests.py](https://github.com/dotnet/coreclr/blob/master/tests/scripts/run-corefx-tests.py) will clone dotnet/corefx and run steps 2-4 above automatically. It is primarily intended to be run by the dotnet/coreclr CI system, but it might provide a useful reference or shortcut for individuals running the tests locally.
-Refer to the procedure for [running tests in CoreFX](https://github.com/dotnet/corefx/blob/master/Documentation/building/cross-platform-testing.md)
-- Note the --coreclr-bins and --mscorlib-bins arguments to [run-test.sh](https://github.com/dotnet/corefx/blob/master/run-test.sh)
-- Pass in paths to your private build of CoreCLR
diff --git a/tests/scripts/run-corefx-tests.py b/tests/scripts/run-corefx-tests.py
index b65fa5e033..f0111da19c 100644
--- a/tests/scripts/run-corefx-tests.py
+++ b/tests/scripts/run-corefx-tests.py
@@ -17,6 +17,7 @@
##########################################################################
import argparse
+import distutils.dir_util
import os
import re
import shutil
@@ -118,7 +119,7 @@ def validate_args(args):
validate_arg(fx_branch, lambda item: True)
if fx_commit is None:
- fx_commit = '551fe49174378adcbf785c0ab12fc69355cef6e8' if fx_branch == 'master' else 'HEAD'
+ fx_commit = 'HEAD'
if clr_root is None:
clr_root = nth_dirname(os.path.abspath(sys.argv[0]), 3)
@@ -148,7 +149,6 @@ def validate_args(args):
return args
-
def nth_dirname(path, n):
""" Find the Nth parent directory of the given path
Args:
@@ -188,7 +188,6 @@ def log(message):
print '[%s]: %s' % (sys.argv[0], message)
-
##########################################################################
# Main
##########################################################################
@@ -197,6 +196,8 @@ def main(args):
global Corefx_url
global Unix_name_map
+ testing = False
+
arch, build_type, clr_root, fx_root, fx_branch, fx_commit, env_script = validate_args(
args)
@@ -212,95 +213,112 @@ def main(args):
# To delete the files with non-ascii characters, when rmtree fails due to those
# files, we then will call rd on Windows.
- if os.path.exists(fx_root):
+ if not testing and os.path.exists(fx_root):
if Is_windows:
- vbcscompiler_running = True
- while vbcscompiler_running:
+ while True:
res = subprocess.check_output(['tasklist'])
if not 'VBCSCompiler.exe' in res:
- vbcscompiler_running = False
+ break
os.chdir(fx_root)
os.system('git clean -fxd')
os.chdir(clr_root)
shutil.rmtree(fx_root, onerror=del_rw)
+ # Clone the corefx branch
+
command = 'git clone -b %s --single-branch %s %s' % (
fx_branch, Corefx_url, fx_root)
-
log(command)
-
- testing = False
-
if testing:
- os.makedirs(fx_root)
+ if not os.path.exists(fx_root):
+ os.makedirs(fx_root)
returncode = 0
else:
returncode = os.system(command)
- if returncode != 0:
- sys.exit(returncode)
+ # Change directory to the corefx root
+ cwd = os.getcwd()
+ log('[cd] ' + fx_root)
+ os.chdir(fx_root)
- command = "git -C %s checkout %s" % (
- fx_root, fx_commit)
+ # Checkout the appropriate corefx commit
+ command = "git checkout %s" % fx_commit
log(command)
-
- if testing:
- returncode = 0
- else:
- returncode = os.system(command)
-
- if returncode != 0:
+ returncode = 0 if testing else os.system(command)
+ if not returncode == 0:
sys.exit(returncode)
- cwd = os.getcwd()
- log('cd ' + fx_root)
- os.chdir(fx_root)
+ # On Unix, coreFx build.sh requires HOME to be set, and it isn't by default
+ # under our CI system, so set it now.
- if Is_windows:
- command = '.\\build.cmd'
- if env_script is not None:
- command = ('cmd /c %s&&' % env_script) + command
- else:
- # CoreFx build.sh requires HOME to be set, and it isn't by default
- # under our CI.
+ if not Is_windows:
fx_home = os.path.join(fx_root, 'tempHome')
if not os.path.exists(fx_home):
os.makedirs(fx_home)
os.putenv('HOME', fx_home)
log('HOME=' + fx_home)
- command = './build.sh'
- if env_script is not None:
- command = ('. %s;' % env_script) + command
-
+ # Determine the RID to specify the to corefix build scripts. This seems to
+ # be way harder than it ought to be.
+
if testing:
rid_os = dotnet_rid_os('')
else:
- if clr_os == "Windows_NT":
+ if Is_windows:
rid_os = "win7"
else:
rid_os = dotnet_rid_os(os.path.join(clr_root, 'Tools', 'dotnetcli'))
+ # Gather up some arguments to pass to both build and build-tests.
+
+ config_args = '-Release -RuntimeOS=%s -ArchGroup=%s' % (rid_os, arch)
+
+ # Run the primary (non-test) corefx build
+
+ command = ' '.join(('build.cmd' if Is_windows else './build.sh', config_args))
+ log(command)
+ returncode = 0 if testing else os.system(command)
+ if returncode != 0:
+ sys.exit(returncode)
+
+ # Copy the coreclr runtime we wish to run tests against. This is the recommended
+ # hack until a full-stack test solution is ready. This assumes there is a single
+ # directory under <fx_root>/bin/runtime into which we copy coreclr binaries. We
+ # assume the appropriate coreclr has already been built.
+
+ fx_runtime_dir = os.path.join(fx_root, 'bin', 'runtime')
+ overlay_dest = os.path.join(fx_runtime_dir, os.listdir(fx_runtime_dir)[0])
+ log('[overlay] %s -> %s' % (core_root, overlay_dest))
+ if not testing:
+ distutils.dir_util.copy_tree(core_root, overlay_dest)
+
+ # Build the build-tests command line.
+
+ if Is_windows:
+ command = 'build-tests.cmd'
+ if env_script is not None:
+ command = ('cmd /c %s&&' % env_script) + command
+ else:
+ command = './build-tests.sh'
+ if env_script is not None:
+ command = ('. %s;' % env_script) + command
+
command = ' '.join((
command,
- '-Release',
- '-TestNugetRuntimeId=%s-%s' % (rid_os, arch),
+ config_args,
'--',
- '/p:BUILDTOOLS_OVERRIDE_RUNTIME="%s"' % core_root,
'/p:WithoutCategories=IgnoreForCI'
))
if not Is_windows:
command += ' /p:TestWithLocalNativeLibraries=true'
- log(command)
+ # Run the corefx test build and run the tests themselves.
- if testing:
- returncode = 0
- else:
- returncode = os.system(command)
+ log(command)
+ returncode = 0 if testing else os.system(command)
sys.exit(returncode)