Repository navigation
test: replaced hard coded folders with os.path.join & replaced os.path.sep - #16896
renepickhardt wants to merge 1 commit into
Conversation
…p in regex to fix the firstGoodIssue bitcoin#16894 (which I discovered with carldongs firstGoodIssueTwitter bot)
|
Would be nice to leave the whitespace changes for later. It makes it impossible to review the commit that fixes a bug. |
|
Thanks for picking this up! If everything succeeds, combine_logs won't be invoked. So for testing, you could add a second commit that makes some functional test trivially fail and after checking the CIs' output remove it again and add a link to the logs here. |
sorry my emacs just has some auto save actions to follow the PEP8 formatting. I didn't even realize that that has happened. What do you (@MarcoFalke ) want me to do? I could quickly mark the 4 relevant lines here on github or do you want me to redo the patch without changes to whitespace? |
renepickhardt
left a comment
There was a problem hiding this comment.
actually the whitespace stuff didn't mess it up so badly everything between line 81 and 120 that was changed is actually a change that would have occured even without the whitespace formatting changes. everything above and blow can easily be neglected.
| # Find out what the folder is called that holds the debug.log file | ||
| chain = glob.glob("{}/node0/*/debug.log".format(tmp_dir)) | ||
|
|
||
| chain = glob.glob(os.path.join(tmp_dir, "node0", "*", "debug.log")) |
| chain = chain[0] | ||
| sep = os.path.sep | ||
| chain = re.search(r'node0' + sep + '(.+?)' + sep + | ||
| 'debug\.log$', chain).group(1) # extract the chain name |
| chain = 'regtest' | ||
|
|
||
| files = [("test", "%s/test_framework.log" % tmp_dir)] | ||
| files = [("test", os.path.join(tmp_dir, "test_framework.log"))] |
| files = [("test", os.path.join(tmp_dir, "test_framework.log"))] | ||
| for i in itertools.count(): | ||
| logfile = "{}/node{}/{}/debug.log".format(tmp_dir, i, chain) | ||
| logfile = os.path.join(tmp_dir, "node{}".format(i), chain, "debug.log") |
| for stream in ['stdout', 'stderr']: | ||
| for i in itertools.count(): | ||
| folder = "{}/node{}/{}".format(tmp_dir, i, stream) | ||
| folder = os.path.join(tmp_dir, "node{}".format(i), stream) |
| for fn in fns: | ||
| warning = pathlib.Path('{}/{}'.format(folder, fn)).read_text().strip() | ||
| warning = pathlib.Path(os.path.join( | ||
| folder, fn)).read_text().strip() |
|
We don't enforce a maximum line length, and different contributors have different preferences about the line length. Thus, we can't (for now) have editors auto-format a file that was saved. Otherwise, the lines would just ping-pong around on every change. Generally, we leave the line length like it was previously. |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
|
Also, I think it would be easier to read the commit message if it was shorter. See https://chris.beams.io/posts/git-commit/ |
|
This doesn't seem to be working yet. I cherry-picked your commit in order to understand why AppVeyor doesn't like my PR #16756 (that's the background why I created #16894), and |
|
@mzumsande I am a little bit confused about the error. First of all the error message changed which (hopefully means progress) but I cannot make much of the error message as I don't see where unbalanced parenthesis would come from. Also I am somewhat confused that at least in the error message there is still the usage of / and ... @MarcoFalke once @mzumsande get the code running I will make a force push with the patch withouth outsave actions and with a better commit message |
| # pick the first one if more than one chain was found (should never happen) | ||
| chain = chain[0] | ||
| sep = os.path.sep | ||
| chain = re.search(r'node0' + sep + '(.+?)' + sep + |
There was a problem hiding this comment.
I think the issue is that the windows separator \ needs to be escaped when used in a regex. Not a great expert on regex, but with the following it should work:
if sep == '\\':
sep = '\\\\'
|
Thanks for contributing. Concept ACK. I'd also suggest removing the whitespace and formatting changes (at least to lines not touched otherwise) and focusing the changes on the issue that you're trying to fix. This makes reviewing easier, and keeps the git commit log more readable. |
|
Agree with @laanwj, limit the change to the PR scope. |
| # pick the first one if more than one chain was found (should never happen) | ||
| chain = chain[0] | ||
| sep = os.path.sep | ||
| chain = re.search(r'node0' + sep + '(.+?)' + sep + |
|
Yeah, pretty sure this is just a trivial one line fix. No need to blow up the scope of this pull request beside the minimal required fix. |
| chain = chain[0] | ||
| sep = os.path.sep | ||
| chain = re.search(r'node0' + sep + '(.+?)' + sep + | ||
| 'debug\.log$', chain).group(1) # extract the chain name |
There was a problem hiding this comment.
Nit: \. is not a valid escape sequence :)
|
Since this has gone inactive and marked "up for grabs", I opened #16973. |
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
This should fix the firstGoodIssue #16894 (which I discovered with carldongs firstGoodIssueTwitter bot c.f.: https://twitter.com/GoodFirstIssues/status/1173915080439795714)
have no windows machine here and couldn't test. relying on ci on github.