Skip to content

Commit fadf12a

Browse files
author
MarcoFalke
committed
test: Add missing check for empty stderr in util tester
1 parent 96a5cd8 commit fadf12a

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)