Skip to content

Tests all cases of infer-cross-compile-hosts-on-darwin at once #60824

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

edymtt
Copy link
Contributor

@edymtt edymtt commented Aug 29, 2022

The current implementation currently requires to have physical machine
for each architecture supported by macOS, which is not desirable.

To allow all cases to be tested on a random Mac machine, allow
to inject an arbitratry current architecture into the inference
of the cross compile hosts by means of an environment variable.

Addresses rdar://99096874

@edymtt
Copy link
Contributor Author

edymtt commented Aug 29, 2022

@swift-ci please python lint

@edymtt
Copy link
Contributor Author

edymtt commented Aug 29, 2022

@swift-ci please test

@edymtt
Copy link
Contributor Author

edymtt commented Aug 29, 2022

@swift-ci please build toolchain

@edymtt edymtt force-pushed the improve-tests-for-infer-cross-compile-hosts-on-darwin branch from d7d5c72 to e011c0c Compare August 29, 2022 09:53
@edymtt
Copy link
Contributor Author

edymtt commented Aug 29, 2022

@swift-ci please python lint

@edymtt
Copy link
Contributor Author

edymtt commented Aug 29, 2022

@swift-ci please test

@edymtt
Copy link
Contributor Author

edymtt commented Aug 29, 2022

@swift-ci please build toolchain

# This is meant to test --infer-cross-compile-hosts-on-darwin
# in dry-run mode, so we don't want to advertise this to most users
option('--dry-run-assume-host-arch-is', store,
help=argparse.SUPPRESS)
Copy link
Member

Choose a reason for hiding this comment

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

Given that we don't want to make this generally available and that it is specifically for a singular test ATM, what do you think of honoring an environment variable (e.g. ARCH) instead of having a dedicated option that we then have to explicitly suppress? The changes to build-script are also then simpler.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes a lot of sense, I had in mind the hidden options we have on the frontend and did not think about the big picture.

I took this feedback in e039574 -- I am still ensuring to sense the variable in dry run and print when such sensing occurring in a effort to reduce the likelihood of using this code path in normal usage.

Comment on lines 422 to 424
def _infer_cross_compile_hosts_on_darwin(args):
if args.dry_run and args.dry_run_assume_host_arch_is:
# This is primarily meant to support testing
# BuildSystem/infer-cross-compile-hosts-on-darwin-macosx.test
# and it's not meant for the general audience
print("DRY RUN: assume build-script is being run on a "
f"{args.dry_run_assume_host_arch_is} machine")
sys.stdout.flush()

arch_we_are_running_on = args.dry_run_assume_host_arch_is
else:
arch_we_are_running_on = platform.machine()

if arch_we_are_running_on == "x86_64":
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
def _infer_cross_compile_hosts_on_darwin(args):
if args.dry_run and args.dry_run_assume_host_arch_is:
# This is primarily meant to support testing
# BuildSystem/infer-cross-compile-hosts-on-darwin-macosx.test
# and it's not meant for the general audience
print("DRY RUN: assume build-script is being run on a "
f"{args.dry_run_assume_host_arch_is} machine")
sys.stdout.flush()
arch_we_are_running_on = args.dry_run_assume_host_arch_is
else:
arch_we_are_running_on = platform.machine()
if arch_we_are_running_on == "x86_64":
os.environ.get('ARCH', platform.machine()) == 'x86_64':

@edymtt edymtt force-pushed the improve-tests-for-infer-cross-compile-hosts-on-darwin branch from e011c0c to 2dc756d Compare August 29, 2022 11:44
The current implementation currently requires to have physical machine
for each architecture supported by macOS, which is not desirable.

To allow all cases to be tested on a random Mac machine, allow
to inject an arbitratry current architecture into the inference
of the cross compile hosts by means of an environment variable.

Addresses rdar://99096874
@edymtt edymtt force-pushed the improve-tests-for-infer-cross-compile-hosts-on-darwin branch from 2dc756d to e039574 Compare August 29, 2022 11:58
@edymtt edymtt requested a review from compnerd August 29, 2022 12:01
@edymtt
Copy link
Contributor Author

edymtt commented Aug 29, 2022

@swift-ci please python lint

@edymtt
Copy link
Contributor Author

edymtt commented Aug 29, 2022

@swift-ci please test

@edymtt
Copy link
Contributor Author

edymtt commented Aug 29, 2022

@swift-ci please build toolchain

@edymtt edymtt merged commit f7a11c7 into swiftlang:main Aug 30, 2022
@edymtt edymtt deleted the improve-tests-for-infer-cross-compile-hosts-on-darwin branch August 30, 2022 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants