diff options
author | laanwj <126646+laanwj@users.noreply.github.com> | 2022-02-16 16:31:41 +0100 |
---|---|---|
committer | laanwj <126646+laanwj@users.noreply.github.com> | 2022-02-17 12:33:30 +0100 |
commit | b223c3c21e89f6af76b5401413880923f7c444d6 (patch) | |
tree | 917f6ca4a1c8babcdcc557f7292f9b65be6bc68b /test/functional/feature_dirsymlinks.py | |
parent | ddb75c2e87a60ed24065bdf0c3bfabf4e058cef1 (diff) | |
download | bitcoin-b223c3c21e89f6af76b5401413880923f7c444d6.tar.xz |
test: Add functional test for symlinked blocks directory
Diffstat (limited to 'test/functional/feature_dirsymlinks.py')
-rwxr-xr-x | test/functional/feature_dirsymlinks.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/functional/feature_dirsymlinks.py b/test/functional/feature_dirsymlinks.py new file mode 100755 index 0000000000..85c8e27600 --- /dev/null +++ b/test/functional/feature_dirsymlinks.py @@ -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(*, from_name, to_name): + os.rename(from_name, to_name) + os.symlink(to_name, from_name) + assert os.path.islink(from_name) and os.path.isdir(from_name) + +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(from_name=os.path.join(self.nodes[0].datadir, self.chain, "blocks"), + to_name=os.path.join(self.nodes[0].datadir, self.chain, "newblocks")) + rename_and_link(from_name=os.path.join(self.nodes[0].datadir, self.chain, "chainstate"), + to_name=os.path.join(self.nodes[0].datadir, self.chain, "newchainstate")) + + self.start_node(0) + + +if __name__ == '__main__': + SymlinkTest().main() |