-
Notifications
You must be signed in to change notification settings - Fork 38.7k
[tests] [build] Run functional tests in make check
#10044
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
theuni
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK.
test/Makefile.include
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please enumerate the files here as before so that it remains deterministic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
test/Makefile.include
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this! But please make a var for it so that we can have obvious diffs when we add tests. Something like:
FUNCTIONAL_TESTS =
FUNCTIONAL_TESTS += nodehandling
FUNCTIONAL_TESTS += httpbasics
...
$(top_builddir)/test/functional/test_runner.py $(FUNCTIONAL_TESTS)
Going even further, as a later step, we may be able to use test_runner.py as an automake test launcher, so that each test gets parallelized as its own make job.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
test/Makefile.include
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think all of these can just be (builddir), since this file is included rather than invoked recursively.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/Makefile.test.include
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you mentioned in the OP, the python tests will only be run now when running 'make check' from the root dir.
I was going to suggest adding a target "check-full" or so, to run the python checks from src/, but that would effectively give us 3 levels of checking, confusion, and lots more bikeshedding.
So I think it would be wise to not differentiate what "make check" does based on your pwd. Let's call the other tests from here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
a87a99e to
d776f9e
Compare
make checkmake check
|
Concept ACK, this includes all the targets we discussed and more. |
4aca0a7 to
a77e25a
Compare
|
@theuni Can you update your "Changes requested" review if they no longer apply? |
|
This builds locally and on travis. I'm still happy to receive input on the following:
|
|
Shouldn't |
|
@MarcoFalke I haven't tested. By default test_runner.py will run 4 tests in parallel, but I don't know how that compares with make starting 4 different instances of test_runner.py, each running a single test. |
|
No, running several instances of test_runner is not supported. What I meant is that |
|
utack, I reviewed the changeset and it seems reasonable (but I don't know Make well enough to fully Ack). @MarcoFalke |
|
Concept ACK. I have no ability to judge whether the makefile changes are sane, but do wonder about removing the various caches in test, eg test/pycache and test/tmp, as clean should usually restore the state of the directory to what it was pre-make, afaiu. |
|
@TheBlueMatt good catch. I'd added these to the CLEANFILES variable, but that only cleans files, not directories! I've restored the previous clean-local: target now. |
|
Started testing this on top of fbf36ca . Just ran
|
Makefile.am
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should functional/test_framework/__pycache__ and util/__pycache__ be included here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think you're right. Thanks.
8f52a73 to
0a8f95c
Compare
|
nits addressed and commits squashed |
|
Both linux builds failed with: |
|
There are a lot of targets to keep track of here. It would be nice at some point to add a |
0a8f95c to
0f6deb1
Compare
0f6deb1 to
7761435
Compare
|
thanks @fanquake . This was a bad merge that github wasn't warning about. Hopefully should work now that I've rebased. |
|
As travis runs "make check" as well as the functional tests, I believe it will be running some of these twice now? If so, I'm afraid we'll need yet another target that means either check+all_functional_tests, or check - functional_tests. |
|
@theuni I really don't want to add yet another make target. As @ryanofsky has pointed out there are already too many to reasonably keep track of. Ideally the functional tests run by make check should be so fast that it doesn't matter that travis is running them twice. Thinking about this a little bit more, I think it might make sense to have a new basic_tests.py functional test script specifically for this purpose. There are a few requirements:
I chose invalidblockrequest.py, blockchain.py, rpcnamedargs.py, httpbasics.py and nodehandling.py initially since they provided a fairly good cover of basic functionality. If instead of those, we ran a more targeted basic_tests script, we could probably have better test coverage with a lower run time. Thoughts? |
|
So the basic test is a single test script with excerpts taken from the other test scripts, and is exclusively run by An alternative would be to unfiddle the |
That's basically the idea, yes. Not exactly copy-and-pasted from those other tests, but modified slightly to ensure good functional coverage, fast execution, and low resource demands. |
| blockchain \ | ||
| rpcnamedargs | ||
|
|
||
| .PHONY: all_functional_tests functional_tests util_tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why these targets need to be here in the new file instead of alongside unit_tests and check-local?
It seems nice for EXTRA_DIST and FUNCTIONAL_TESTS, but that's it IMO.
What about just excluding the tests in FUNCTIONAL_TESTS for travis? We have the exclude option now, it seems we just need a file that both the makefile and travis can read to put FUNCTIONAL_TESTS in. Wouldn't test/Makefile.include do it directly if some of the things were left out? |
|
What is needed here to fix Travis? |
|
This PR breaks whenever functional tests are added/renamed. In this instance |
|
I think we should be happy to let make check go for 10/30 minutes, we wouldnt be the only project to do so, and its good to get test coverage during package building (which, really, is the largest make check user). My vote would be for moving all the test running into make, then we also dont have the double-file-listing of alll the tests in the makefile and in the test_runner. |
|
@TheBlueMatt - I'm not sure that we should run all the test in make. Some of them have quite high memory/CPU/disk requirements - for example pruning.py runs 6 nodes concurrently and uses > 4GiB of disk space. We don't want make check to fail for users with lower powered systems. I also don't think this resolves the double-file-listing issue. The functional tests need to be listed in EXTRA_DIST in the make file to be included in a distdir. |
|
@jnewbery indeed, I meant that we should avoid the travis issue by putting everything that normally runs in travis in make check, essentially. if we then had a second make target (extended-tests), we could drop test_runner.py and then we dont need to double-list anything :). |
|
test_runner is doing more than you think. For one, we can't run multiple tests in parallel without providing a different port seed to each (otherwise they'll fight over ports). There are various other checks and nice things (such as logging) that it does. I don't think we can remove it and rely on make. |
|
Why not just invoke test_runner.py in Travis/make check, then? test_runner already distinguishes between normal and extended tests. |
Because I don't want test_runner.py also controls how many tests are run in parallel. If we change the default from 4 down to 1, it may make it easier to run on more limited systems, at the cost of making |
make checkmake check
|
Closing for now. I'll pick this up again at some point |
EDITED 2017/03/23. This PR is now ready for wider review
This PR adds the following make targets:
make unit_tests: runs the unit testsmake functional_tests: runs a small number of functional tests. Currently those tests are:(but any feedback is welcome on whether we should change that list)
make all_functional_tests: runs all the functional tests, including the extended testsmake util_tests: runs the bitcoin-tx testsmake checkis updated to run the unit_tests, functional_tests and util_tests targets.All make test targets can be run from the root directory or the src directory.
In this implementation I've moved the functional and util targets to their own
/test/Makefile.includefile to separate them from the unit tests.This is a WIP PR and shouldn't be merged yet. I've opened this to solicit feedback, particularly from @theuni , @MarcoFalke and @jtimon.This PR does the following:move the running of the 'integration' tests (currently the python functional tests and bitcoin-tx tests) frommake checkin /src/Makefile.test.include tomake checkin a new /test/Makefile.include file. Functionally, there is no difference for users runningmake checkfrom the base dir, but it makes more sense to contain the integration tests in their own makefile rather then executing them from /srcruns a small number of functional tests as part ofmake check. I picked the following since they cover basic functionality and are fairly quick to run (20s when run in parallel on my PC), but I'm happy to change the list if people think we should add/remove particular tests:nodehandling - 'Test node handling'httpbasics - 'Test the RPC HTTP basics'invalidblockrequest - 'Test node responses to invalid blocks'blockchain - 'Test RPCs related to blockchain state'rpcnamedargs - 'Test using named arguments for RPCs'@jtimon - you mentioned wanting to keep separate make targets for just running the unit tests or just running the functional tests. I haven't implemented that yet, but I plan to before this PR gets merged. Are you happy with the target namesmake unittestsandmake functionaltests?