Repository navigation
test: Fix combine_logs.py for AppVeyor build - #16973
Merged
Merged
Conversation
maflcko
reviewed
Sep 26, 2019
mzumsande
force-pushed
the
201909_test_pathsep
branch
3 times, most recently
from
September 26, 2019 21:48
bba1b07 to
88be9c9
Compare
promag
reviewed
Sep 26, 2019
promag
left a comment
Contributor
There was a problem hiding this comment.
ACK, just a nit suggestion.
Contributor
There was a problem hiding this comment.
nit,
glob = pathlib.Path(tmp_dir).glob('node0/**/debug.log')
path = next(glob, None)
if path:
assert next(glob, None) == None # should never happen
chain = ...
...
Contributor
Author
There was a problem hiding this comment.
Done, that makes it a bit more readable. Also added assert.
fjahr
reviewed
Sep 27, 2019
Contributor
There was a problem hiding this comment.
Nit, not critical here but if it should never happen I would throw an exception instead
Contributor
Author
There was a problem hiding this comment.
I added an assert, as suggested above.
mzumsande
force-pushed
the
201909_test_pathsep
branch
from
September 27, 2019 10:35
88be9c9 to
92e5d9b
Compare
mzumsande
force-pushed
the
201909_test_pathsep
branch
from
September 27, 2019 10:40
92e5d9b to
d478a47
Compare
thijstriemstra
approved these changes
Oct 10, 2019
Member
|
Sorry, forgot about this. I thought it was already merged. |
maflcko
pushed a commit
that referenced
this pull request
Oct 10, 2019
d478a47 test: Fix combine_logs.py for AppVeyor build (Martin Zumsande) Pull request description: Fixes #16894 This fixes the problem of AppVeyor builds not showing `debug.log` if a functional test fails, because the windows separator `\` doesn't work together with the regex in `combine_logs.py`. A fix was already attempted in #16896, however, that PR became inactive and was marked "up for grabs", plus it's a really small change. As suggested by jamesob, this PR uses `pathlib`: For the glob and to convert the path to a posix-style string, it leaves the regex as is (in contrast to #16896 which adjusted the regex). I tested this locally on Windows and Ubuntu. Top commit has no ACKs. Tree-SHA512: 603b4359b6009b6da874c30f69759acda03730ee5747898a0fe957a5fc37ee9ba07858c6aa2169bf4c40521f37e47138e8314d698652ea2760fa0a3f76b890bd
maflcko
reviewed
Oct 10, 2019
| if chain: | ||
| chain = chain[0] # pick the first one if more than one chain was found (should never happen) | ||
| chain = re.search(r'node0/(.+?)/debug\.log$', chain).group(1) # extract the chain name | ||
| glob = pathlib.Path(tmp_dir).glob('node0/**/debug.log') |
Member
There was a problem hiding this comment.
Is this recursive on purpose or would 'node0/*/debug.log' suffice?
Contributor
Author
There was a problem hiding this comment.
Not on purpose. Non-recursive would suffice, I can't imagine a scenario where debug.log ends up in any subdirectories of node0.
jasonbcox
pushed a commit
to Bitcoin-ABC/bitcoin-abc
that referenced
this pull request
Oct 28, 2020
Summary: The regex used to find the chain name in debug.log path did not work on Windows due to the different path separator. This uses `pathlib` to make sure the path used for the regex search is `as_posix()` This is a backport of Core [[bitcoin/bitcoin#16973 | PR16973]] Test Plan: I tested that it still works on my linux machine, with the same test as D7796 Intentionaly modify a functional test to make it fail (`assert False`), then run: ``` ../test/functional/feature_bip68_sequence.py --configfile=./test/config.ini ../test/functional/combine_logs.py -c ``` Reviewers: O1 Bitcoin ABC, #bitcoin_abc, Fabien Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D8150
Munkybooty
pushed a commit
to Munkybooty/dash
that referenced
this pull request
Feb 1, 2022
d478a47 test: Fix combine_logs.py for AppVeyor build (Martin Zumsande) Pull request description: Fixes bitcoin#16894 This fixes the problem of AppVeyor builds not showing `debug.log` if a functional test fails, because the windows separator `\` doesn't work together with the regex in `combine_logs.py`. A fix was already attempted in bitcoin#16896, however, that PR became inactive and was marked "up for grabs", plus it's a really small change. As suggested by jamesob, this PR uses `pathlib`: For the glob and to convert the path to a posix-style string, it leaves the regex as is (in contrast to bitcoin#16896 which adjusted the regex). I tested this locally on Windows and Ubuntu. Top commit has no ACKs. Tree-SHA512: 603b4359b6009b6da874c30f69759acda03730ee5747898a0fe957a5fc37ee9ba07858c6aa2169bf4c40521f37e47138e8314d698652ea2760fa0a3f76b890bd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #16894
This fixes the problem of AppVeyor builds not showing
debug.logif a functional test fails, because the windows separator\doesn't work together with the regex incombine_logs.py.A fix was already attempted in #16896, however, that PR became inactive and was marked "up for grabs", plus it's a really small change.
As suggested by jamesob, this PR uses
pathlib: For the glob and to convert the path to a posix-style string, it leaves the regex as is (in contrast to #16896 which adjusted the regex).I tested this locally on Windows and Ubuntu.