Re-arrange test failure output for better usability.
commit18ec35ccdd9c539db3c56f79fc24a76c72c0ca57
authorAlexey Toptygin <alexeyt@fb.com>
Fri, 29 May 2020 22:45:06 +0000 (29 15:45 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Fri, 29 May 2020 22:48:23 +0000 (29 15:48 -0700)
tree43312ba106d6a63329311206463d50d1159ba841
parent8822f2e01f608d36a69179adf3282978ffa383d4
Re-arrange test failure output for better usability.

Summary:
On test run failure, we want the most relevant/likely to be copypasted output to be closer to the bottom, and more of (or even all of) the output to fit in one terminal window. This means the user will be less likely to need to scroll, or to look very far up. To this end:

The `Re-run just the failing tests:` section stays last.

Move failing/passing tests files output to just above that and condense them together.

Instead of a `See the diffs:` section (which was all the way at the top), the next thing on the way up is now a `See failed test output and expectations:` section that lists the .diff, .out, and .expect[f] paths for failed tests (listing more things in preparation for the .out and .diff moving to a temporary directory). Limit it to 3 failed tests worth unless the user passes `--verbose`, and print how many more tests were not shown in this section.

The `Run these by hand:` could easily get huge and make everything above it scroll off the screen; also it is hard to see at a glance where one test ends and the next begins. Address this by putting this section all the way at the top (so that it doesn't push other sections off the screen), and by default (unless the user passes `--verbose`) make it show just one test's worth of repro steps (on the assumption that repro steps are most useful when debugging a single test). If `--verbose` is passed, we continue to print steps for every test (and as before we do this even if they all passed).

To illustrate the new order, when many test failed we end with e.g.:
```
11 tests failed
(╯°□°)╯︵ ┻━┻

Run hphp/test/quick/abs_codegen.php by hand:
./buck-out/gen/hphp/hhvm/hhvm/hhvm -c /data/users/alexeyt/fbsource3/fbcode/hphp/test/config.ini -vEval.EnableArgsInBacktraces=false -vEval.EnableIntrinsicsExtension=true -vEval.HHIRInliningIgnoreHints=false -vEval.HHIRAlwaysInterpIgnoreHint=false -vRepo.Local.Mode=-- -vRepo.Central.Path=/data/users/alexeyt/fbsource3/fbcode/buck-out/gen/hphp/hhvm/hhvm/verify.hhbc -vEval.Jit=true  -vEval.ProfileHWEnable=false -vEval.HackCompilerExtractPath='/data/users/alexeyt/fbsource3/fbcode/buck-out/gen/hphp/hhvm/hhvm/hackc_%{schema}' -vEval.EmbeddedDataExtractPath='/data/users/alexeyt/fbsource3/fbcode/buck-out/gen/hphp/hhvm/hhvm/hhvm_%{type}_%{buildid}'  -vAutoload.DBPath='hphp/test/quick/abs_codegen.php.0.autoloadDB' -vResourceLimit.CoreFileSize=0    --file 'hphp/test/quick/abs_codegen.php'

See failed test output and expectations:
cat hphp/test/quick/abs_codegen.php.diff
cat hphp/test/quick/abs_codegen.php.out
cat hphp/test/quick/abs_codegen.php.expectf

cat hphp/test/quick/vec/basic-getters.php.diff
cat hphp/test/quick/vec/basic-getters.php.out
cat hphp/test/quick/vec/basic-getters.php.expect

cat hphp/test/quick/vec/basic-init.php.diff
cat hphp/test/quick/vec/basic-init.php.out
cat hphp/test/quick/vec/basic-init.php.expect

... and 8 more.

For xargs, lists of failed and passed tests are available using:
cat /tmp/test-failuresrzCqJV
cat /tmp/tests-passedwBf8kS

Re-run just the failing tests:
./hphp/test/run  $(cat /tmp/test-failuresrzCqJV)

Total time for all executed tests as run: 18.88s
Total time for all executed tests if run serially: 884.46s
```

Before this change, full output for 1 failing test looked like: P131681832 and output for many failing tests looked like P131683008

After this diff, full output for one failing test looks like P131683404 and for many failing tests looks like P131683666

Reviewed By: fredemmott

Differential Revision: D21693841

fbshipit-source-id: bae6785c34b16917f21698e38a3d9177cc53fbab
hphp/test/run.php