Skip to content

Commit e503671

Browse files
committed
[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.
1 parent c22ce8a commit e503671

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

test/functional/test_framework/test_node.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,12 @@ def start(self, extra_args=None, stdout=None, stderr=None, *args, **kwargs):
143143
# unclean shutdown), it will get overwritten anyway by bitcoind, and
144144
# potentially interfere with our attempt to authenticate
145145
delete_cookie_file(self.datadir)
146-
self.process = subprocess.Popen(self.args + extra_args, stdout=stdout, stderr=stderr, *args, **kwargs)
146+
147+
# add environment variable LIBC_FATAL_STDERR_=1 so that libc errors are written to stderr and not the terminal
148+
subp_env = dict(os.environ, LIBC_FATAL_STDERR_="1")
149+
150+
self.process = subprocess.Popen(self.args + extra_args, env=subp_env, stdout=stdout, stderr=stderr, *args, **kwargs)
151+
147152
self.running = True
148153
self.log.debug("bitcoind started, waiting for RPC to come up")
149154

0 commit comments

Comments
 (0)