diff options
author | Russ Keldorph <Russ.Keldorph@microsoft.com> | 2017-01-19 08:58:56 -0800 |
---|---|---|
committer | Russ Keldorph <Russ.Keldorph@microsoft.com> | 2017-01-25 17:56:35 -0800 |
commit | d32a829c127be5195b3bf666ec063f2d9134e521 (patch) | |
tree | 9b982f84d1ddab1a60ce3dd823b9efcdc41b49b1 /tests | |
parent | 6f7baa9e1ec9a848c1b98a4af8d9d8c2851ef023 (diff) | |
download | coreclr-d32a829c127be5195b3bf666ec063f2d9134e521.tar.gz coreclr-d32a829c127be5195b3bf666ec063f2d9134e521.tar.bz2 coreclr-d32a829c127be5195b3bf666ec063f2d9134e521.zip |
Support new corefx workflow
Update the run-corefx-tests.py script and enable it to run CI jobs
against corefx HEAD again. Also update the instructions for running
corefx tests with a private coreclr.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/scripts/run-corefx-tests.py | 110 |
1 files changed, 64 insertions, 46 deletions
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) |