This is an archive of the discontinued LLVM Phabricator instance.

add generic annotated builder and clang-with-thin-lto-windows
ClosedPublic

Authored by inglorion on May 12 2017, 12:53 PM.

Details

Summary

Adds a generic annotated builder that can be used to easily add
multiple build configurations. As a first configuration, a new builder
that builds and tests llvm, clang, and lld with ThinLTO on Windows is
included.

Diff Detail

Repository
rL LLVM

Event Timeline

inglorion created this revision.May 12 2017, 12:53 PM

I set up a buildmaster and worker locally and have been able to perform a number of successful builds using this configuration.

rnk edited edge metadata.May 12 2017, 2:03 PM

Great, I'm looking forward to rewriting the standard 32-bit builder to use this. :)

zorg/buildbot/builders/annotated/annotated_builder.py
16 ↗(On Diff #98822)

4-space indentation seems to be the dominant style for our buildbot code.

zorg/buildbot/builders/annotated/util.py
90 ↗(On Diff #98822)

I don't think this is correct. Percent is escaped by doubling the percent (% -> %%). Spaces, backslash, and quote handling is more complicated because it is interpreted by each program to form argv. Every program uses a different CRT (mingw, old MSVCRT, modern MSVCRT), so they all do different things. Experience has told me that the safe thing to do is, if you detect a space or a quote in an argument, quote it. You cannot escape quotes outside of quotes, i.e. this is not safe input to a program: quote\"file.txt, but this is safe always: "quote\"file.txt" and every program will unquote the second one as quote"file.txt

rnk added inline comments.May 12 2017, 2:11 PM
zorg/buildbot/builders/annotated/util.py
90 ↗(On Diff #98822)

Ignore the second part of this comment, I missed a detail of _shquote_impl. We just have to do the percent thing.

inglorion updated this revision to Diff 98845.May 12 2017, 2:28 PM

ran it through autopep8 to fix the formatting and fixed escaping of percent (thanks @rnk)

rnk accepted this revision.May 12 2017, 3:01 PM

lgtm!

This revision is now accepted and ready to land.May 12 2017, 3:01 PM
gkistanova requested changes to this revision.May 17 2017, 12:50 PM

Hello Bob,

I feel like I'm missing something with this patch. In particular, how exactly do you see the interaction between the master and an annotated builder in context of a build request? It seems you preserve the interface AnnotatedCommand offers, but I didn't find an indication of that in the annotated/ scripts.

  1. How a build with a given set of properties for a particular revision could be triggered on such builder? You should respect at least "clean" and "jobs" properties.
  1. What changes will trigger a build on an annotated builder, and how this is set for the "clang-with-thin-lto-windows" one?
buildbot/osuosl/master/config/slaves.py
162 ↗(On Diff #98845)

How the number of jobs is used in the "clang-with-thin-lto-windows"?

zorg/buildbot/builders/AnnotatedBuilder.py
13 ↗(On Diff #98845)

Please fix the indentation here. and everywhere else in this patch. Do you have tabs by any chance? If so, please convert them to spaces.

41 ↗(On Diff #98845)

This builds a path for a slave using the master os component, which is not what you want. In a general case you would get a path with a wrong path separator and wrongly terminated symbols.

zorg/buildbot/builders/annotated/clang-with-thin-lto-windows.py
19 ↗(On Diff #98845)

Does it build just this one hardcoded revision?

This revision now requires changes to proceed.May 17 2017, 12:50 PM
inglorion marked 7 inline comments as done.May 17 2017, 4:27 PM

Thank you for taking a look, @gkistanova. I've fixed the issues you pointend out inline. As for your questions:

I feel like I'm missing something with this patch. In particular, how exactly do you see the interaction between the master and an annotated builder in context of a build request? It seems you preserve the interface AnnotatedCommand offers, but I didn't find an indication of that in the annotated/ scripts.

  1. How a build with a given set of properties for a particular revision could be triggered on such builder? You should respect at least "clean" and "jobs" properties.

clean is now implemented: It sets BUILDBOT_CLOBBER=1. We check if BUILDBOT_CLOBBER has a nonempty value and, if so, we do a clean stage 1 build. Stages after stage 1 are always clean.

jobs is taken care of automatically; ninja, lld, and the test runner all have some logic for using parallelism automatically. I removed the part of the code that sets jobs (which then gets ignored). Let me know if you want me to actually implement something there, but I don't see a current need for it.

  1. What changes will trigger a build on an annotated builder, and how this is set for the "clang-with-thin-lto-windows" one?

My understanding is that because the builder is declared with category 'lld', the same logic that schedules the other builders with category 'lld' will schedule this one. However, I may be mistaken and I wasn't able to fully test that, as the local buildmaster I set up to test this with has most of the logic for builders, workers, and schedulers removed and so is materially different from the production one. If there is something more I need to do there, please let me know.

buildbot/osuosl/master/config/slaves.py
162 ↗(On Diff #98845)

Actually, it doesn't use it, because ninja automatically sets the number of jobs. I've removed the property here.

zorg/buildbot/builders/annotated/clang-with-thin-lto-windows.py
19 ↗(On Diff #98845)

Yeah. I was using that for testing. I've removed that; it now defaults to using the revision from BUILDBOT_REVISION.

inglorion updated this revision to Diff 99362.May 17 2017, 4:29 PM
inglorion edited edge metadata.
inglorion marked 2 inline comments as done.

Thanks for reviewing, @gkistanova. I think I have addressed all the points you raised.

  • Fixed the indentation where I found it to be wrong.
  • Removed redundant specification of number of jobs.
  • Changed master os dependent directory separator to a portable one.
  • Removed hardcoded revision.
  • Implemented support for clean/clobber.

Thanks for addressing the comments, Bob.
We are getting there.

clean is now implemented: It sets BUILDBOT_CLOBBER=1.

If the factory instantiated with clean=False, the builder should respect an optional clean property, so it would be possible to force a clean build either from the Web UI or based on a commit message. You can see how this is done in, for example, the UnifiedTreeBuilder.py. In your case, you would need to do something similar to

cleanBuildRequested = lambda step: clean or step.build.getProperty("clean")

and pass the result to the builder script by setting BUILDBOT_CLOBBER accordingly.

The same is for the jobs. If a build request has a jobs property specified one way or another, it should be enforced by the builder. Some run multiple builders on the same hardware and would want to explicitly restrict how many resources are taken by a particular builder.

inglorion updated this revision to Diff 99832.May 22 2017, 5:04 PM

Thank for the review, @gkistanova! I've added support for the clean and jobs properties.

gkistanova accepted this revision.May 26 2017, 4:55 PM

You still need to set the jobs parameter for LIT at the check-all step.

After this fix, please feel free to commit.

zorg/buildbot/builders/AnnotatedBuilder.py
33 ↗(On Diff #99832)

It would be nice to set the clobber property without these 2 build steps, but I cannot suggest the right way of doing this at the moment.

This revision is now accepted and ready to land.May 26 2017, 4:55 PM
inglorion updated this revision to Diff 100801.May 30 2017, 5:05 PM

pass -j argument to lit if jobs parameter is present

This revision was automatically updated to reflect the committed changes.