mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-09 11:27:28 -03:00
test: Fix tests on Windows
This commit is contained in:
parent
5e3380b9f5
commit
fadecbd9a4
5 changed files with 36 additions and 15 deletions
|
@ -57,6 +57,8 @@
|
|||
<Copy SourceFiles="$(ConfigIniIn)" DestinationFiles="$(ConfigIniOut)" ></Copy>
|
||||
<ReplaceInFile FilePath="$(ConfigIniOut)"
|
||||
Replace="@PACKAGE_NAME@" By="Bitcoin Core"></ReplaceInFile>
|
||||
<ReplaceInFile FilePath="$(ConfigIniOut)"
|
||||
Replace="@PACKAGE_BUGREPORT@" By="https://github.com/bitcoin/bitcoin/issues"></ReplaceInFile>
|
||||
<ReplaceInFile FilePath="$(ConfigIniOut)"
|
||||
Replace="@abs_top_srcdir@" By="..\.." ToFullPath="true"></ReplaceInFile>
|
||||
<ReplaceInFile FilePath="$(ConfigIniOut)"
|
||||
|
@ -71,12 +73,16 @@
|
|||
Replace="@USE_SQLITE_TRUE@" By=""></ReplaceInFile>
|
||||
<ReplaceInFile FilePath="$(ConfigIniOut)"
|
||||
Replace="@BUILD_BITCOIN_CLI_TRUE@" By=""></ReplaceInFile>
|
||||
<ReplaceInFile FilePath="$(ConfigIniOut)"
|
||||
Replace="@BUILD_BITCOIN_WALLET_TRUE@" By=""></ReplaceInFile>
|
||||
<ReplaceInFile FilePath="$(ConfigIniOut)"
|
||||
Replace="@BUILD_BITCOIND_TRUE@" By=""></ReplaceInFile>
|
||||
<ReplaceInFile FilePath="$(ConfigIniOut)"
|
||||
Replace="@ENABLE_FUZZ_TRUE@" By=""></ReplaceInFile>
|
||||
<ReplaceInFile FilePath="$(ConfigIniOut)"
|
||||
Replace="@ENABLE_ZMQ_TRUE@" By=""></ReplaceInFile>
|
||||
<ReplaceInFile FilePath="$(ConfigIniOut)"
|
||||
Replace="@ENABLE_EXTERNAL_SIGNER_TRUE@" By=""></ReplaceInFile>
|
||||
</Target>
|
||||
<Import Project="..\common.vcxproj" />
|
||||
</Project>
|
||||
|
|
|
@ -164,11 +164,14 @@ class ConfArgsTest(BitcoinTestFramework):
|
|||
# fixed seeds
|
||||
assert not os.path.exists(os.path.join(default_data_dir, "peers.dat"))
|
||||
start = int(time.time())
|
||||
with self.nodes[0].assert_debug_log(expected_msgs=[
|
||||
"Loaded 0 addresses from peers.dat",
|
||||
"0 addresses found from DNS seeds",
|
||||
"opencon thread start", # Ensure ThreadOpenConnections::start time is properly set
|
||||
]):
|
||||
with self.nodes[0].assert_debug_log(
|
||||
expected_msgs=[
|
||||
"Loaded 0 addresses from peers.dat",
|
||||
"0 addresses found from DNS seeds",
|
||||
"opencon thread start", # Ensure ThreadOpenConnections::start time is properly set
|
||||
],
|
||||
timeout=10,
|
||||
):
|
||||
self.start_node(0, extra_args=['-dnsseed=1', '-fixedseeds=1', f'-mocktime={start}'])
|
||||
with self.nodes[0].assert_debug_log(expected_msgs=[
|
||||
"Adding fixed seeds as 60 seconds have passed and addrman is empty",
|
||||
|
@ -206,11 +209,14 @@ class ConfArgsTest(BitcoinTestFramework):
|
|||
# We expect the node will allow 60 seconds prior to using fixed seeds
|
||||
assert not os.path.exists(os.path.join(default_data_dir, "peers.dat"))
|
||||
start = int(time.time())
|
||||
with self.nodes[0].assert_debug_log(expected_msgs=[
|
||||
"Loaded 0 addresses from peers.dat",
|
||||
"DNS seeding disabled",
|
||||
"opencon thread start", # Ensure ThreadOpenConnections::start time is properly set
|
||||
]):
|
||||
with self.nodes[0].assert_debug_log(
|
||||
expected_msgs=[
|
||||
"Loaded 0 addresses from peers.dat",
|
||||
"DNS seeding disabled",
|
||||
"opencon thread start", # Ensure ThreadOpenConnections::start time is properly set
|
||||
],
|
||||
timeout=10,
|
||||
):
|
||||
self.start_node(0, extra_args=['-dnsseed=0', '-fixedseeds=1', '-addnode=fakenodeaddr', f'-mocktime={start}'])
|
||||
with self.nodes[0].assert_debug_log(expected_msgs=[
|
||||
"Adding fixed seeds as 60 seconds have passed and addrman is empty",
|
||||
|
|
|
@ -9,6 +9,8 @@ from test_framework.util import (
|
|||
assert_equal,
|
||||
softfork_active,
|
||||
)
|
||||
import os
|
||||
|
||||
|
||||
class SegwitUpgradeTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
|
@ -35,8 +37,11 @@ class SegwitUpgradeTest(BitcoinTestFramework):
|
|||
# Restarting the node (with segwit activation height set to 5) should result in a shutdown
|
||||
# because the blockchain consists of 3 insufficiently validated blocks per segwit consensus rules.
|
||||
node.assert_start_raises_init_error(
|
||||
extra_args=["-segwitheight=5"],
|
||||
expected_msg=": Witness data for blocks after height 5 requires validation. Please restart with -reindex..\nPlease restart with -reindex or -reindex-chainstate to recover.")
|
||||
extra_args=["-segwitheight=5"],
|
||||
expected_msg=": Witness data for blocks after height 5 requires "
|
||||
f"validation. Please restart with -reindex..{os.linesep}"
|
||||
"Please restart with -reindex or -reindex-chainstate to recover.",
|
||||
)
|
||||
|
||||
# As directed, the user restarts the node with -reindex
|
||||
self.start_node(0, extra_args=["-reindex", "-segwitheight=5"])
|
||||
|
|
|
@ -53,8 +53,12 @@ class RPCSignerTest(BitcoinTestFramework):
|
|||
)
|
||||
|
||||
# Handle script missing:
|
||||
assert_raises_rpc_error(-1, 'execve failed: No such file or directory',
|
||||
self.nodes[3].enumeratesigners
|
||||
assert_raises_rpc_error(
|
||||
-1,
|
||||
"CreateProcess failed: The system cannot find the file specified."
|
||||
if platform.system() == "Windows"
|
||||
else "execve failed: No such file or directory",
|
||||
self.nodes[3].enumeratesigners,
|
||||
)
|
||||
|
||||
# Handle error thrown by script
|
||||
|
|
|
@ -344,7 +344,7 @@ class ToolWalletTest(BitcoinTestFramework):
|
|||
non_exist_dump = os.path.join(self.nodes[0].datadir, "wallet.nodump")
|
||||
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')
|
||||
self.assert_raises_tool_error('Dump file {} does not exist.'.format(non_exist_dump), '-wallet=todump', '-dumpfile={}'.format(non_exist_dump), 'createfromdump')
|
||||
wallet_path = os.path.join(self.nodes[0].datadir, 'regtest/wallets/todump2')
|
||||
wallet_path = os.path.join(self.nodes[0].datadir, 'regtest', 'wallets', 'todump2')
|
||||
self.assert_raises_tool_error('Failed to create database path \'{}\'. Database already exists.'.format(wallet_path), '-wallet=todump2', '-dumpfile={}'.format(wallet_dump), 'createfromdump')
|
||||
self.assert_raises_tool_error("The -descriptors option can only be used with the 'create' command.", '-descriptors', '-wallet=todump2', '-dumpfile={}'.format(wallet_dump), 'createfromdump')
|
||||
|
||||
|
|
Loading…
Reference in a new issue