lbryio / lbrycrd

The blockchain that provides the digital content namespace for the LBRY protocol
https://lbry.com
MIT License
2.57k stars 178 forks source link

Can't run some test cases. #168

Closed roylee17 closed 6 years ago

roylee17 commented 6 years ago

Do I need to perform some pre-test setup? (I'm running on MacOS)

$ make -j src/test/test_lbrycrd
$ src/test/test_lbrycrd --run_test=claimtriebranching_tests
Running 14 test cases...
unknown location:0: fatal error: in "claimtriebranching_tests/claimtriebranching_claim": memory access violation at address: 0x6d7d935f: no mapping at fault address
test/claimtriebranching_tests.cpp:205: last checkpoint

*** 1 failure is detected in the test module "Bitcoin Test Suite"
Database handles still open at environment close
Open database handle: unnamed/wallet.dat

Some test cases run without problem.

$ src/test/test_lbrycrd --run_test=claimtrie_tests/claimtrie_merkle_hash

Running 1 test case...

*** No errors detected
bvbfan commented 6 years ago

You are right Roy. Pointer should be initialized to NULL, since this not failing on Linux, due to null-initialized memory or some debug option in make check. Also in https://github.com/lbryio/lbrycrd/blob/master/src/test/claimtrie_tests.cpp#L87 @kaykurokawa should be noted.

lbrynaut commented 6 years ago

You are right Roy. Pointer should be initialized to NULL, since this not failing on Linux, due to null-initialized memory or some debug option in make check. Also in https://github.com/lbryio/lbrycrd/blob/master/src/test/claimtrie_tests.cpp#L87 @kaykurokawa should be noted.

@bvbfan The line you pointed out does have a bug, but initializing the value to null is not the optimal solution. Properly ensuring the variable is allocated is the actual fix. If instead the caller really wanted to pass null, then NULL should be passed, not a variable pointing to NULL. A subtle difference, but noted for clarification.

This issue is resolved by #173