Fix test caching behavior of Buck.

Summary:
Since we do not zip the test output with the TestRule's output jar,
we would incorrectly report test results if we have a cache hit for
the rule's output.

CachedTestIntegrationTest was supposed to catch this, but it had a bug
where it was always running tests regardless, since it was looking for the
xmls in the actual source directory instead of the JUnit temp directory.

To fix this, I write the rule key of the rule to it's output directory, and
read it later to validate the output against the current rule key while
checking for cached outputs.

Test Plan:
CachedTestIntegrationTest is green.

On a test project with caching enabled :

1.) Run tests and make sure they are green.
2.) Introduce a breaking change (`assertTrue(false)`), and the test will be red.
3.) Revert the change. Make sure tests run again and they are green.
4.) Rerun the test without any change. They do not run again but display are
    reported as Green.

(I verified (4) by observing that I don't see TESTING <target-name> in the
output)

On a clean master (3) would report the test as still failing.
11 files changed
tree: b1213736ab87afb11897b3aef764d3246f87378b
  1. .idea/
  2. bin/
  3. config/
  4. docs/
  5. lib/
  6. plugin/
  7. pmd/
  8. scripts/
  9. src/
  10. test/
  11. testdata/
  12. third-party/
  13. .buckconfig
  14. .classpath
  15. .gitignore
  16. .project
  17. buck.iml
  18. build.xml
  19. DEFS
  20. LICENSE
  21. README.md
README.md

Buck

Buck is an Android build tool. To see what Buck can do for you, check out the documentation at http://facebook.github.io/buck/.

Installation

To build Buck, run the following:

git clone git@github.com:facebook/buck.git
cd buck
ant
./bin/buck --help

License

Apache License 2.0