test: Handle timestamps without microseconds in combine_logs #13157

pull laanwj wants to merge 1 commits into bitcoin:master from laanwj:2018_05_logcombine_timestamps changing 1 files +8 −6
  1. laanwj commented at 12:03 pm on May 3, 2018: member

    The log messages before command line arguments have been parsed will not have microseconds. Make parsing robust to lack of microseconds so that sorting is done correctly, and make their timestamps show as ‘.000000’ to line up the log.

    Before (note the weird sorting and ordering):

    0 node0 
    12018-05-02T12:16:13Z 
    2 node1 
    32018-05-02T12:16:13Z 
    4 node2 
    52018-05-02T12:16:13Z 
    6 test  2018-05-02T12:16:13.310000Z TestFramework (INFO): Initializing test directory /tmp/testdssm30sn 
    

    After:

    0 node0 2018-05-02T12:16:13.000000Z  
    1 node1 2018-05-02T12:16:13.000000Z  
    2 node2 2018-05-02T12:16:13.000000Z  
    3 test  2018-05-02T12:16:13.310000Z TestFramework (INFO): Initializing test directory /tmp/testdssm30sn 
    4 test  2018-05-02T12:16:13.314000Z TestFramework.node0 (DEBUG): bitcoind started, waiting for RPC to come up 
    5 test  2018-05-02T12:16:13.316000Z TestFramework.node1 (DEBUG): bitcoind started, waiting for RPC to come up 
    6 test  2018-05-02T12:16:13.319000Z TestFramework.node2 (DEBUG): bitcoind started, waiting for RPC to come up 
    
  2. test: Handle timestamps without microseconds in combine_logs
    The log messages before command line arguments have been parsed will
    not have microseconds. Make parsing robust to lack of microseconds so
    that sorting is done correctly, and make their timestamps show as
    '.000000' to line up the log.
    38afff30d7
  3. laanwj added the label Tests on May 3, 2018
  4. in test/functional/combine_logs.py:76 in 38afff30d7
    72@@ -73,10 +73,12 @@ def get_log_events(source, logfile):
    73                 # if this line has a timestamp, it's the start of a new log event.
    74                 time_match = TIMESTAMP_PATTERN.match(line)
    75                 if time_match:
    76-                    if event:
    77-                        yield LogEvent(timestamp=timestamp, source=source, event=event.rstrip())
    78-                    event = line
    79-                    timestamp = time_match.group()
    80+                    if event or timestamp:
    


    laanwj commented at 12:04 pm on May 3, 2018:
    Could keep this as if event to not show the (initial) empty log message. That’s a matter of taste, I guess.
  5. MarcoFalke commented at 3:29 pm on May 3, 2018: member
    Noting that this is fixed by #13088
  6. laanwj commented at 3:52 pm on May 3, 2018: member
    Ok…
  7. laanwj closed this on May 3, 2018

  8. MarcoFalke commented at 2:46 pm on May 28, 2019: member

    This is fixed in

    • log: Log early messages #16112

    as a side effect of changing the LogPrintf("\n\n\n\n\n"); into a FileWriteStr("\n\n\n\n\n", m_fileout);

  9. MarcoFalke reopened this on May 28, 2019

  10. MarcoFalke closed this on May 28, 2019

  11. MarcoFalke referenced this in commit 0853d8d2fd on Jun 18, 2019
  12. sidhujag referenced this in commit 6347640464 on Jun 19, 2019
  13. DrahtBot locked this on Dec 16, 2021


laanwj MarcoFalke

Labels
Tests


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-18 21:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me