Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 56 additions & 5 deletions tests/scripts/run-corefx-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
# Globals
##########################################################################

testing = False

Corefx_url = 'https://github.com/dotnet/corefx.git'

# This should be factored out of build.sh
Expand Down Expand Up @@ -181,15 +183,37 @@ def log(message):

print '[%s]: %s' % (sys.argv[0], message)

def copy_files(source_dir, target_dir):
""" Copy any files in the source_dir to the target_dir.
The copy is not recursive.
The directories must already exist.
Args:
source_dir (str): source directory path
target_dir (str): target directory path
Returns:
Nothing
"""

global testing
assert os.path.isdir(source_dir)
assert os.path.isdir(target_dir)

for source_filename in os.listdir(source_dir):
source_pathname = os.path.join(source_dir, source_filename)
if os.path.isfile(source_pathname):
target_pathname = os.path.join(target_dir, source_filename)
log('Copy: %s => %s' % (source_pathname, target_pathname))
if not testing:
shutil.copy2(source_pathname, target_pathname)

##########################################################################
# Main
##########################################################################

def main(args):
global Corefx_url
global Unix_name_map

testing = False
global testing

arch, ci_arch, build_type, clr_root, fx_root, fx_branch, fx_commit, env_script, no_run_tests = validate_args(
args)
Expand Down Expand Up @@ -260,17 +284,44 @@ def main(args):

config_args = '-Release -os:%s -buildArch:%s' % (clr_os, arch)

# Run the primary (non-test) corefx build
# Run the primary (non-test) corefx build. We previously passed the argument:
#
# /p:CoreCLROverridePath=<path-to-core_root>
#
# which causes the corefx build to overwrite its built runtime with the binaries from
# the coreclr build. However, this often causes build failures when breaking changes are
# in progress (e.g., a breaking change is made in coreclr that has not yet had compensating
# changes made in the corefx repo). Instead, build corefx normally. This should always work
# since corefx is protected by a CI testing system. Then, overwrite the built corefx
# runtime with the runtime built in the coreclr build. The result will be that perhaps
# some, hopefully few, corefx tests will fail, but the builds will never fail.

command = ' '.join(('build.cmd' if Is_windows else './build.sh',
config_args,
'-- /p:CoreCLROverridePath=%s' % core_root))
config_args))

log(command)
returncode = 0 if testing else os.system(command)
if returncode != 0:
sys.exit(1)

# Override the built corefx runtime (which it picked up by copying from packages determined
# by its dependencies.props file). Note that we always build Release corefx.
# We must copy all files, not just the files that already exist in the corefx runtime
# directory. This is required so we copy over all altjit compilers.
# TODO: it might be cleaner to encapsulate the knowledge of how to do this in the
# corefx msbuild files somewhere.

fx_runtime = os.path.join(fx_root,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is a good idea. It will likely break whenever we change the layout of corefx output. We don't want to be responsible for updating random scripts like this that are taking a hard-coded dependency on the output of corefx repo.

If the options of CoreCLROverridePath isn't doing what you need it to then we should fix that or provide another public hook instead of depending on these paths here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'bin',
'testhost',
'netcoreapp-%s-%s-%s' % (clr_os, 'Release', arch),
'shared',
'Microsoft.NETCore.App',
'9.9.9')

log('Updating CoreCLR: %s => %s' % (core_root, fx_runtime))
copy_files(core_root, fx_runtime)

# Build the build-tests command line.

if Is_windows:
Expand Down