mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-02-09 02:59:31 +08:00
Merge bitcoin/bitcoin#32327: test: Add missing check for empty stderr in util tester
fadf12a56ctest: Add missing check for empty stderr in util tester (MarcoFalke) Pull request description: Now that wine support was removed from the CI in25b56fd9b4, it can probably be removed from the util tester as well. If someone really needs this, they can comment the new check out, or submit a patch to add an option/env var to silence the new check. ACKs for top commit: achow101: ACKfadf12a56ci-am-yuvi: tACKfadf12a56cBrandonOdiwuor: Code Review ACKfadf12a56cismaelsadeeq: Tested ACKfadf12a56cTree-SHA512: d9e4d7a7f724e114391070ea7f17b585a7e4c4f3221c3bf510eeb11df6ccd089b881ab5654adfef8d3a1f8fa7ec6bf5e3a3feeb0cdfe724a8f3e5a146c388e66
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2014 BitPay Inc.
|
||||
# Copyright 2016-2017 The Bitcoin Core developers
|
||||
# Copyright 2016-present The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
"""Test framework for bitcoin utils.
|
||||
@@ -155,15 +155,16 @@ def bctest(testDir, testObj, buildenv):
|
||||
|
||||
if "error_txt" in testObj:
|
||||
want_error = testObj["error_txt"]
|
||||
# Compare error text
|
||||
# TODO: ideally, we'd compare the strings exactly and also assert
|
||||
# That stderr is empty if no errors are expected. However, bitcoin-tx
|
||||
# emits DISPLAY errors when running as a windows application on
|
||||
# linux through wine. Just assert that the expected error text appears
|
||||
# somewhere in stderr.
|
||||
# A partial match instead of an exact match makes writing tests easier
|
||||
# and should be sufficient.
|
||||
if want_error not in res.stderr:
|
||||
logging.error(f"Error mismatch:\nExpected: {want_error}\nReceived: {res.stderr.rstrip()}\nres: {str(res)}")
|
||||
raise Exception
|
||||
else:
|
||||
if res.stderr:
|
||||
logging.error(f"Unexpected error received: {res.stderr.rstrip()}\nres: {str(res)}")
|
||||
raise Exception
|
||||
|
||||
|
||||
def parse_output(a, fmt):
|
||||
"""Parse the output according to specified format.
|
||||
|
||||
Reference in New Issue
Block a user