test: Fix combine_logs.py for AppVeyor build

This commit is contained in:
Martin Zumsande 2019-09-26 23:26:39 +02:00
parent 6288f15f50
commit d478a472eb

View file

@ -8,7 +8,6 @@ If no argument is provided, the most recent test directory will be used."""
import argparse import argparse
from collections import defaultdict, namedtuple from collections import defaultdict, namedtuple
import glob
import heapq import heapq
import itertools import itertools
import os import os
@ -78,10 +77,11 @@ def read_logs(tmp_dir):
for each of the input log files.""" for each of the input log files."""
# Find out what the folder is called that holds the debug.log file # Find out what the folder is called that holds the debug.log file
chain = glob.glob("{}/node0/*/debug.log".format(tmp_dir)) glob = pathlib.Path(tmp_dir).glob('node0/**/debug.log')
if chain: path = next(glob, None)
chain = chain[0] # pick the first one if more than one chain was found (should never happen) if path:
chain = re.search(r'node0/(.+?)/debug\.log$', chain).group(1) # extract the chain name assert next(glob, None) is None # more than one debug.log, should never happen
chain = re.search(r'node0/(.+?)/debug\.log$', path.as_posix()).group(1) # extract the chain name
else: else:
chain = 'regtest' # fallback to regtest (should only happen when none exists) chain = 'regtest' # fallback to regtest (should only happen when none exists)