Skip to content

Commit fadecbd

Browse files
author
MarcoFalke
committed
test: Fix tests on Windows
1 parent 5e3380b commit fadecbd

File tree

5 files changed

+36
-15
lines changed

5 files changed

+36
-15
lines changed

build_msvc/bitcoind/bitcoind.vcxproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@
5757
<Copy SourceFiles="$(ConfigIniIn)" DestinationFiles="$(ConfigIniOut)" ></Copy>
5858
<ReplaceInFile FilePath="$(ConfigIniOut)"
5959
Replace="@PACKAGE_NAME@" By="Bitcoin Core"></ReplaceInFile>
60+
<ReplaceInFile FilePath="$(ConfigIniOut)"
61+
Replace="@PACKAGE_BUGREPORT@" By="https://github.com/bitcoin/bitcoin/issues"></ReplaceInFile>
6062
<ReplaceInFile FilePath="$(ConfigIniOut)"
6163
Replace="@abs_top_srcdir@" By="..\.." ToFullPath="true"></ReplaceInFile>
6264
<ReplaceInFile FilePath="$(ConfigIniOut)"
@@ -71,12 +73,16 @@
7173
Replace="@USE_SQLITE_TRUE@" By=""></ReplaceInFile>
7274
<ReplaceInFile FilePath="$(ConfigIniOut)"
7375
Replace="@BUILD_BITCOIN_CLI_TRUE@" By=""></ReplaceInFile>
76+
<ReplaceInFile FilePath="$(ConfigIniOut)"
77+
Replace="@BUILD_BITCOIN_WALLET_TRUE@" By=""></ReplaceInFile>
7478
<ReplaceInFile FilePath="$(ConfigIniOut)"
7579
Replace="@BUILD_BITCOIND_TRUE@" By=""></ReplaceInFile>
7680
<ReplaceInFile FilePath="$(ConfigIniOut)"
7781
Replace="@ENABLE_FUZZ_TRUE@" By=""></ReplaceInFile>
7882
<ReplaceInFile FilePath="$(ConfigIniOut)"
7983
Replace="@ENABLE_ZMQ_TRUE@" By=""></ReplaceInFile>
84+
<ReplaceInFile FilePath="$(ConfigIniOut)"
85+
Replace="@ENABLE_EXTERNAL_SIGNER_TRUE@" By=""></ReplaceInFile>
8086
</Target>
8187
<Import Project="..\common.vcxproj" />
8288
</Project>

test/functional/feature_config_args.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,14 @@ def test_seed_peers(self):
164164
# fixed seeds
165165
assert not os.path.exists(os.path.join(default_data_dir, "peers.dat"))
166166
start = int(time.time())
167-
with self.nodes[0].assert_debug_log(expected_msgs=[
168-
"Loaded 0 addresses from peers.dat",
169-
"0 addresses found from DNS seeds",
170-
"opencon thread start", # Ensure ThreadOpenConnections::start time is properly set
171-
]):
167+
with self.nodes[0].assert_debug_log(
168+
expected_msgs=[
169+
"Loaded 0 addresses from peers.dat",
170+
"0 addresses found from DNS seeds",
171+
"opencon thread start", # Ensure ThreadOpenConnections::start time is properly set
172+
],
173+
timeout=10,
174+
):
172175
self.start_node(0, extra_args=['-dnsseed=1', '-fixedseeds=1', f'-mocktime={start}'])
173176
with self.nodes[0].assert_debug_log(expected_msgs=[
174177
"Adding fixed seeds as 60 seconds have passed and addrman is empty",
@@ -206,11 +209,14 @@ def test_seed_peers(self):
206209
# We expect the node will allow 60 seconds prior to using fixed seeds
207210
assert not os.path.exists(os.path.join(default_data_dir, "peers.dat"))
208211
start = int(time.time())
209-
with self.nodes[0].assert_debug_log(expected_msgs=[
210-
"Loaded 0 addresses from peers.dat",
211-
"DNS seeding disabled",
212-
"opencon thread start", # Ensure ThreadOpenConnections::start time is properly set
213-
]):
212+
with self.nodes[0].assert_debug_log(
213+
expected_msgs=[
214+
"Loaded 0 addresses from peers.dat",
215+
"DNS seeding disabled",
216+
"opencon thread start", # Ensure ThreadOpenConnections::start time is properly set
217+
],
218+
timeout=10,
219+
):
214220
self.start_node(0, extra_args=['-dnsseed=0', '-fixedseeds=1', '-addnode=fakenodeaddr', f'-mocktime={start}'])
215221
with self.nodes[0].assert_debug_log(expected_msgs=[
216222
"Adding fixed seeds as 60 seconds have passed and addrman is empty",

test/functional/feature_presegwit_node_upgrade.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
assert_equal,
1010
softfork_active,
1111
)
12+
import os
13+
1214

1315
class SegwitUpgradeTest(BitcoinTestFramework):
1416
def set_test_params(self):
@@ -35,8 +37,11 @@ def run_test(self):
3537
# Restarting the node (with segwit activation height set to 5) should result in a shutdown
3638
# because the blockchain consists of 3 insufficiently validated blocks per segwit consensus rules.
3739
node.assert_start_raises_init_error(
38-
extra_args=["-segwitheight=5"],
39-
expected_msg=": Witness data for blocks after height 5 requires validation. Please restart with -reindex..\nPlease restart with -reindex or -reindex-chainstate to recover.")
40+
extra_args=["-segwitheight=5"],
41+
expected_msg=": Witness data for blocks after height 5 requires "
42+
f"validation. Please restart with -reindex..{os.linesep}"
43+
"Please restart with -reindex or -reindex-chainstate to recover.",
44+
)
4045

4146
# As directed, the user restarts the node with -reindex
4247
self.start_node(0, extra_args=["-reindex", "-segwitheight=5"])

test/functional/rpc_signer.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,12 @@ def run_test(self):
5353
)
5454

5555
# Handle script missing:
56-
assert_raises_rpc_error(-1, 'execve failed: No such file or directory',
57-
self.nodes[3].enumeratesigners
56+
assert_raises_rpc_error(
57+
-1,
58+
"CreateProcess failed: The system cannot find the file specified."
59+
if platform.system() == "Windows"
60+
else "execve failed: No such file or directory",
61+
self.nodes[3].enumeratesigners,
5862
)
5963

6064
# Handle error thrown by script

test/functional/tool_wallet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ def test_dump_createfromdump(self):
344344
non_exist_dump = os.path.join(self.nodes[0].datadir, "wallet.nodump")
345345
self.assert_raises_tool_error('Unknown wallet file format "notaformat" provided. Please provide one of "bdb" or "sqlite".', '-wallet=todump', '-format=notaformat', '-dumpfile={}'.format(wallet_dump), 'createfromdump')
346346
self.assert_raises_tool_error('Dump file {} does not exist.'.format(non_exist_dump), '-wallet=todump', '-dumpfile={}'.format(non_exist_dump), 'createfromdump')
347-
wallet_path = os.path.join(self.nodes[0].datadir, 'regtest/wallets/todump2')
347+
wallet_path = os.path.join(self.nodes[0].datadir, 'regtest', 'wallets', 'todump2')
348348
self.assert_raises_tool_error('Failed to create database path \'{}\'. Database already exists.'.format(wallet_path), '-wallet=todump2', '-dumpfile={}'.format(wallet_dump), 'createfromdump')
349349
self.assert_raises_tool_error("The -descriptors option can only be used with the 'create' command.", '-descriptors', '-wallet=todump2', '-dumpfile={}'.format(wallet_dump), 'createfromdump')
350350

0 commit comments

Comments
 (0)