Skip to content

Commit 36e9b5f

Browse files
laanwjPastaPastaPasta
authored andcommitted
Merge bitcoin#24381: test: Run symlink regression tests on Windows
fad7ddf 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 fad7ddf ryanofsky: Code review ACK fad7ddf, just removing new test. Would be nice if the test could be added later, of course. Tree-SHA512: 64b235967a38c2eb90657e8d7a0447bcc8ce81d1b75a275b6c48bd42efd9ea7e7939257e484f297ee84598def3738eaeb289561aeba1dd6a99b258d389995139
1 parent a1691c7 commit 36e9b5f

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

src/test/fs_tests.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ BOOST_AUTO_TEST_CASE(rename)
152152
fs::remove(path2);
153153
}
154154

155-
#ifndef WIN32
155+
#ifndef __MINGW64__ // no symlinks on mingw
156156
BOOST_AUTO_TEST_CASE(create_directories)
157157
{
158158
// Test fs::create_directories workaround.
@@ -174,7 +174,7 @@ BOOST_AUTO_TEST_CASE(create_directories)
174174
fs::remove(symlink);
175175
fs::remove(dir);
176176
}
177-
#endif // WIN32
177+
#endif // __MINGW64__
178178

179179
BOOST_AUTO_TEST_SUITE_END()
180180

test/functional/feature_dirsymlinks.py

+13-11
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,36 @@
66
"""
77

88
import os
9-
import sys
109

11-
from test_framework.test_framework import BitcoinTestFramework, SkipTest
10+
from test_framework.test_framework import BitcoinTestFramework
1211

1312

1413
def rename_and_link(*, from_name, to_name):
1514
os.rename(from_name, to_name)
1615
os.symlink(to_name, from_name)
1716
assert os.path.islink(from_name) and os.path.isdir(from_name)
1817

19-
class SymlinkTest(BitcoinTestFramework):
20-
def skip_test_if_missing_module(self):
21-
if sys.platform == 'win32':
22-
raise SkipTest("Symlinks test skipped on Windows")
2318

19+
class SymlinkTest(BitcoinTestFramework):
2420
def set_test_params(self):
2521
self.num_nodes = 1
2622

2723
def run_test(self):
24+
dir_new_blocks = self.nodes[0].chain_path / "new_blocks"
25+
dir_new_chainstate = self.nodes[0].chain_path / "new_chainstate"
2826
self.stop_node(0)
2927

30-
rename_and_link(from_name=os.path.join(self.nodes[0].datadir, self.chain, "blocks"),
31-
to_name=os.path.join(self.nodes[0].datadir, self.chain, "newblocks"))
32-
rename_and_link(from_name=os.path.join(self.nodes[0].datadir, self.chain, "chainstate"),
33-
to_name=os.path.join(self.nodes[0].datadir, self.chain, "newchainstate"))
28+
rename_and_link(
29+
from_name=self.nodes[0].chain_path / "blocks",
30+
to_name=dir_new_blocks,
31+
)
32+
rename_and_link(
33+
from_name=self.nodes[0].chain_path / "chainstate",
34+
to_name=dir_new_chainstate,
35+
)
3436

3537
self.start_node(0)
3638

3739

38-
if __name__ == '__main__':
40+
if __name__ == "__main__":
3941
SymlinkTest().main()

0 commit comments

Comments
 (0)