Skip to content

Improvements to build-script.py #521

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

Merged
merged 5 commits into from
Jul 28, 2022

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Jul 27, 2022

  • Add type annotations to functions
  • Lint the build-script using flake8
  • Make sure that we always call check_call for subprocesses to make sure build-script.py fails with a non-zero exit code if any subprocess fails.

@ahoppen ahoppen requested review from rintaro and kimdv July 27, 2022 09:12
@ahoppen
Copy link
Member Author

ahoppen commented Jul 27, 2022

@swift-ci Please test

Copy link
Contributor

@kimdv kimdv left a comment

Choose a reason for hiding this comment

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

Single question about a file.
Otherwise does it look good 🙌

ahoppen added 3 commits July 27, 2022 15:26
This guarantees that we fail execution of build-script.py if a subcommand fails.
@ahoppen ahoppen force-pushed the pr/build-script-improvements branch from e52e96f to de3c8f8 Compare July 27, 2022 13:26
This reduces the time to gyb-generate sources from ~12s to ~4s.
@ahoppen ahoppen force-pushed the pr/build-script-improvements branch from de3c8f8 to 2d197b2 Compare July 27, 2022 13:27
@ahoppen
Copy link
Member Author

ahoppen commented Jul 27, 2022

I also added a new improvement now to run gyb-generation on multiple threads, speeding it up by 3x from ~12s to ~4s: de3c8f8

@ahoppen
Copy link
Member Author

ahoppen commented Jul 27, 2022

@swift-ci Please test

Copy link
Contributor

@kimdv kimdv left a comment

Choose a reason for hiding this comment

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

Just a small nit-pick 🙌

else:
lit_success = run_lit_tests(
if not skip_lit_tests:
run_lit_tests(
Copy link
Member

Choose a reason for hiding this comment

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

I know this is the current behavior but why we don't run xctest cases when lit-tests fails? I feel we should run them both unconditionally, and raise a failure when either of them fails.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think there are three reasons:

  1. I like the way build-script fails early. That way the log output of lit-based tests are closer to the bottom (and thus easier to read) than when we continue to execute xctest commands
  2. It follows the current paradigm of the build-script that if one command fails it shouldn’t execute any other commands
  3. It’s slightly easier to implement this way

If you have strong opinions on this, we can change it but I like it the way it is.

Copy link
Member

Choose a reason for hiding this comment

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

I see. I agree that it's nice we can see the failures closer to the bottom. I still think it's also nice too all failures for both test suites, but it's not a strong opinion, and I can skip lit tests if I want. So let's keep it as it is.

@ahoppen
Copy link
Member Author

ahoppen commented Jul 28, 2022

@swift-ci Please test

@ahoppen ahoppen merged commit 561a3cc into swiftlang:main Jul 28, 2022
@ahoppen ahoppen deleted the pr/build-script-improvements branch July 28, 2022 20:42
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.

3 participants