forked from dashpay/dash
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add functional test for symlinked blocks directory
- Loading branch information
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters