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
ajtowns authored and laanwj committed Dec 1, 2017
1 parent 4158734 commit 5a7c09a
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions test/functional/feature_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,32 @@ def run_test(self):
assert os.path.isfile(tempname)

# 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"))

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

# 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"))

# check that invalid log (absolute) works after path exists
self.stop_node(0)
os.mkdir(invdir)
self.start_node(0, ["-debuglogfile=%s" % (invalidname)])
assert os.path.isfile(os.path.join(invdir, "foo.log"))


if __name__ == '__main__':
Expand Down

0 comments on commit 5a7c09a

Please sign in to comment.