Skip to content

Commit 0db61d2

Browse files
Merge #685: Fix issue where travis does not show the ./tests seed…
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 #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
2 parents 22a6031 + a0771d1 commit 0db61d2

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

.travis.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ matrix:
7777
apt:
7878
packages:
7979
- valgrind
80-
80+
8181
before_install: mkdir -p `dirname $GUAVA_JAR`
8282
install: if [ ! -f $GUAVA_JAR ]; then wget $GUAVA_URL -O $GUAVA_JAR; fi
8383
before_script: ./autogen.sh
@@ -93,4 +93,8 @@ script:
9393
make -j2 &&
9494
travis_wait 30 valgrind --error-exitcode=42 ./tests 16 &&
9595
travis_wait 30 valgrind --error-exitcode=42 ./exhaustive_tests;
96-
fi
96+
fi
97+
98+
after_script:
99+
- cat ./tests.log
100+
- cat ./exhaustive_tests.log

src/tests.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5169,6 +5169,15 @@ void run_ecdsa_openssl(void) {
51695169
int main(int argc, char **argv) {
51705170
unsigned char seed16[16] = {0};
51715171
unsigned char run32[32] = {0};
5172+
5173+
/* Disable buffering for stdout to improve reliability of getting
5174+
* diagnostic information. Happens right at the start of main because
5175+
* setbuf must be used before any other operation on the stream. */
5176+
setbuf(stdout, NULL);
5177+
/* Also disable buffering for stderr because it's not guaranteed that it's
5178+
* unbuffered on all systems. */
5179+
setbuf(stderr, NULL);
5180+
51725181
/* find iteration count */
51735182
if (argc > 1) {
51745183
count = strtol(argv[1], NULL, 0);

0 commit comments

Comments
 (0)