Skip to content

Commit d2a4935

Browse files
jonasnickFabcien
authored andcommitted
[SECP256K1] Fix issue where travis does not show the logs
Summary: ``` I noticed that according to the doc 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. ``` Backport of secp256k1 [[bitcoin-core/secp256k1#685 | PR685]]. Depends on D5433. It slightly varies from the PR by only printing the logs in the event of a failure. There is no need to explicitly cat the logs with the cmake build because they are already printed by the test runner in case of failure. Before: https://travis-ci.org/Fabcien/secp256k1/jobs/658610743 After: https://travis-ci.org/Fabcien/secp256k1/jobs/658631083 Test Plan: Run the Travis build (see https://travis-ci.org/Fabcien/secp256k1/builds/658633612). Reviewers: #bitcoin_abc, deadalnix Reviewed By: #bitcoin_abc, deadalnix Subscribers: deadalnix Differential Revision: https://reviews.bitcoinabc.org/D5434
1 parent 14b0126 commit d2a4935

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/tests.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5176,6 +5176,15 @@ void run_ecdsa_openssl(void) {
51765176
int main(int argc, char **argv) {
51775177
unsigned char seed16[16] = {0};
51785178
unsigned char run32[32] = {0};
5179+
5180+
/* Disable buffering for stdout to improve reliability of getting
5181+
* diagnostic information. Happens right at the start of main because
5182+
* setbuf must be used before any other operation on the stream. */
5183+
setbuf(stdout, NULL);
5184+
/* Also disable buffering for stderr because it's not guaranteed that it's
5185+
* unbuffered on all systems. */
5186+
setbuf(stderr, NULL);
5187+
51795188
/* find iteration count */
51805189
if (argc > 1) {
51815190
count = strtol(argv[1], NULL, 0);

travis/build_autotools.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ pushd buildautotools
3535
$AUTOTOOLS_EXTRA_FLAGS \
3636
$USE_HOST
3737

38+
print_logs() {
39+
cat tests.log || :
40+
cat exhaustive_tests.log || :
41+
}
42+
trap 'print_logs' ERR
43+
3844
make -j2 $AUTOTOOLS_TARGET
3945

4046
popd

0 commit comments

Comments
 (0)