Skip to content

Commit 65714c1

Browse files
committed
Merge bitcoin/bitcoin#32327: test: Add missing check for empty stderr in util tester
fadf12a test: Add missing check for empty stderr in util tester (MarcoFalke) Pull request description: Now that wine support was removed from the CI in 25b56fd, 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: ACK fadf12a i-am-yuvi: tACK fadf12a BrandonOdiwuor: Code Review ACK fadf12a ismaelsadeeq: Tested ACK fadf12a Tree-SHA512: d9e4d7a7f724e114391070ea7f17b585a7e4c4f3221c3bf510eeb11df6ccd089b881ab5654adfef8d3a1f8fa7ec6bf5e3a3feeb0cdfe724a8f3e5a146c388e66
2 parents a4eee6d + fadf12a commit 65714c1

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

test/util/test_runner.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22
# Copyright 2014 BitPay Inc.
3-
# Copyright 2016-2017 The Bitcoin Core developers
3+
# Copyright 2016-present The Bitcoin Core developers
44
# Distributed under the MIT software license, see the accompanying
55
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
66
"""Test framework for bitcoin utils.
@@ -155,15 +155,16 @@ def bctest(testDir, testObj, buildenv):
155155

156156
if "error_txt" in testObj:
157157
want_error = testObj["error_txt"]
158-
# Compare error text
159-
# TODO: ideally, we'd compare the strings exactly and also assert
160-
# That stderr is empty if no errors are expected. However, bitcoin-tx
161-
# emits DISPLAY errors when running as a windows application on
162-
# linux through wine. Just assert that the expected error text appears
163-
# somewhere in stderr.
158+
# A partial match instead of an exact match makes writing tests easier
159+
# and should be sufficient.
164160
if want_error not in res.stderr:
165161
logging.error(f"Error mismatch:\nExpected: {want_error}\nReceived: {res.stderr.rstrip()}\nres: {str(res)}")
166162
raise Exception
163+
else:
164+
if res.stderr:
165+
logging.error(f"Unexpected error received: {res.stderr.rstrip()}\nres: {str(res)}")
166+
raise Exception
167+
167168

168169
def parse_output(a, fmt):
169170
"""Parse the output according to specified format.

0 commit comments

Comments
 (0)