mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-31 09:14:56 +00:00
Merge #8744: [0.13.1] qa Backports
d6ebe13 [qa] Refactor RPCTestHandler to prevent TimeoutExpired (MarcoFalke) ae8c7df [qa] create_cache: Delete temp dir when done (MarcoFalke) 63462c2 [qa] remove root test directory for RPC tests (whythat)
This commit is contained in:
commit
8d9e8adc05
@ -248,21 +248,27 @@ class RPCTestHandler:
|
||||
self.num_running += 1
|
||||
t = self.test_list.pop(0)
|
||||
port_seed = ["--portseed=%s" % len(self.test_list)]
|
||||
log_stdout = tempfile.SpooledTemporaryFile(max_size=2**16)
|
||||
log_stderr = tempfile.SpooledTemporaryFile(max_size=2**16)
|
||||
self.jobs.append((t,
|
||||
time.time(),
|
||||
subprocess.Popen((RPC_TESTS_DIR + t).split() + self.flags + port_seed,
|
||||
universal_newlines=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)))
|
||||
stdout=log_stdout,
|
||||
stderr=log_stderr),
|
||||
log_stdout,
|
||||
log_stderr))
|
||||
if not self.jobs:
|
||||
raise IndexError('pop from empty list')
|
||||
while True:
|
||||
# Return first proc that finishes
|
||||
time.sleep(.5)
|
||||
for j in self.jobs:
|
||||
(name, time0, proc) = j
|
||||
(name, time0, proc, log_out, log_err) = j
|
||||
if proc.poll() is not None:
|
||||
(stdout, stderr) = proc.communicate(timeout=3)
|
||||
log_out.seek(0), log_err.seek(0)
|
||||
[stdout, stderr] = [l.read().decode('utf-8') for l in (log_out, log_err)]
|
||||
log_out.close(), log_err.close()
|
||||
passed = stderr == "" and proc.returncode == 0
|
||||
self.num_running -= 1
|
||||
self.jobs.remove(j)
|
||||
|
@ -12,9 +12,15 @@ from test_framework.test_framework import BitcoinTestFramework
|
||||
|
||||
class CreateCache(BitcoinTestFramework):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
# Test network and test nodes are not required:
|
||||
self.num_nodes = 0
|
||||
self.nodes = []
|
||||
|
||||
def setup_network(self):
|
||||
# Don't setup any test nodes
|
||||
self.options.noshutdown = True
|
||||
pass
|
||||
|
||||
def run_test(self):
|
||||
pass
|
||||
|
@ -123,7 +123,8 @@ class BitcoinTestFramework(object):
|
||||
self.add_options(parser)
|
||||
(self.options, self.args) = parser.parse_args()
|
||||
|
||||
self.options.tmpdir += '/' + str(self.options.port_seed)
|
||||
# backup dir variable for removal at cleanup
|
||||
self.options.root, self.options.tmpdir = self.options.tmpdir, self.options.tmpdir + '/' + str(self.options.port_seed)
|
||||
|
||||
if self.options.trace_rpc:
|
||||
logging.basicConfig(level=logging.DEBUG, stream=sys.stdout)
|
||||
@ -174,6 +175,8 @@ class BitcoinTestFramework(object):
|
||||
if not self.options.nocleanup and not self.options.noshutdown and success:
|
||||
print("Cleaning up")
|
||||
shutil.rmtree(self.options.tmpdir)
|
||||
if not os.listdir(self.options.root):
|
||||
os.rmdir(self.options.root)
|
||||
else:
|
||||
print("Not cleaning up dir %s" % self.options.tmpdir)
|
||||
|
||||
|
@ -39,8 +39,8 @@ class WalletHDTest(BitcoinTestFramework):
|
||||
self.nodes[1].importprivkey(self.nodes[0].dumpprivkey(non_hd_add))
|
||||
|
||||
# This should be enough to keep the master key and the non-HD key
|
||||
self.nodes[1].backupwallet(tmpdir + "hd.bak")
|
||||
#self.nodes[1].dumpwallet(tmpdir + "hd.dump")
|
||||
self.nodes[1].backupwallet(tmpdir + "/hd.bak")
|
||||
#self.nodes[1].dumpwallet(tmpdir + "/hd.dump")
|
||||
|
||||
# Derive some HD addresses and remember the last
|
||||
# Also send funds to each add
|
||||
@ -63,7 +63,7 @@ class WalletHDTest(BitcoinTestFramework):
|
||||
print("Restore backup ...")
|
||||
self.stop_node(1)
|
||||
os.remove(self.options.tmpdir + "/node1/regtest/wallet.dat")
|
||||
shutil.copyfile(tmpdir + "hd.bak", tmpdir + "/node1/regtest/wallet.dat")
|
||||
shutil.copyfile(tmpdir + "/hd.bak", tmpdir + "/node1/regtest/wallet.dat")
|
||||
self.nodes[1] = start_node(1, self.options.tmpdir, self.node_args[1])
|
||||
#connect_nodes_bi(self.nodes, 0, 1)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user