Page MenuHomePhabricator

Attempt to build XHPAST during unit tests
ClosedPublic

Authored by joshuaspence on Jan 27 2015, 7:36 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 24, 7:30 AM
Unknown Object (File)
Fri, Nov 22, 2:44 PM
Unknown Object (File)
Thu, Oct 31, 1:40 PM
Unknown Object (File)
Oct 23 2024, 4:58 AM
Unknown Object (File)
Oct 19 2024, 9:14 AM
Unknown Object (File)
Oct 1 2024, 11:13 AM
Unknown Object (File)
Sep 23 2024, 9:34 PM
Unknown Object (File)
Sep 18 2024, 11:42 PM
Subscribers

Details

Summary

If we have an out-of-date XHPAST binary, attempt to rebuild XHPAST as a part of running the unit tests. If XHPAST is missing (or we cannot build it for whatever reason), just skip the unit tests as per the existing behavior.

Test Plan

Deleted src/parser/xhpast/bin/xhpast and ran arc unit -- src/parser/xhpast.

Diff Detail

Repository
rPHU libphutil
Branch
master
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 4230
Build 4243: [Placeholder Plan] Wait for 30 Seconds

Event Timeline

joshuaspence retitled this revision from to Don't allow XHPAST tests to be skipped.
joshuaspence updated this object.
joshuaspence edited the test plan for this revision. (Show Details)
joshuaspence added a reviewer: epriestley.
joshuaspence edited edge metadata.
joshuaspence edited the test plan for this revision. (Show Details)
epriestley edited edge metadata.

I think we should be liberal about skipping tests.

The reason to skip these tests is that you can't automatically build xhpast and don't want to bother setting up your machine so you can. I think this is a reasonable point of view to have, and comparable to skipping hg or svn tests, and that it's OK to be liberal about skipping tests because we'll eventually fill in the gaps with CI, and, as of today, I think we see very few issues which would have been caught by executing skipped tests.

(In particular, on OSX, you need to install the "Developer Tools" to get GCC, and the first time I did it I had to Google to figure it out, and it's a 2GB download and involves a bunch of extra steps (the most recent version made me agree to a EULA the next time I ran git!) and you need an Apple/iTunes account. Or you need to install brew or something, I guess, and best of luck with that. This isn't a huge huge deal, but it's more involved than apt-get install gcc.)

Overall, I'm hesitant to make installing gcc a prerequisite for Phabricator development, because in reasonable situations it might make writing a first patch (e.g., a typo fix) something like 10x harder than it otherwise would be, and I don't think there's very much benefit to be had in running tests that depend on things you don't have installed. That is, it's fairly hard to break XHPAST with a defensible change on a system that doesn't have XHPAST built. This is slightly less true for hg vs git stuff, which has more overlap, but I think we're seeing a very low overall slop rate here. And this is 100% catchable with CI eventually, which will align the incentives correctly ("Oh, let me go install gcc so I can fix that, I know there's a problem with my code") vs ("There's no possible way I broke xhpast but I still have to install gcc, this sucks").

This revision now requires changes to proceed.Jan 27 2015, 2:17 PM

Right, that's a reasonable point-of-view to have. I suppose that the intention here was to prevent XHPAST tests from being skipped if you can reasonably build XHPAST. The thought was that if you had previously built XHPAST but had just forgot to rebuild it recently, then I don't think that this is a reason to skip the tests.

A slightly more correct approach might be this:

public function testParser() {
  $available = xhpast_is_available();

  if (!$available) {
    try {
      xhpast_build();
    } catch (Exception $e) {
      $this->assertSkipped(...);
    }
  }

That alternate approach (if it was built in the past and is merely out of date, try to rebuild it; then skip the test if it fails) seems reasonable to me.

joshuaspence edited edge metadata.

As per suggestions

joshuaspence retitled this revision from Don't allow XHPAST tests to be skipped to Attempt to build XHPAST during unit tests.Jan 27 2015, 9:05 PM
joshuaspence updated this object.
joshuaspence edited edge metadata.
epriestley edited edge metadata.
This revision is now accepted and ready to land.Feb 2 2015, 2:00 PM
This revision was automatically updated to reflect the committed changes.