diff --git a/test/util/test_runner.py b/test/util/test_runner.py index d6faf18c5c6..8b2615209dc 100755 --- a/test/util/test_runner.py +++ b/test/util/test_runner.py @@ -156,7 +156,6 @@ 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 @@ -164,6 +163,11 @@ def bctest(testDir, testObj, buildenv): 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 no error is expected, stderr should be empty except for known cases + if res.stderr and not (testObj.get("exec") == "./bitcoin-tx" and "wine" in os.environ.get("WINEPREFIX", "")): + logging.error(f"Unexpected stderr output when no error expected:\n{res.stderr.rstrip()}\nres: {str(res)}") + raise Exception def parse_output(a, fmt): """Parse the output according to specified format.