This is an archive of the discontinued LLVM Phabricator instance.

[Zorg] Adding test-suite to CMake ClangBuilder
ClosedPublic

Authored by rengolin on Jun 4 2015, 7:54 AM.

Details

Summary

This patch allows running the test-suite on the CMake version of the
Clang builder. Stage2 builds will be used built. This should not change
any of the current builders' logic.

Diff Detail

Event Timeline

rengolin updated this revision to Diff 27118.Jun 4 2015, 7:54 AM
rengolin retitled this revision from to [Zorg] Adding test-suite to CMake ClangBuilder.
rengolin updated this object.
rengolin edited the test plan for this revision. (Show Details)
rengolin added reviewers: rfoos, rsmith, gkistanova, rnk, enefaim.
rengolin set the repository for this revision to rL LLVM.
rengolin added a subscriber: Unknown Object (MLST).
rnk edited edge metadata.Jun 4 2015, 10:10 AM

This seems pretty reasonable. I've never tried to run test-suite on Windows, so I wouldn't worry too much about trying to make it work here.

zorg/buildbot/builders/ClangBuilder.py
449–451

Let's just drop the =True defaults, given that the only caller is here in this file. It gives the wrong impression that most builders are going to run test-suite, when the true default is below in getClangCMakeBuildFactory.

686–688

These and other assignments should probably have space separation, since they aren't kwargs.

693–694

I think ultimately the test suite will want the path to the gcc-compatible clang driver and not clang-cl. If and when we port it to Windows, we can figure out how to get clang-cl if we need it then. I'd suggest sinking the cc and cxx assignments above into the if useTwoStage: block and just using clang and clang++ here.

708–714

This file appears to use four-space indentation, so let's stick with that.

709

isinstance(submitURL, list) would probably be more readable.

gkistanova edited edge metadata.Jun 10 2015, 4:19 PM

Hello Renato,

It seems you just need to build the bootstrapped clang and use it to run the test-suite, right?
May I suggest subclassing the current ClangCMakeBuildFactory instead of adding parameters and more complicated logic?

You can move the getClangCMakeBuildFactory build steps creation to a separate method (similar to addSVNUpdateSteps), call it with the request for 2 stages, and then add whatever it takes to build and run the test-suite in your ClangCMakeAndTestsuiteBuildFactory(?).

Should be more clear code after all.

What do you think?

Hi Reid,

Thanks for the comments, I'll make the changes.

Galina,

I'll try to split the methods, but I'm very deficient in Python. Also, there is a parallel move to make that work better on Windows, and I don't want to move it too much away from what that merge request is coming from.

cheers,
--renato

Galina,

About splitting the code, there are some factors to consider:

  1. The test-suite needs some internal knowledge of what was the last build (stage1/2) and what is the compiler used. I can refactor the compiler name out, but I'm not sure how to do the same about what stage directory to use without leaking internal information through (ie. install directory name).
  2. This builder will do more than just test. The goal is to have it building with and without all variations of libraries and tools (libgcc vs. compiler-rt, libstdc++ vs. libc++, ld vs. lld, stage1 vs. stage2, etc), and separating them apart may create a lot of interdependency between them (see item 1 above).

So, unless we do a big refactoring to the code, I'm not sure any effort in splitting it would do justice, or make it simpler. Mostly because I'm not great at Python to do it right...

If someone could help with the refactoring, I'd be glad to follow the pattern, but I'm afraid I can't create the pattern myself... :(

zorg/buildbot/builders/ClangBuilder.py
693–694

So, this cc/cxx depends on which was the last stage (1 or 2), while the previous usage is constant on stage1 build.

If I sink this before runTestSuite, I'll have to sink the other set, and I'll still have to reassign it here for the stage2 if necessary, duplicating the "if useTwoStage" conditional.

I'm not sure how keeping them separate could hurt checking for the correct compiler more than it already was. Ie. I don't really understand what the problem is, and I don't want to try to fix a problem I myself don't understand. By keeping it similar, it would be simpler for someone that understands the problem better to fix in the future.

rengolin updated this revision to Diff 27664.Jun 15 2015, 6:37 AM
rengolin edited edge metadata.
rengolin removed rL LLVM as the repository for this revision.

Addressing some cosmetic issues from reviews. Still in one Factory.

rengolin updated this revision to Diff 27846.Jun 17 2015, 10:47 AM

Using isinstance instead of comparing the type.

Reid, Galina, what do you think about keeping this one simple and re-factoring into multiple functions later?

rnk added a comment.Jun 17 2015, 10:57 AM

I'm OK leaving this as one function.

zorg/buildbot/builders/ClangBuilder.py
686–688

These assignments and others are still not using spaces. I think it bothers me because when you do it like this I assume it's part of a sequence of kwargs and I go looking for a function call to match it up with.

Ok, I'll leave it as it is and check with Rick what he prefers for the Windows part. We can refactor that out later. Thanks!

zorg/buildbot/builders/ClangBuilder.py
686–688

Now I get what you mean by this "not being kwargs"... :)

I'll change those assignments and check for others in a subsequent commit, to make sure I'm not adding a lot of cosmetic unrelated changes.

gkistanova accepted this revision.Jun 17 2015, 12:55 PM
gkistanova edited edge metadata.

If you call this simple. :)

Fine with later re-factoring.
LGTM, assuming you will fix the cosmetic things, Reid pointed to.

This revision is now accepted and ready to land.Jun 17 2015, 12:55 PM
rengolin accepted this revision.Jun 17 2015, 1:36 PM
rengolin closed this revision.
rengolin added a reviewer: rengolin.

Thanks! r239928

I agree splitting it is the best option, I just need time to do it properly. :)