File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python3
2
+ # Copyright (c) 2018 The Bitcoin Core developers
3
+ # Distributed under the MIT software license, see the accompanying
4
+ # file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
+ """Test the blocksdir option.
6
+ """
7
+
8
+ from test_framework .test_framework import BitcoinTestFramework , initialize_datadir
9
+
10
+ import shutil
11
+ import os
12
+
13
+ class BlocksdirTest (BitcoinTestFramework ):
14
+ def set_test_params (self ):
15
+ self .setup_clean_chain = True
16
+ self .num_nodes = 1
17
+
18
+ def run_test (self ):
19
+ self .stop_node (0 )
20
+ node0path = os .path .join (self .options .tmpdir , "node0" )
21
+ shutil .rmtree (node0path )
22
+ initialize_datadir (self .options .tmpdir , 0 )
23
+ self .log .info ("Starting with non exiting blocksdir ..." )
24
+ self .assert_start_raises_init_error (0 , ["-blocksdir=" + self .options .tmpdir + "/blocksdir" ], "Specified blocks director" )
25
+ os .mkdir (self .options .tmpdir + "/blocksdir" )
26
+ self .log .info ("Starting with exiting blocksdir ..." )
27
+ self .start_node (0 , ["-blocksdir=" + self .options .tmpdir + "/blocksdir" ])
28
+ self .log .info ("mining blocks.." )
29
+ self .nodes [0 ].generate (10 )
30
+ assert (os .path .isfile (self .options .tmpdir + "/blocksdir/regtest/blocks/blk00000.dat" ))
31
+ assert (os .path .isdir (self .options .tmpdir + "/blocksdir/regtest/blocks/index" ))
32
+
33
+ if __name__ == '__main__' :
34
+ BlocksdirTest ().main ()
Original file line number Diff line number Diff line change 133
133
'p2p_unrequested_blocks.py' ,
134
134
'feature_logging.py' ,
135
135
'p2p_node_network_limited.py' ,
136
+ 'feature_blocksdir.py' ,
136
137
'feature_config_args.py' ,
137
138
# Don't append tests at the end to avoid merge conflicts
138
139
# Put them in a random line within the section that fits their approximate run-time
You can’t perform that action at this time.
0 commit comments