Skip to content

Commit

Permalink
test: Add tests for -debuglogfile with subdirs
Browse files Browse the repository at this point in the history
  • Loading branch information
random-zebra committed Apr 6, 2020
1 parent 2c2e36d commit 3d5ad7f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
21 changes: 19 additions & 2 deletions test/functional/feature_logging.py
Expand Up @@ -31,18 +31,35 @@ def run_test(self):
self.log.info("Alternative filename outside datadir ok")

# check that invalid log (relative) will cause error
invdir = os.path.join(self.nodes[0].datadir, "regtest", "foo")
invalidname = os.path.join("foo", "foo.log")
self.stop_node(0)
self.assert_start_raises_init_error(0, ["-debuglogfile=ssdksjdf/sdasdfa/sdfsdfsfd"],
self.assert_start_raises_init_error(0, ["-debuglogfile=%s" % (invalidname)],
"Error: Could not open debug log file")
assert not os.path.isfile(os.path.join(invdir, "foo.log"))
self.log.info("Invalid relative filename throws")

# check that a previously invalid log (relative) works after path exists
os.mkdir(invdir)
self.start_node(0, ["-debuglogfile=%s" % (invalidname)])
assert os.path.isfile(os.path.join(invdir, "foo.log"))
self.log.info("Relative filename ok when path exists")

# check that invalid log (absolute) will cause error
self.stop_node(0)
invalidname = os.path.join(self.options.tmpdir, "foo/foo.log")
invdir = os.path.join(self.options.tmpdir, "foo")
invalidname = os.path.join(invdir, "foo.log")
self.assert_start_raises_init_error(0, ["-debuglogfile=%s" % invalidname],
"Error: Could not open debug log file")
assert not os.path.isfile(os.path.join(invdir, "foo.log"))
self.log.info("Invalid absolute filename throws")

# check that a previously invalid log (relative) works after path exists
os.mkdir(invdir)
self.start_node(0, ["-debuglogfile=%s" % (invalidname)])
assert os.path.isfile(os.path.join(invdir, "foo.log"))
self.log.info("Absolute filename ok when path exists")


if __name__ == '__main__':
LoggingTest().main()
2 changes: 1 addition & 1 deletion test/functional/test_runner.py
Expand Up @@ -66,10 +66,10 @@
'wallet_abandonconflict.py', # ~ 212 sec
'wallet_hd.py', # ~ 210 sec
'wallet_zerocoin_publicspends.py', # ~ 202 sec
'feature_logging.py', # ~ 200 sec
'rpc_rawtransaction.py', # ~ 193 sec
'wallet_zapwallettxes.py', # ~ 180 sec
'wallet_keypool_topup.py', # ~ 174 sec
'feature_logging.py', # ~ 166 sec
'wallet_txn_doublespend.py --mineblock', # ~ 157 sec
'wallet_txn_clone.py --mineblock', # ~ 157 sec
'rpc_spork.py', # ~ 156 sec
Expand Down

0 comments on commit 3d5ad7f

Please sign in to comment.