Skip to content

Commit d5a770b

Browse files
author
MarcoFalke
committed
Merge #16973: test: Fix combine_logs.py for AppVeyor build
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
2 parents befdef8 + d478a47 commit d5a770b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

test/functional/combine_logs.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
import argparse
1010
from collections import defaultdict, namedtuple
11-
import glob
1211
import heapq
1312
import itertools
1413
import os
@@ -78,10 +77,11 @@ def read_logs(tmp_dir):
7877
for each of the input log files."""
7978

8079
# Find out what the folder is called that holds the debug.log file
81-
chain = glob.glob("{}/node0/*/debug.log".format(tmp_dir))
82-
if chain:
83-
chain = chain[0] # pick the first one if more than one chain was found (should never happen)
84-
chain = re.search(r'node0/(.+?)/debug\.log$', chain).group(1) # extract the chain name
80+
glob = pathlib.Path(tmp_dir).glob('node0/**/debug.log')
81+
path = next(glob, None)
82+
if path:
83+
assert next(glob, None) is None # more than one debug.log, should never happen
84+
chain = re.search(r'node0/(.+?)/debug\.log$', path.as_posix()).group(1) # extract the chain name
8585
else:
8686
chain = 'regtest' # fallback to regtest (should only happen when none exists)
8787

0 commit comments

Comments
 (0)