Skip to content

Conversation

@jnewbery
Copy link
Contributor

@jnewbery jnewbery commented Mar 8, 2017

Initially proposed by @jonasschnelli here: https://botbot.me/freenode/bitcoin-core-dev/2017-02-16/?msg=81095853&page=5

This re-organises the qa test directory to meet the following requirements:

  • qa directory should be renamed to come after /src alpabetically, so that git diffs and github PRs show changes to qa tests beneath changes to product code.
  • rpc-tests should be renamed to something, since they test more than the RPC interface
  • pull-tester should be renamed to something, since it's run locally as well as on PRs
  • bitcoin-util-test should be moved to the qa test directory, since it's a functional test rather than a unit test.

This PR has the following commits:

  • commit 1 renames qa to test
  • commit 2 renames the rpc-tests directory to qa
  • commit 3 renames test/pull-tester/rpc-tests.py to test/runner/runner.py
  • commit 4 renames the --enable-extended-rpc-tests configure option to --enable-extended-qa-tests
  • commit 5 moves the bitcoin-util-test.py test into test/util

The new directory structure is [EDITED]:

|--src
|   |--<source files etc>
|   |--test
|       |---<unit tests>
|
|--test
   |---functional
   |   |---<tests (were previously in /qa/rpc-tests)>
   |   |---test_runner.py (was previously qa/pull-tester/rpc-tests.py)
   |   |---test_config.ini
   |  
   |---README.md
   |
   |---util
   |   |---bctest.py (was previously in src/test)
   |   |---bitcoin-util-test.py (was previously in src/test)
   |   |---buildenv.py.in (was previously in src/test)
   |   |---data (was previously in src/test)
   |   |   |---<data files>

The actual structure within the new directories is unchanged to minimize changes.

I've tested this at each commit by rebuilding and running the test cases. Reviewers note that you'll need to ./autogen.sh and ./configure to test this.

Any feedback on names or structure welcomed.

@jonasschnelli
Copy link
Contributor

Concept ACK.
What about using ...

|--test
   |---rpc-tests

instead of

|--test
   |---qa

?

@sipa
Copy link
Member

sipa commented Mar 9, 2017

@jonasschnelli It doesn't contain purely RPC tests anymore (also P2P and REST).

@JNewberry Why is runner separate? My #1 complaint about the current structure is that the runner is in a separate directory.

@laanwj
Copy link
Member

laanwj commented Mar 9, 2017

Concept ACK. New structure looks good to me.

Agree that there's no need for the runner to be separate. It can go with the other Python code.

@jonasschnelli It doesn't contain purely RPC tests anymore (also P2P and REST).

Indeed. These are "functional tests" or "integration tests" in contrast to the "unit tests" which are part of the C++ source code. They make use of RPC, but that doesn't define them, ideally they should test every interface.

@jonasschnelli
Copy link
Contributor

Indeed. These are "functional tests" or "integration tests" in contrast to the "unit tests" which are part of the C++ source code. They make use of RPC, but that doesn't define them, ideally they should test every interface.

Okay. That makes sense.

@jnewbery: I think you need to update .travis.yml.
Tested a bit and it seems to work well.

@jnewbery
Copy link
Contributor Author

jnewbery commented Mar 9, 2017

Thanks everyone for the feedback. I've made the following changes:

  • commit 1 renames qa to test
  • commit 2 renames the rpc-tests directory to qa functional
  • commit 3 renames test/pull-tester/rpc-tests.py to test/runner/runner.py test/functional/test_runner.py and renames test/pull-tester/tests_config.ini.in to test/functional/config.ini.in. It also updates .travis.yml so travis knows where to find test_runner.py
  • commit 4 renames the --enable-extended-rpc-tests configure option to --enable-extended-qa-tests --enable-extended-functional-tests
  • commit 5 moves the bitcoin-util-test.py test into test/util

also rebased.

@jnewbery jnewbery force-pushed the reorganise_qa branch 2 times, most recently from fb0f1ae to 6906ba2 Compare March 9, 2017 22:41
@jnewbery
Copy link
Contributor Author

jnewbery commented Mar 9, 2017

rebased

@fanquake
Copy link
Member

Needs .gitignore updated to include test/functional/config.ini and test/util/buildenv.py. You can probably drop the old qa/pull-tester/tests_config.py entry now as well.

Currently failing with:

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

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

.. contents:: :depth: 2

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

Assertion failed: lock cs_wallet not held in wallet/wallet.cpp:163; locks held:
Running 232 test cases...
unknown location:0: fatal error: in "wallet_tests/rescan": signal: SIGABRT (application abort requested)
wallet/test/wallet_tests.cpp:362: last checkpoint: "rescan" entry.
Assertion failed: (secp256k1_context_sign == NULL), function ECC_Start, file key.cpp, line 300.
unknown location:0: fatal error: in "wallet_tests/coin_mark_dirty_immature_credit": signal: SIGABRT (application abort requested)
wallet/test/wallet_tests.cpp:435: last checkpoint: "coin_mark_dirty_immature_credit" fixture entry.
Assertion failed: (secp256k1_context_sign == NULL), function ECC_Start, file key.cpp, line 300.
unknown location:0: fatal error: in "wallet_tests/ComputeTimeSmart": signal: SIGABRT (application abort requested)
wallet/test/wallet_tests.cpp:479: last checkpoint: "ComputeTimeSmart" fixture entry.
Assertion failed: (secp256k1_context_sign == NULL), function ECC_Start, file key.cpp, line 300.
unknown location:0: fatal error: in "wallet_crypto/passphrase": signal: SIGABRT (application abort requested)
wallet/test/crypto_tests.cpp:186: last checkpoint: "passphrase" fixture entry.
Assertion failed: (secp256k1_context_sign == NULL), function ECC_Start, file key.cpp, line 300.
unknown location:0: fatal error: in "wallet_crypto/encrypt": signal: SIGABRT (application abort requested)
wallet/test/crypto_tests.cpp:202: last checkpoint: "encrypt" fixture entry.
Assertion failed: (secp256k1_context_sign == NULL), function ECC_Start, file key.cpp, line 300.
unknown location:0: fatal error: in "wallet_crypto/decrypt": signal: SIGABRT (application abort requested)
wallet/test/crypto_tests.cpp:217: last checkpoint: "decrypt" fixture entry.

*** 6 failures are detected in the test module "Bitcoin Test Suite"
Assertion failed: (!pthread_mutex_destroy(&m)), function ~recursive_mutex, file /usr/local/include/boost/thread/pthread/recursive_mutex.hpp, line 104.
FAIL test/test_bitcoin (exit status: 134)

@sipa
Copy link
Member

sipa commented Mar 12, 2017

Needs rebase.

@theuni
Copy link
Member

theuni commented Mar 13, 2017

@jnewbery Other than the rebase, is this now ready for review? Travis is happy, at least.

@jnewbery jnewbery force-pushed the reorganise_qa branch 2 times, most recently from c2bab0a to 3d42c4e Compare March 15, 2017 15:13
@jnewbery
Copy link
Contributor Author

@theuni thanks for your help on this. I've rebased and squashed, so assuming travis passes, this is now ready for review. The two parts which I'm a little unsure of and I'd especially like reviewers to look at are:

  • changes to /contrib/rpm/bitcoin.spec. I actually think we can remove the line:
    srcdir=. test/bitcoin-util-test.py
    entirely, since bitcoin-util-test.py is run as part of make check, but I've left it in for now. Let me know if you think we can remove it.
  • changes to Makefile.am, configure.ac and src/test/Makefile.test.include in the final commit (Move src/test/bitcoin-util-test.py to test/util/bitcoin-util-test.py)

@jonasschnelli
Copy link
Contributor

Needs rebase.

@maflcko
Copy link
Member

maflcko commented Mar 16, 2017 via email

ZMQ_SCRIPTS = [
# ZMQ test can only be run if bitcoin was built with zmq-enabled.
# call rpc_tests.py with -nozmq to explicitly exclude these tests.
# call runner.py with -nozmq to explicitly exclude these tests.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

runner -> test_runner from here down?

configure.ac Outdated
AC_CONFIG_FILES([Makefile src/Makefile doc/man/Makefile share/setup.nsi share/qt/Info.plist src/test/buildenv.py])
AC_CONFIG_FILES([qa/pull-tester/tests_config.ini],[chmod +x qa/pull-tester/tests_config.ini])
AC_CONFIG_FILES([Makefile src/Makefile doc/man/Makefile share/setup.nsi share/qt/Info.plist])
AC_CONFIG_FILES([test/functional/config.ini],[chmod +x test/functional/config.ini])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these really need +x?

configure.ac Outdated
if test x$use_extended_rpc_tests != xno; then
AC_SUBST(EXTENDED_RPC_TESTS, -extended)
if test x$use_extended_functional_tests != xno; then
AC_SUBST(EXTENDED_FUNCTIONAL_TESTS, -extended)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update Makefile.am to match. I'm pretty sure the cov stuff is busted atm, but at least this part won't be busted too.

Actually, it'd make sense to use this in test/functional/config.ini.in directly if you'd prefer to skip to that.

@theuni
Copy link
Member

theuni commented Mar 16, 2017

Looks good to me other than a few little nits. Passes Travis' out-of-tree-distdir gauntlet.

I'd like to move the related stuff to a new Makefile.include, but as a next step.

I'm unsure about the bitcoin.spec, but we probably can't assume they're running it from inside our tree?

@jtimon
Copy link
Contributor

jtimon commented Mar 16, 2017

Could you update the struct on the top instead of only the comments? It still says tests/runner and test/qa.
Concept ACK. Needs rebase.

I think "qa" instead of "functional" was just fine, but I guess "functional", or "integration" or "tests" or "py" would be fine as well. Maybe I just prefer qa because it's shorter. Anyway, bikeshedding.

About the runner and the config, what about just leaving them in the top level test wallet instead of putting them with the rest of the tests in functional?

@jnewbery
Copy link
Contributor Author

Could you update the struct on the top instead of only the comments? It still says tests/runner and test/qa.

Apologies. Now updated.

I think "qa" instead of "functional" was just fine, but I guess "functional", or "integration" or "tests" or "py" would be fine as well. Maybe I just prefer qa because it's shorter. Anyway, bikeshedding.

I think functional or integration are best because they are strongly differentiated from unit tests. qa is kind of meaningless in this context.

About the runner and the config, what about just leaving them in the top level test wallet instead of putting them with the rest of the tests in functional?

I aim to eventually merge test/functional/config.ini.in and test/util/buildenv.py into a single config file which will live in the base /test directory. I think it makes sense to have test_runner.py live in the /test/functional directory since it only runs the functional tests. Having it in the base /test may confuse people into thinking it also runs the util tests.

@jnewbery
Copy link
Contributor Author

jnewbery commented Mar 16, 2017

@theuni's comments addressed, and rebased.

Old tip: https://github.com/jnewbery/bitcoin/tree/pr9956.2 / jnewbery@3d42c4e
new tip: https://github.com/jnewbery/bitcoin/tree/pr9956.3 / jnewbery@f165360

I've built from distdir locally, so hopefully this will pass Travis!

Ready for additional review.

@jtimon
Copy link
Contributor

jtimon commented Mar 17, 2017

Random thought, maybe create a subdirectory for the extended tests? That would make it more clear I think.

@fanquake
Copy link
Member

I've been testing this, looks good so far 👍 . However, needs another rebase.

configure.ac Outdated
if test x$use_extended_rpc_tests != xno; then
AC_SUBST(EXTENDED_RPC_TESTS, -extended)
if test x$use_extended_functional_tests != xno; then
AC_SUBST(EXTENDED_FUNCTIONAL_TESTS, -extended)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be --extended with two dashes?

@maflcko
Copy link
Member

maflcko commented Mar 20, 2017 via email

@theuni
Copy link
Member

theuni commented Mar 20, 2017

utACK 63d66ba since it works, any cleanups can happen as a next step.

@maflcko maflcko merged commit 63d66ba into bitcoin:master Mar 20, 2017
maflcko pushed a commit that referenced this pull request Mar 20, 2017
63d66ba Move src/test/bitcoin-util-test.py to test/util/bitcoin-util-test.py (John Newbery)
5b0bff4 Rename --enable-extended-rpc-tests to --enable-extended-functional-tests (John Newbery)
a9bd622 Rename test/pull-tester/rpc-tests.py to test/functional/test_runner.py (John Newbery)
c28ee91 Rename rpc-tests directory to functional (John Newbery)
00902c4 Rename qa directory to test (John Newbery)

Tree-SHA512: ee7125c0c647d81590177beef2c8852c4ef76fdcf888096d9d4d360562a01d8d3b453345c3040487b2a043935bd1e7e80018f34462d6e02262bedbe23edcc576
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request May 17, 2019
63d66ba Move src/test/bitcoin-util-test.py to test/util/bitcoin-util-test.py (John Newbery)
5b0bff4 Rename --enable-extended-rpc-tests to --enable-extended-functional-tests (John Newbery)
a9bd622 Rename test/pull-tester/rpc-tests.py to test/functional/test_runner.py (John Newbery)
c28ee91 Rename rpc-tests directory to functional (John Newbery)
00902c4 Rename qa directory to test (John Newbery)

Tree-SHA512: ee7125c0c647d81590177beef2c8852c4ef76fdcf888096d9d4d360562a01d8d3b453345c3040487b2a043935bd1e7e80018f34462d6e02262bedbe23edcc576

resolve build errors

Signed-off-by: Pasta <Pasta@dash.org>

update test_runner.py in testintegrations.sh

Signed-off-by: Pasta <Pasta@dash.org>
UdjinM6 pushed a commit to dashpay/dash that referenced this pull request May 19, 2019
* Merge bitcoin#9956: Reorganise qa directory

63d66ba Move src/test/bitcoin-util-test.py to test/util/bitcoin-util-test.py (John Newbery)
5b0bff4 Rename --enable-extended-rpc-tests to --enable-extended-functional-tests (John Newbery)
a9bd622 Rename test/pull-tester/rpc-tests.py to test/functional/test_runner.py (John Newbery)
c28ee91 Rename rpc-tests directory to functional (John Newbery)
00902c4 Rename qa directory to test (John Newbery)

Tree-SHA512: ee7125c0c647d81590177beef2c8852c4ef76fdcf888096d9d4d360562a01d8d3b453345c3040487b2a043935bd1e7e80018f34462d6e02262bedbe23edcc576

resolve build errors

Signed-off-by: Pasta <Pasta@dash.org>

update test_runner.py in testintegrations.sh

Signed-off-by: Pasta <Pasta@dash.org>

* moved dash specific tests

Signed-off-by: Pasta <Pasta@dash.org>

* dashify README.md

Signed-off-by: Pasta <Pasta@dash.org>

* removed autoix*.py

Signed-off-by: Pasta <Pasta@dash.org>

* change back file perms

* dedashify

Signed-off-by: Pasta <Pasta@dash.org>
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants