diff options
| author | Anthony Towns <[email protected]> | 2017-12-01 11:49:28 +1000 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2017-12-01 11:28:23 +0100 |
| commit | 5a7c09aebf8b0229e9f320135472275d244a7a35 (patch) | |
| tree | f2d225125200cfbdf63f8fa6674245c97ec19204 | |
| parent | doc: Update release notes for `-debuglogfile` (diff) | |
| download | discoin-5a7c09aebf8b0229e9f320135472275d244a7a35.tar.xz discoin-5a7c09aebf8b0229e9f320135472275d244a7a35.zip | |
test: Add tests for `-debuglogfile` with subdirs
| -rwxr-xr-x | test/functional/feature_logging.py | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/test/functional/feature_logging.py b/test/functional/feature_logging.py index 24591e176..da4e7b039 100755 --- a/test/functional/feature_logging.py +++ b/test/functional/feature_logging.py @@ -27,15 +27,32 @@ class LoggingTest(BitcoinTestFramework): 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__': |