Skip to content

Commit

Permalink
test: Add functional test for symlinked blocks directory
Browse files Browse the repository at this point in the history
  • Loading branch information
laanwj committed Feb 16, 2022
1 parent b13467a commit 67019cd
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
39 changes: 39 additions & 0 deletions test/functional/feature_dirsymlinks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env python3
# Copyright (c) 2022 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 successful startup with symlinked directories.
"""

import os
import sys

from test_framework.test_framework import BitcoinTestFramework, SkipTest


def rename_and_link(fromname, toname):
os.rename(fromname, toname)
os.symlink(toname, fromname)
assert os.path.islink(fromname) and os.path.isdir(fromname)

class SymlinkTest(BitcoinTestFramework):
def skip_test_if_missing_module(self):
if sys.platform == 'win32':
raise SkipTest("Symlinks test skipped on Windows")

def set_test_params(self):
self.num_nodes = 1

def run_test(self):
self.stop_node(0)

rename_and_link(os.path.join(self.nodes[0].datadir, self.chain, "blocks"),
os.path.join(self.nodes[0].datadir, self.chain, "newblocks"))
rename_and_link(os.path.join(self.nodes[0].datadir, self.chain, "chainstate"),
os.path.join(self.nodes[0].datadir, self.chain, "newchainstate"))

self.start_node(0)


if __name__ == '__main__':
SymlinkTest().main()
1 change: 1 addition & 0 deletions test/functional/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@
'rpc_getdescriptorinfo.py',
'rpc_mempool_entry_fee_fields_deprecation.py',
'rpc_help.py',
'feature_dirsymlinks.py',
'feature_help.py',
'feature_shutdown.py',
'p2p_ibd_txrelay.py',
Expand Down

0 comments on commit 67019cd

Please sign in to comment.