7
7
Verify that a bitcoind node can load multiple wallet files
8
8
"""
9
9
import os
10
+ import re
10
11
import shutil
11
12
12
13
from test_framework .test_framework import BitcoinTestFramework
@@ -60,11 +61,8 @@ def run_test(self):
60
61
assert_equal (os .path .isfile (wallet_dir (wallet_name )), True )
61
62
62
63
# should not initialize if wallet path can't be created
63
- exp_stderr = "\n \n \*+\n " + \
64
- "EXCEPTION: .*\n " + \
65
- "boost::filesystem::create_directory: Not a directory:.*\n " + \
66
- "bitcoin in .*\n "
67
- self .nodes [0 ].assert_start_raises_init_error (['-wallet=wallet.dat/bad' ], exp_stderr )
64
+ exp_stderr = "boost::filesystem::create_directory: (The system cannot find the path specified|Not a directory):"
65
+ self .nodes [0 ].assert_start_raises_init_error (['-wallet=wallet.dat/bad' ], exp_stderr , partial_match = True )
68
66
69
67
self .nodes [0 ].assert_start_raises_init_error (['-walletdir=wallets' ], 'Error: Specified -walletdir "wallets" does not exist' )
70
68
self .nodes [0 ].assert_start_raises_init_error (['-walletdir=wallets' ], 'Error: Specified -walletdir "wallets" is a relative path' , cwd = data_dir ())
@@ -75,11 +73,8 @@ def run_test(self):
75
73
76
74
# should not initialize if one wallet is a copy of another
77
75
shutil .copyfile (wallet_dir ('w8' ), wallet_dir ('w8_copy' ))
78
- exp_stderr = "\n \n \*+\n " + \
79
- "EXCEPTION: .*\n " + \
80
- "CDB: Can't open database w8_copy \(duplicates fileid \w+ from w8\)\s*\n " + \
81
- "bitcoin in .*\n "
82
- self .nodes [0 ].assert_start_raises_init_error (['-wallet=w8' , '-wallet=w8_copy' ], exp_stderr )
76
+ exp_stderr = "CDB: Can't open database w8_copy \(duplicates fileid \w+ from w8\)"
77
+ self .nodes [0 ].assert_start_raises_init_error (['-wallet=w8' , '-wallet=w8_copy' ], exp_stderr , partial_match = True )
83
78
84
79
# should not initialize if wallet file is a symlink
85
80
os .symlink ('w8' , wallet_dir ('w8_symlink' ))
@@ -90,7 +85,7 @@ def run_test(self):
90
85
# should not initialize if the specified walletdir is not a directory
91
86
not_a_dir = wallet_dir ('notadir' )
92
87
open (not_a_dir , 'a' ).close ()
93
- self .nodes [0 ].assert_start_raises_init_error (['-walletdir=' + not_a_dir ], 'Error: Specified -walletdir "' + not_a_dir + '" is not a directory' )
88
+ self .nodes [0 ].assert_start_raises_init_error (['-walletdir=' + not_a_dir ], 'Error: Specified -walletdir "' + re . escape ( not_a_dir ) + '" is not a directory' )
94
89
95
90
# if wallets/ doesn't exist, datadir should be the default wallet dir
96
91
wallet_dir2 = data_dir ('walletdir' )
@@ -112,7 +107,7 @@ def run_test(self):
112
107
os .mkdir (competing_wallet_dir )
113
108
self .restart_node (0 , ['-walletdir=' + competing_wallet_dir ])
114
109
exp_stderr = "Error: Error initializing wallet database environment \" \S+competing_walletdir\" !"
115
- self .nodes [1 ].assert_start_raises_init_error (['-walletdir=' + competing_wallet_dir ], exp_stderr )
110
+ self .nodes [1 ].assert_start_raises_init_error (['-walletdir=' + competing_wallet_dir ], exp_stderr , partial_match = True )
116
111
117
112
self .restart_node (0 , extra_args )
118
113
0 commit comments