Search code examples
cubuntuwindows-subsystem-for-linuxbitcoin

Make check FAIL: test/test_bitcoin


I am new to Ubuntu environment and I am trying to build the Bitcoin Core 0.15.0 executables (following chapter 3 of the book Mastering Bitcoin) through WSL on Windows 10. Everything seemed to be working fine, until I execute "make check", where I get the following messages:

FAIL: test/test_bitcoin
============================================================================
Testsuite summary for Bitcoin Core 0.15.0
============================================================================
# TOTAL: 1
# PASS:  0
# SKIP:  0
# XFAIL: 0
# FAIL:  1
# XPASS: 0
# ERROR: 0
============================================================================
See src/test-suite.log
Please report to https://github.com/bitcoin/bitcoin/issues
============================================================================
Makefile:9385: recipe for target 'test-suite.log' failed
make[4]: *** [test-suite.log] Error 1
make[4]: Leaving directory '/home/adromo95/bitcoin/src'
Makefile:9491: recipe for target 'check-TESTS' failed
make[3]: *** [check-TESTS] Error 2
make[3]: Leaving directory '/home/adromo95/bitcoin/src'
Makefile:9597: recipe for target 'check-am' failed
make[2]: *** [check-am] Error 2
make[2]: Leaving directory '/home/adromo95/bitcoin/src'
Makefile:9278: recipe for target 'check-recursive' failed
make[1]: *** [check-recursive] Error 1
make[1]: Leaving directory '/home/adromo95/bitcoin/src'
Makefile:740: recipe for target 'check-recursive' failed
make: *** [check-recursive] Error 1

When I open "test-suite.log", I get the following:

=============================================
   Bitcoin Core 0.15.0: src/test-suite.log
=============================================

# TOTAL: 1
# PASS:  0
# SKIP:  0
# XFAIL: 0
# FAIL:  1
# XPASS: 0
# ERROR: 0

.. contents:: :depth: 2

FAIL: test/test_bitcoin
=======================

Running 258 test cases...
unknown location(0): fatal error: in "rpc_tests/rpc_ban": std::runtime_error: JSON value is not an objec
t as expected
test/rpc_tests.cpp(258): last checkpoint

*** 1 failure is detected in the test module "Bitcoin Test Suite"
FAIL test/test_bitcoin (exit status: 201)

Has anyone an idea on how to solve this? I haven't seen previous questions concerning this specific issue.

Thank you all in advance.

I reinstalled Ubuntu (currently running on 18.04.6 LTS), tried another Bitcoin Core version, redo all the steps, etc. But nothing worked. I do not know if may be needed to modify specific lines of code or adding a specific path.


Solution

  • It seems that this was a bug in the test code such that the tests worked when they were written, but would fail if the test was run after the year 2020.

    Using a popular search engine for your error message brought up exactly one match, which was a code merge in Bitcoin Cash ABC (which forked off from bitcoin core in 2017).

    Make tests pass after 2020
    and also test that 64 bit integers are properly handled
    
    Without this patch, the failure was
    
    unknown location(0): fatal error: in "rpc_tests/rpc_ban": std::runtime_error: JSON value is not an object as expected
    test/rpc_tests.cpp(260): last checkpoint
    

    An identical looking commit also exists in the bitcoin core repository.

    You could manually apply the changes to your copy of the code if you want to keep trying to use this fairly old version. There are only two or three lines to change.