message: test: Avoid hardcoding the chain name in combine_logs
diff: @@ -8,6 +8,7 @@ If no argument is provided, the most recent test directory will be used."""
  import argparse
  from collections import defaultdict, namedtuple
  +import glob
  import heapq
  import itertools
  import os
  @@ -76,9 +77,17 @@ def read_logs(tmp_dir):
  Delegates to generator function get_log_events() to provide individual log events
  for each of the input log files."""
  + # Find out what the folder is called that holds the debug.log file
  + chain = glob.glob("{}/node0/*/debug.log".format(tmp_dir))
  + if chain:
  + chain = chain[0] # pick the first one if more than one chain was found (should never happen)
  + chain = re.search('node0/(.+?)/debug\.log$', chain).group(1) # extract the chain name
  + else:
  + chain = 'regtest' # fallback to regtest (should only happen when none exists)
  +
  files = [("test", "%s/test_framework.log" % tmp_dir)]
  for i in itertools.count():
  - logfile = "{}/node{}/regtest/debug.log".format(tmp_dir, i)
  + logfile = "{}/node{}/{}/debug.log".format(tmp_dir, i, chain)
  if not os.path.isfile(logfile):
  break
  files.append(("node%d" % i, logfile))
  @@ -184,5 +193,6 @@ def print_logs_html(log_events):
  .get_template('combined_log_template.html')
  .render(title="Combined Logs from testcase", log_events=[event._asdict() for event in log_events]))
  +
  if __name__ == '__main__':
  main()
  