mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
93e7c38788
b223c3c21e89f6af76b5401413880923f7c444d6 test: Add functional test for symlinked blocks directory (laanwj) ddb75c2e87a60ed24065bdf0c3bfabf4e058cef1 test: Add fs_tests/create_directories unit test (Hennadii Stepanov) 1f46b6e46e1454b91ff7ceb31853bc440952f8eb util: Work around libstdc++ create_directories issue (laanwj) Pull request description: Work around libstdc++ issue [PR101510] with create_directories where the leaf already exists as a symlink. Fixes #24257, introduced by the switch to `std::filesystem`. It is meant to be more thorough than #24266, which worked around one instance of the problem. The issue was [fixed upstream](https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=124eaa50e0a34f5f89572c1aa812c50979da58fc), but unfortunately we'll have to carry a fix for it for a while. This introduces a function `fs::create_directories` which wraps `std::filesystem::create_directories`. This allows easiliy reverting the workaround when it is no longer necessary. ACKs for top commit: jonatack: re-ACK b223c3c21e89f6af76b5401413880923f7c444d6 per `git range-diff df08250 67019cd b223c3c` hebasto: re-ACK b223c3c21e89f6af76b5401413880923f7c444d6 w0xlt: re-ACK b223c3c vasild: ACK b223c3c21e89f6af76b5401413880923f7c444d6 Tree-SHA512: 028321717c8b10d16185c3711b35da6b05fb7aa31cee1c8c7e754e92bf5a0b02719a3785cd0f6f8bf052b3bd759f644af212320672baabc9e44e0b93ba464abc
40 lines
1.3 KiB
Python
Executable File
40 lines
1.3 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
|
|
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()
|