Skip to content
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

Add --build-tool-options to pass options to make/ninja/etc. #25

Merged
merged 4 commits into from
Aug 28, 2024

Conversation

DavidSpickett
Copy link
Contributor

7688741 stopped us always using make but in the process removed the "-k" flag.

This flag causes make to carry on even when some targets fail. This is very important for running the test suite in CI. Without it, a single build failure marks thousands of subsequent programs as missing, as if they too had failed to compile.

If I deliberately break a single source test the results currently are:

Total Discovered Tests: 3424
  Passed            :  378 (11.04%)
  Executable Missing: 3046 (88.96%)
Import succeeded.

This is what they should be:

Executable Missing Tests (1):
  test-suite :: SingleSource/UnitTests/2003-04-22-Switch.test

Total Discovered Tests: 3424
  Passed            : 3423 (99.97%)
  Executable Missing:    1 (0.03%)
Import succeeded.

cmake --build does not have its own -k option, so we have to pass it after -- to the native tool. Unfortunately ninja's -k takes a number, so ninja -k 0 is equivalent to make -k. Therefore we can't just always add "-- -k" here.

Instead I've added a new option --build-tool-options where you can pass any arguments you want. The build bots will use this to pass "-k" to make, as we know for sure they use make.

Anything using ninja will also want to pass "-k 0" to get the same effect.

llvm@7688741
stopped us always using make but in the process removed the "-k" flag.

This flag causes make to carry on even when some targets fail. This is
very important for running the test suite in CI. Without it, a single
build failure marks thousands of subsequent programs as missing, as if
they too had failed to compile.

If I deliberately break a single source test the results currently are:
```
Total Discovered Tests: 3424
  Passed            :  378 (11.04%)
  Executable Missing: 3046 (88.96%)
Import succeeded.
```
This is what they should be:
```
Executable Missing Tests (1):
  test-suite :: SingleSource/UnitTests/2003-04-22-Switch.test

Total Discovered Tests: 3424
  Passed            : 3423 (99.97%)
  Executable Missing:    1 (0.03%)
Import succeeded.
```

cmake --build does not have its own -k option, so we have to pass it
after -- to the native tool. Unfortunately ninja's -k takes a number,
so ninja -k 0 is equivalent to make -k. Therefore we can't just
always add "-- -k" here.

Instead I've added a new option --build-tool-options where you can
pass any arguments you want. The build bots will use this to pass
"-k" to make, as we know for sure they use make.

Anything using ninja will also want to pass "-k 0" to get the same
effect.
@DavidSpickett
Copy link
Contributor Author

First spotted by @antmox a few weeks ago.

And while I have your attention @lukel97 , thanks for getting LNT working on Python 3.12. This has unblocked some work Linaro wanted to do.

Also we'd been thinking about switching to ninja for test suites but never got around to it, so we're on board with the changes overall. Just need to fix this for build bot purposes.

Copy link
Contributor

@lukel97 lukel97 left a comment

Choose a reason for hiding this comment

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

LGTM, good catch. Sounds like this really is the default behaviour we want but looks like there's no good way of specifying this via CMake.

@DavidSpickett
Copy link
Contributor Author

We could call it out in the documentation, is there a good place for that? I'm not familiar with LNT's docs.

@DavidSpickett
Copy link
Contributor Author

I think https://llvm.org/docs/lnt/quickstart.html#running-tests, I'll update the PR tomorrow.

Copy link
Contributor

@lukel97 lukel97 left a comment

Choose a reason for hiding this comment

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

Docs look good too

DavidSpickett added a commit to DavidSpickett/llvm-zorg that referenced this pull request Aug 15, 2024
When llvm/llvm-lnt@7688741
enabled using Ninja, it removed the -k flag from make. -k causes make
to carry on if there's a build failure.

Without this flag, a single compilation failure turns into thousands
of missing executables in the final results. As subsequent targets are not
built.

llvm/llvm-lnt#25 is adding an option to the lnt runner
to pass options to the build tool.

This PR uses that to pass -k to make to restore the old behaviour on the
build bots.
Copy link

@antmox antmox left a comment

Choose a reason for hiding this comment

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

looks good to me

@omjavaid
Copy link

This looks good. I have also updated llvm/llvm-zorg#245

@DavidSpickett DavidSpickett merged commit d9db435 into llvm:main Aug 28, 2024
1 check passed
@DavidSpickett DavidSpickett deleted the make_options branch August 28, 2024 10:02
DavidSpickett added a commit to llvm/llvm-zorg that referenced this pull request Aug 29, 2024
When
llvm/llvm-lnt@7688741
enabled using Ninja, it removed the -k flag from make. -k causes make to
carry on if there's a build failure.

Without this flag, a single compilation failure turns into thousands of
missing executables in the final results. As subsequent targets are not
built.

llvm/llvm-lnt#25 is adding an option to the lnt
runner to pass options to the build tool.

This PR uses that to pass -k to make to restore the old behaviour on the
build bots.
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.

4 participants