Skip to content

Commit

Permalink
Merge bitcoin#685: Fix issue where travis does not show the ./tests s…
Browse files Browse the repository at this point in the history
…eed…

a0771d1 Explicitly disable buffering for stderr in tests (Jonas Nick)
fb424fb Make travis show the ./tests seed by removing stdout buffering and always cat tests.log after a travis run. (Jonas Nick)

Pull request description:

  …by removing stdout buffering and always cat tests.log after a travis run. Fixes bitcoin#645.

  I noticed that according to the [doc](https://www.gnu.org/software/automake/manual/html_node/Parallel-Test-Harness.html) tests.log should contain stdout as well as stderr. But it doesn't because stdout isn't flushed. I removed buffering completely to avoid having to call `fflush` twice.

  Travis is instructed to always show the seed which seems helpful with `after_script` by `cat`ing `./tests.log`. In case the tests fail it looks like https://travis-ci.org/jonasnick/secp256k1/jobs/606446234.

ACKs for commit a0771d:
  real-or-random:
    ACK a0771d1 I looked at the diff and checked that it does not break the tests

Tree-SHA512: 3ba37c2d9169867112981bba3d56680000651ef22ef684c3703f26ed3f71bf415fb23875d30059c8247ea9520c9cfad2c9207badf1b33da8fa3b7b7235a8bf16
  • Loading branch information
real-or-random committed Nov 25, 2019
2 parents 22a6031 + a0771d1 commit 0db61d2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ matrix:
apt:
packages:
- valgrind

before_install: mkdir -p `dirname $GUAVA_JAR`
install: if [ ! -f $GUAVA_JAR ]; then wget $GUAVA_URL -O $GUAVA_JAR; fi
before_script: ./autogen.sh
Expand All @@ -93,4 +93,8 @@ script:
make -j2 &&
travis_wait 30 valgrind --error-exitcode=42 ./tests 16 &&
travis_wait 30 valgrind --error-exitcode=42 ./exhaustive_tests;
fi
fi

after_script:
- cat ./tests.log
- cat ./exhaustive_tests.log
9 changes: 9 additions & 0 deletions src/tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -5169,6 +5169,15 @@ void run_ecdsa_openssl(void) {
int main(int argc, char **argv) {
unsigned char seed16[16] = {0};
unsigned char run32[32] = {0};

/* Disable buffering for stdout to improve reliability of getting
* diagnostic information. Happens right at the start of main because
* setbuf must be used before any other operation on the stream. */
setbuf(stdout, NULL);
/* Also disable buffering for stderr because it's not guaranteed that it's
* unbuffered on all systems. */
setbuf(stderr, NULL);

/* find iteration count */
if (argc > 1) {
count = strtol(argv[1], NULL, 0);
Expand Down

0 comments on commit 0db61d2

Please sign in to comment.