dash/test/functional/feature_dirsymlinks.py
laanwj 36e9b5fead
Merge bitcoin/bitcoin#24381: test: Run symlink regression tests on Windows
fad7ddf9e3710405d727f61d8200d5efed1e705b test: Run symlink regression tests on Windows (MarcoFalke)

Pull request description:

  Seems odd to add tests, but not run them on the platform that needs them most.

ACKs for top commit:
  laanwj:
    Code review ACK fad7ddf9e3710405d727f61d8200d5efed1e705b
  ryanofsky:
    Code review ACK fad7ddf9e3710405d727f61d8200d5efed1e705b, just removing new test. Would be nice if the test could be added later, of course.

Tree-SHA512: 64b235967a38c2eb90657e8d7a0447bcc8ce81d1b75a275b6c48bd42efd9ea7e7939257e484f297ee84598def3738eaeb289561aeba1dd6a99b258d389995139
2024-10-15 09:25:09 -05:00

42 lines
1.1 KiB
Python
Executable File

#!/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
from test_framework.test_framework import BitcoinTestFramework
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 set_test_params(self):
self.num_nodes = 1
def run_test(self):
dir_new_blocks = self.nodes[0].chain_path / "new_blocks"
dir_new_chainstate = self.nodes[0].chain_path / "new_chainstate"
self.stop_node(0)
rename_and_link(
from_name=self.nodes[0].chain_path / "blocks",
to_name=dir_new_blocks,
)
rename_and_link(
from_name=self.nodes[0].chain_path / "chainstate",
to_name=dir_new_chainstate,
)
self.start_node(0)
if __name__ == "__main__":
SymlinkTest().main()