mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-29 21:42:32 +02:00
test: Add functional test for symlinked blocks directory
This commit is contained in:
parent
ddb75c2e87
commit
b223c3c21e
39
test/functional/feature_dirsymlinks.py
Executable file
39
test/functional/feature_dirsymlinks.py
Executable file
@ -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()
|
@ -321,6 +321,7 @@ BASE_SCRIPTS = [
|
|||||||
'rpc_getdescriptorinfo.py',
|
'rpc_getdescriptorinfo.py',
|
||||||
'rpc_mempool_entry_fee_fields_deprecation.py',
|
'rpc_mempool_entry_fee_fields_deprecation.py',
|
||||||
'rpc_help.py',
|
'rpc_help.py',
|
||||||
|
'feature_dirsymlinks.py',
|
||||||
'feature_help.py',
|
'feature_help.py',
|
||||||
'feature_shutdown.py',
|
'feature_shutdown.py',
|
||||||
'p2p_ibd_txrelay.py',
|
'p2p_ibd_txrelay.py',
|
||||||
|
Loading…
Reference in New Issue
Block a user