diff options
author | John Newbery <john@johnnewbery.com> | 2018-02-07 10:00:13 -0500 |
---|---|---|
committer | John Newbery <john@johnnewbery.com> | 2018-05-09 09:56:49 -0400 |
commit | e5036715c8f56170e1674f8aa4eb4b54565bb451 (patch) | |
tree | f7304accfd61d12bfea99c8723ddd1d7675e48e6 | |
parent | c22ce8a7b8954ed443e518e06319b907b6efd7be (diff) |
[Tests] Use LIBC_FATAL_STDERR_=1 in tests
By default, libc will print fatal errors to /dev/tty instead of stderr.
Adding the LIBC_FATAL_STDERR_ to the environment variables allows
us to catch libc errors in stderr and test for them.
-rwxr-xr-x | test/functional/test_framework/test_node.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py index bec3841d12..440e4586b7 100755 --- a/test/functional/test_framework/test_node.py +++ b/test/functional/test_framework/test_node.py @@ -143,7 +143,12 @@ class TestNode(): # unclean shutdown), it will get overwritten anyway by bitcoind, and # potentially interfere with our attempt to authenticate delete_cookie_file(self.datadir) - self.process = subprocess.Popen(self.args + extra_args, stdout=stdout, stderr=stderr, *args, **kwargs) + + # add environment variable LIBC_FATAL_STDERR_=1 so that libc errors are written to stderr and not the terminal + subp_env = dict(os.environ, LIBC_FATAL_STDERR_="1") + + self.process = subprocess.Popen(self.args + extra_args, env=subp_env, stdout=stdout, stderr=stderr, *args, **kwargs) + self.running = True self.log.debug("bitcoind started, waiting for RPC to come up") |