Skip to content

Conversation

@jnewbery
Copy link
Contributor

The QA tests are currently quite noisy even when they run successfully. They output progress information which fills up pages of screen. This might be what you want when running the tests locally, but for build/integration tools it fills the output log with spam.

This PR suppresses noisy output from the qa tests. It builds on and requires both #9657 and #9768. There are three commits specifically for this PR:

  • commit 1 adds a 'quiet' option to rpc-tests.py, which suppresses the progress output to stdout.
  • commit 2 updates .travis.yml to use quiet mode
  • commit 3 prints out the final 1000 lines of test_framework.log if the test fails.

Example of a successful travis run: https://travis-ci.org/jnewbery/bitcoin/jobs/202373787
Example of a failed travis run: https://travis-ci.org/jnewbery/bitcoin/jobs/202374810


# Set up logging handler
sh = logging.StreamHandler()
sh.setLevel((logging.INFO if args.quiet else logging.DEBUG))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe only call sh.setLevel if args.quiet is true, because logging.DEBUG can still throw away logs at levels < 10.

try:
print("From" , f, ":")
print("".join(deque(open(f), MAX_LINES_TO_PRINT)))
except:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this very broad exception handler could hide information we might like to know about. I would remove it, or narrow it, or at least at stick a "traceback.print_exc()" call in here.

If this handler is supposed to handle the case where f does not exist, you could add an "if os.path.exists(f)" or similar check above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Printing the tails of the log files here is simply to help if the test case fails on travis. My thinking in adding the try/except handling is that if reading a log file fails for any reason, we should just continue and try to print out the other log files. I don't want there to be any chance that this commit makes the logging available on travis any worse.

I've added a print out of the stack trace exception in the except branch. Does that allay your concerns here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The print addresses most of my concern. If something goes wrong, I would prefer to know about it.

I also think you should change the bare except to except OSError or except Exception. It isn't right to ignore exceptions like SystemExit or KeyboardInterrupt and keep looping if someone is trying to kill the program. (For reference: https://docs.python.org/3/library/exceptions.html#exception-hierarchy)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree on catching only a more concrete exception, specially if you're expecting one in particular, as it seems to be the case in a2a5651 . Also you could print the message of the exception too (before the traceback).

@fanquake fanquake added the Tests label Feb 17, 2017
@laanwj
Copy link
Member

laanwj commented Feb 17, 2017

Concept ACK, filtering signal/noise has been a pet peeve of me for as long as we have a travis run, but never got around to it. Thanks for doing this.

@JeremyRubin
Copy link
Contributor

I like the approach, but I think that it would be preferable to have some output (e.g., periods) while the tests are running. This is because of a limitation in Travis CI where if no output is seen for 10 minutes the build will fail. This has been a problem historically in the unit tests, but was only addressed (by me) by making them run more quickly such that this is not an issue.

@laanwj
Copy link
Member

laanwj commented Feb 17, 2017

Yes, printing periods or another kind of progress display would be nice. My issue is with tons of unnecessary debug output.

Edit: But don't we already do that during the RPC tests, printing periods?

@ryanofsky
Copy link
Contributor

utACK d580707

@jnewbery
Copy link
Contributor Author

@laanwj - this PR suppresses the period printing when running --quiet mode. Do you want me to put that back in?

@laanwj
Copy link
Member

laanwj commented Feb 18, 2017

this PR suppresses the period printing when running --quiet mode. Do you want me to put that back in?

Not necessarily. Just in the mode that Travis uses, apparently it needs to print something (and dots are better than text spam :-) to avoid the timeout problem that @JeremyRubin mentions.

@jnewbery
Copy link
Contributor Author

I've rebased this now that #9657 has been merged. I've also made a change so that period printing still happens in quiet mode. That should prevent any Travis timeout issues.

@ryanofsky
Copy link
Contributor

re-utACK 85312c075e7bf3379e0a277e3393e734f940b71c. Confirmed no changes since last rebase other than restoring the print('.').

I would definitely prefer not to be adding the catch-all except handler here, though: #9780 (comment)

@jnewbery
Copy link
Contributor Author

rebased and addressed #9780 (comment).

@jtimon
Copy link
Contributor

jtimon commented Mar 21, 2017

utACK a2a565180449b80c054c05c12c93097f1e8752c2 except for @ryanofsky 's nit. Needs rebase.

@jnewbery
Copy link
Contributor Author

Updated the exception handler to catch only OSError exceptions as suggested by @ryanofsky and rebased.

@jtimon
Copy link
Contributor

jtimon commented Mar 25, 2017

Needs rebase again.

rpt-tests.py outputs progress information as it runs tests. This commit
adds a --quiet option that suppresses that progress output and only
prints a summary of results (and logs from failed tests).
@jnewbery
Copy link
Contributor Author

rebased. I think this is useful PR since it suppresses noisy output in travis when tests pass and also increases the amount of logging available when the test fails. This will be helpful in debugging intermittent functional test failures in Travis. @MarcoFalke , @laanwj - can I convince you to review this PR?

@laanwj
Copy link
Member

laanwj commented Mar 27, 2017

utACK 2c0be25

@maflcko
Copy link
Member

maflcko commented Mar 27, 2017

utACK 2c0be25bd6b744cab60a3672409750545522733a. Please squash the fixup commit.

@jnewbery
Copy link
Contributor Author

squashed

@maflcko maflcko merged commit 8c7288c into bitcoin:master Mar 28, 2017
maflcko pushed a commit that referenced this pull request Mar 28, 2017
8c7288c Print out the final 1000 lines of test_framework.log if test fails (John Newbery)
6d780b1 Update travis config to run rpc-tests.py in quiet mode (John Newbery)
55992f1 Add --quiet option to suppress rpc-tests.py output (John Newbery)

Tree-SHA512: ab080458a07a9346d3b3cbc8ab59b73cea3d4010b1cb0206bb5fade0aaac7562c623475d0a02993f001b22ae9d1ba68e2d0d1a3645cea7e79cc1045b42e2ce3a
codablock pushed a commit to codablock/dash that referenced this pull request Jun 18, 2019
8c7288c Print out the final 1000 lines of test_framework.log if test fails (John Newbery)
6d780b1 Update travis config to run rpc-tests.py in quiet mode (John Newbery)
55992f1 Add --quiet option to suppress rpc-tests.py output (John Newbery)

Tree-SHA512: ab080458a07a9346d3b3cbc8ab59b73cea3d4010b1cb0206bb5fade0aaac7562c623475d0a02993f001b22ae9d1ba68e2d0d1a3645cea7e79cc1045b42e2ce3a
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 18, 2019
8c7288c Print out the final 1000 lines of test_framework.log if test fails (John Newbery)
6d780b1 Update travis config to run rpc-tests.py in quiet mode (John Newbery)
55992f1 Add --quiet option to suppress rpc-tests.py output (John Newbery)

Tree-SHA512: ab080458a07a9346d3b3cbc8ab59b73cea3d4010b1cb0206bb5fade0aaac7562c623475d0a02993f001b22ae9d1ba68e2d0d1a3645cea7e79cc1045b42e2ce3a
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants