-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Regression Tests: Migrated rpc-tests.sh to all Python rpc-tests.py #6616
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
ptschip
commented
Sep 1, 2015
- created rpc-tests.py
- deleted rpc-tests.sh
- deleted tests-config.sh.in
- travis.yml points to rpc-tests.py
Don't forget to adjust https://github.com/ptschip/bitcoin/blob/all_python/qa/rpc-tests/README.md#notes and https://github.com/ptschip/bitcoin/blob/all_python/README.md as well |
I'll do that I was wondering if we should move that README.md up to the /qa folder On 01/09/2015 2:47 PM, MarcoFalke wrote:
|
The hard-coded values are a major step backwards. File existence is a very bad metric considering that many of us often cross-compile. Also, anything that requires a certain PWD is inflexible. Please re-add a pre-processed config file and import it from rpc-tests.py. |
76a1bfc
to
28542a0
Compare
@ptschip like this: diff --git a/configure.ac b/configure.ac
index a524bde..c0a4e54 100644
--- a/configure.ac
+++ b/configure.ac
@@ -878,7 +878,7 @@ AC_SUBST(MINIUPNPC_CPPFLAGS)
AC_SUBST(MINIUPNPC_LIBS)
AC_CONFIG_FILES([Makefile src/Makefile share/setup.nsi share/qt/Info.plist src/test/buildenv.py])
AC_CONFIG_FILES([qa/pull-tester/run-bitcoind-for-test.sh],[chmod +x qa/pull-tester/run-bitcoind-for-test.sh])
-AC_CONFIG_FILES([qa/pull-tester/tests-config.sh],[chmod +x qa/pull-tester/tests-config.sh])
+AC_CONFIG_FILES([qa/rpc-tests/tests_config.py],[chmod +x qa/rpc-tests/tests_config.py])
dnl boost's m4 checks do something really nasty: they export these vars. As a
dnl result, they leak into secp256k1's configure and crazy things happen.
diff --git a/qa/rpc-tests/tests_config.py.in b/qa/rpc-tests/tests_config.py.in
new file mode 100644
index 0000000..adc7860
--- /dev/null
+++ b/qa/rpc-tests/tests_config.py.in
@@ -0,0 +1,11 @@
+#!/usr/bin/env python2
+BUILDDIR="@abs_top_builddir@"
+EXEEXT="@EXEEXT@"
+
+# These will turn into comments if they were disabled when configuring.
+@ENABLE_WALLET_TRUE@ENABLE_WALLET=1
+@BUILD_BITCOIN_UTILS_TRUE@ENABLE_UTILS=1
+@BUILD_BITCOIND_TRUE@ENABLE_BITCOIND=1
+
+REAL_BITCOIND=BUILDDIR + '/src/bitcoind' + EXEEXT
+REAL_BITCOINCLI=BUILDDIR + '/src/bitcoin-cli' + EXEEXT Then in the migrated script you can use it like: #!/usr/bin/env python2
import tests_config
print tests_config.REAL_BITCOINCLI |
duh, oh yeah, that's good, i was wondering how to get rid of On 02/09/2015 10:09 AM, Cory Fields wrote:
|
164e9d2
to
2f16359
Compare
@theuni switched over to tests_config.py and imported the vars directly and the tests run fine on Travis. However the BUILDDIR is not compatible with native windows (ie /c/bitcoin) and is not handled well by python so I had to keep the scripting that finds the builddir. Therefore there are a few options moving forward: 1) Keep the scripting that finds the builddir...I made changes so that it uses the system path rather than the os.path so we don't have to be in the pull-tester folder to run the scripts. (2) I can do an os specific hack to normalize the builddir for native windows (3) if we could somehow find a way to put the native os path into the tests_config.py directly but I don't know how...I'll research this a little more tomorrow, any suggestions are welcome... |
@theuni The path for the builddir is now correct for each system. I put a few lines in rpc-tests.py to create the correct path if running in a mingw shell. I looked into putting it further upstream, in configure.ac when tests_config.py.in gets called, but I don't see we can override the @abs_top_builddir@ with our own function and I'm not sure what we would gain. |
@@ -37,9 +37,13 @@ Helper functions for creating blocks and transactions. | |||
Notes | |||
===== | |||
|
|||
You can run a single test by calling `qa/pull-tester/rpc-tests.sh <testname>`. | |||
You can run any single test by calling qa/pull-tester/rpc-tests.py <testname> |
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.
Make sure to get the backticks ` right. (L44 as well)
Also, https://github.com/ptschip/bitcoin/blob/all_python/README.md#automated-testing needs update?
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.
thanks, done both
On 03/09/2015 11:08 AM, MarcoFalke wrote:
In qa/rpc-tests/README.md
#6616 (comment):@@ -37,9 +37,13 @@ Helper functions for creating blocks and transactions.
Notes-You can run a single test by calling
qa/pull-tester/rpc-tests.sh <testname>
.
+You can run any single test by calling qa/pull-tester/rpc-tests.pyMake sure to get the backticks ` right. (L44 as well)
Also,
https://github.com/ptschip/bitcoin/blob/all_python/README.md#automated-testing
needs update?—
Reply to this email directly or view it on GitHub
https://github.com/bitcoin/bitcoin/pull/6616/files#r38677104.
@ptschip I'll be away for a few days, will review when I'm back. There are a few PRs going on parallel to this though (libevent httpd, zmq, etc) that may make sense before merging this anyway, since those things will conflict. |
@theuni Have a few good days off. I did manage to fix the issue with the path further upstream by adding a script at the end of configure.ac in order to make the correct path edits when running in mingw . |
08563ae
to
758f217
Compare
concept ACK |
tested ACK |
@laanwj @MarcoFalke I added the zmq tests, rebased and Travis is happy. |
@laanwj @MarcoFalke just got rid of a little whitespace...should be good after this build finishes. |
for i in range(len(testScripts)): | ||
if (len(opts) == 0 or (len(opts) == 1 and "-win" in opts ) or '-extended' in opts | ||
or testScripts[i] in opts or re.sub(".py$", "", testScripts[i]) in opts ): | ||
print "Running testscript " + testScripts[i] + "..." |
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.
Nit: I think having the testscript name in bold was nice:
print "Running testscript \033[1m" + testScripts[i] + "\033[0m..."
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've tried, tried double and triple and quadruple escaping that python
usually needs, and also tried the termcolor module. It doesn't work
from python and in a "mingw" shell. It will probably work on a native
unix shell but I can't test that out as I'm on Windows. Any suggestions
welcome...
On 01/10/2015 11:09 AM, Wladimir J. van der Laan wrote:
In qa/pull-tester/rpc-tests.py
#6616 (comment):+# 'forknotify.py',
- 'p2p-acceptblock.py',
- 'mempool_packages.py',
+]
+#Enable ZMQ tests
+if ENABLE_ZMQ == 1:
- testScripts.append('zmq_test.py')
+if(ENABLE_WALLET == 1 and ENABLE_UTILS == 1 and ENABLE_BITCOIND == 1):
- rpcTestDir = buildDir + '/qa/rpc-tests/'
- #Run Tests
- for i in range(len(testScripts)):
if (len(opts) == 0 or (len(opts) == 1 and "-win" in opts ) or '-extended' in opts
or testScripts[i] in opts or re.sub(".py$", "", testScripts[i]) in opts ):
print "Running testscript " + testScripts[i] + "..."
Nit: I think having the testscript name in bold was nice:
|print "Running testscript \033[1m" + testScripts[i] + "\033[0m..." |
—
Reply to this email directly or view it on GitHub
https://github.com/bitcoin/bitcoin/pull/6616/files#r40946395.
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've tried, tried double and triple and quadruple escaping that python
usually needs, and also tried the termcolor module. It doesn't work
from python and in a "mingw" shell. It will probably work on a native
unix shell but I can't test that out as I'm on Windows. Any suggestions
welcome...
Ok, no problem, then leave it like this. Escape-code based formatting probably doesn't work on windows at all.
If we want this it needs to be conditional on the terminal type, which is too much bother...
for i in range(len(testScriptsExt)): | ||
if ('-extended' in opts or testScriptsExt[i] in opts | ||
or re.sub(".py$", "", testScriptsExt[i]) in opts): | ||
print "Running testscript " + testScriptsExt[i] + "..." |
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.
Nit: do we still want to call this "2nd level testscript"?
echo -e "Running \033[1m2nd level\033[0m testscript \033[1m${testScriptsExt[$i]}...\033[0m"
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'll fix that and push.
On 01/10/2015 11:10 AM, Wladimir J. van der Laan wrote:
In qa/pull-tester/rpc-tests.py
#6616 (comment):
- #Run Tests
- for i in range(len(testScripts)):
if (len(opts) == 0 or (len(opts) == 1 and "-win" in opts ) or '-extended' in opts
or testScripts[i] in opts or re.sub(".py$", "", testScripts[i]) in opts ):
print "Running testscript " + testScripts[i] + "..."
subprocess.call(rpcTestDir + testScripts[i] + " --srcdir " + buildDir + '/src ' + passOn,shell=True)
#exit if help is called so we print just one set of instructions
p = re.compile(" -h| --help")
if p.match(passOn):
sys.exit(0)
- #Run Extended Tests
- for i in range(len(testScriptsExt)):
if ('-extended' in opts or testScriptsExt[i] in opts
or re.sub(".py$", "", testScriptsExt[i]) in opts):
print "Running testscript " + testScriptsExt[i] + "..."
Nit: do we still want to call this "2nd level testscript"?
|echo -e "Running \033[1m2nd level\033[0m testscript
\033[1m${testScriptsExt[$i]}...\033[0m" |—
Reply to this email directly or view it on GitHub
https://github.com/bitcoin/bitcoin/pull/6616/files#r40946519.
No need to fix all the nits in this pull, we can do those later, if you don't get around to them - probably more important to get this merged before any other changes to the test runner. |
1) created rpc-tests.py 2) deleted rpc-tests.sh 3) travis.yml points to rpc-tests.py 4) Modified Makefile.am 5) Updated README.md 6) Added tests_config.py and deleted tests-config.sh 7) Modified configure.ac with script to set correct path in tests_config.py
Concept ACK. This works for me (and should also work on bash mingw?): old mode 100644
new mode 100755
index f55c5b6..8c7a6b6
--- a/qa/pull-tester/rpc-tests.py
+++ b/qa/pull-tester/rpc-tests.py
@@ -101,7 +101,7 @@ if(ENABLE_WALLET == 1 and ENABLE_UTILS == 1 and ENABLE_BITCOIND == 1):
for i in range(len(testScripts)):
if (len(opts) == 0 or (len(opts) == 1 and "-win" in opts ) or '-extended' in opts
or testScripts[i] in opts or re.sub(".py$", "", testScripts[i]) in opts ):
- print "Running testscript " + testScripts[i] + "..."
+ print "Running testscript \033[1m" + testScripts[i] + "\033[0m..."
subprocess.call(rpcTestDir + testScripts[i] + " --srcdir " + buildDir + '/src ' + passOn,shell=True)
#exit if help is called so we print just one set of instructions
p = re.compile(" -h| --help") |
@jonasschnelli That's what I proposed too, it works on Linux and OpenBSD but it doesn't on Win apparently. (outputing junk) So it would have to be conditional. |
+#Set colors
+cOn = cOff = ""
+if (not "-win" in opts):
+ cOn = "\033[1m"
+ cOff = "\033[0m" Then use something like: |
@laanwj I fixed the nit regarding the "2nd level" and left the other for another time. Pushed and all is well... |
5467820 Migrated rpc-tests.sh to all python rpc-tests.py (ptschip)
i like the idea, but -win tests will not always be disabled (i hope)... so it would have to be something operating specific like +#Set colors
(oddly python needs the double \ for a ) If this is ok, i'll add it and push. On 01/10/2015 12:32 PM, Jonas Schnelli wrote:
|
@ptschip This PR is now merged, any new changes would have to be in a new branch + PR |
might want to update https://github.com/bitcoin/bitcoin/blob/master/README.md#automated-testing |
thanks, that one got missed....updated and new PR created. On 03/10/2015 4:51 AM, mruddy wrote:
|
Don't chmod a repository-included file in the configure script, and `tests_config.py` is a module that doesn't need to be executable.
ea70997 build: Remove unnecessary chmods after #6616 (Wladimir J. van der Laan)
This reverts commit 7fd5d4e. We need to un-revert this before pulling in bitcoin/bitcoin#6616
Backport migration from rpc-tests.sh to rpc-tests.py Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#6567 - bitcoin/bitcoin#6523 - bitcoin/bitcoin#6616 - bitcoin/bitcoin#6788 - Only the commit fixing `rpc-tests.py` - bitcoin/bitcoin#6791 - Only the fix to `qa/rpc-tests/README.md` - bitcoin/bitcoin#6827 - bitcoin/bitcoin#6930 - bitcoin/bitcoin#6804 - bitcoin/bitcoin#7029 - bitcoin/bitcoin#7028 - bitcoin/bitcoin#7027 - bitcoin/bitcoin#7135 - bitcoin/bitcoin#7209 - bitcoin/bitcoin#7635 - bitcoin/bitcoin#7778 - bitcoin/bitcoin#7851 - bitcoin/bitcoin#7814 - Only the changes to the new .py files in this PR. - bitcoin/bitcoin#7971 - bitcoin/bitcoin#7972 - bitcoin/bitcoin#8056 - Only the first commit. - bitcoin/bitcoin#8098 - bitcoin/bitcoin#8104 - bitcoin/bitcoin#8133 - Only the `rpc-tests.py` commit. - bitcoin/bitcoin#8066 - bitcoin/bitcoin#8216 - Only the last two commits. - bitcoin/bitcoin#8254 - bitcoin/bitcoin#8400 - bitcoin/bitcoin#8482 - Excluding the first commit (only affects RPC tests we don't have). - bitcoin/bitcoin#8551 - bitcoin/bitcoin#8607 - Only the pull-tester commit, for conflict removal. - bitcoin/bitcoin#8625 - bitcoin/bitcoin#8713 - bitcoin/bitcoin#8750 - bitcoin/bitcoin#8789 - bitcoin/bitcoin#9098 - bitcoin/bitcoin#9276 - Excluding the second commit (we don't have the changes it requires). - bitcoin/bitcoin#9657 - bitcoin/bitcoin#9807 - bitcoin/bitcoin#9766 - bitcoin/bitcoin#9823
Backport migration from rpc-tests.sh to rpc-tests.py Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#6567 - bitcoin/bitcoin#6523 - bitcoin/bitcoin#6616 - bitcoin/bitcoin#6788 - Only the commit fixing `rpc-tests.py` - bitcoin/bitcoin#6791 - Only the fix to `qa/rpc-tests/README.md` - bitcoin/bitcoin#6827 - bitcoin/bitcoin#6930 - bitcoin/bitcoin#6804 - bitcoin/bitcoin#7029 - bitcoin/bitcoin#7028 - bitcoin/bitcoin#7027 - bitcoin/bitcoin#7135 - bitcoin/bitcoin#7209 - bitcoin/bitcoin#7635 - bitcoin/bitcoin#7778 - bitcoin/bitcoin#7851 - bitcoin/bitcoin#7814 - Only the changes to the new .py files in this PR. - bitcoin/bitcoin#7971 - bitcoin/bitcoin#7972 - bitcoin/bitcoin#8056 - Only the first commit. - bitcoin/bitcoin#8098 - bitcoin/bitcoin#8104 - bitcoin/bitcoin#8133 - Only the `rpc-tests.py` commit. - bitcoin/bitcoin#8066 - bitcoin/bitcoin#8216 - Only the last two commits. - bitcoin/bitcoin#8254 - bitcoin/bitcoin#8400 - bitcoin/bitcoin#8482 - Excluding the first commit (only affects RPC tests we don't have). - bitcoin/bitcoin#8551 - bitcoin/bitcoin#8607 - Only the pull-tester commit, for conflict removal. - bitcoin/bitcoin#8625 - bitcoin/bitcoin#8713 - bitcoin/bitcoin#8750 - bitcoin/bitcoin#8789 - bitcoin/bitcoin#9098 - bitcoin/bitcoin#9276 - Excluding the second commit (we don't have the changes it requires). - bitcoin/bitcoin#9657 - bitcoin/bitcoin#9807 - bitcoin/bitcoin#9766 - bitcoin/bitcoin#9823