aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJonas Schnelli <dev@jonasschnelli.ch>2018-03-09 12:43:55 +0800
committerJonas Schnelli <dev@jonasschnelli.ch>2018-03-18 12:24:10 +0700
commitf38e4fdb06406f9a1a2562836fab523eb75b5090 (patch)
tree5e9b40207f9df611c29656973ee0cd3d89c9fe5a /test
parent386a6b62a8a1db9dd0f354cb95b7585f555c7e5d (diff)
QA: Add -blocksdir test
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/feature_blocksdir.py34
-rwxr-xr-xtest/functional/test_runner.py1
2 files changed, 35 insertions, 0 deletions
diff --git a/test/functional/feature_blocksdir.py b/test/functional/feature_blocksdir.py
new file mode 100755
index 0000000000..e9d7b9de5b
--- /dev/null
+++ b/test/functional/feature_blocksdir.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python3
+# Copyright (c) 2018 The Bitcoin Core developers
+# Distributed under the MIT software license, see the accompanying
+# file COPYING or http://www.opensource.org/licenses/mit-license.php.
+"""Test the blocksdir option.
+"""
+
+from test_framework.test_framework import BitcoinTestFramework, initialize_datadir
+
+import shutil
+import os
+
+class BlocksdirTest(BitcoinTestFramework):
+ def set_test_params(self):
+ self.setup_clean_chain = True
+ self.num_nodes = 1
+
+ def run_test(self):
+ self.stop_node(0)
+ node0path = os.path.join(self.options.tmpdir, "node0")
+ shutil.rmtree(node0path)
+ initialize_datadir(self.options.tmpdir, 0)
+ self.log.info("Starting with non exiting blocksdir ...")
+ self.assert_start_raises_init_error(0, ["-blocksdir="+self.options.tmpdir+ "/blocksdir"], "Specified blocks director")
+ os.mkdir(self.options.tmpdir+ "/blocksdir")
+ self.log.info("Starting with exiting blocksdir ...")
+ self.start_node(0, ["-blocksdir="+self.options.tmpdir+ "/blocksdir"])
+ self.log.info("mining blocks..")
+ self.nodes[0].generate(10)
+ assert(os.path.isfile(self.options.tmpdir+ "/blocksdir/regtest/blocks/blk00000.dat"))
+ assert(os.path.isdir(self.options.tmpdir+ "/blocksdir/regtest/blocks/index"))
+
+if __name__ == '__main__':
+ BlocksdirTest().main()
diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py
index 082191098e..14211cd402 100755
--- a/test/functional/test_runner.py
+++ b/test/functional/test_runner.py
@@ -133,6 +133,7 @@ BASE_SCRIPTS= [
'p2p_unrequested_blocks.py',
'feature_logging.py',
'p2p_node_network_limited.py',
+ 'feature_blocksdir.py',
'feature_config_args.py',
# Don't append tests at the end to avoid merge conflicts
# Put them in a random line within the section that fits their approximate run-time