Skip to content

Commit 69334c6

Browse files
authored
[test] Fix inconsistency regarding subprocess stdout/stderr buffering. NFC (#26087)
This bug could lead to tests that pass locally (when buffering is the default) but not in CI (which doesn't do buffering by default). Also, drive by fix to use existing EMCONFIGURE/EMCMAKE variables in test_sockets.py.
1 parent 99997a4 commit 69334c6

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

test/common.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,8 +1177,15 @@ def run_process(self, cmd, check=True, **kwargs):
11771177

11781178
if stdout_buffering:
11791179
sys.stdout.write(rtn.stdout)
1180+
# When we inject stdout/stderr buffering for our own internal purposes, we do not also want to
1181+
# make it available on the returned object.
1182+
# If we don't do this then callers would have access to rtn.stdout/rtn.stderr even when they
1183+
# didn't request it (i.e. even when they did not pass stderr=PIPE), which can lead to tests
1184+
# that pass in buffering mode, but fail without it.
1185+
rtn.stdout = None
11801186
if stderr_buffering:
11811187
sys.stderr.write(rtn.stderr)
1188+
rtn.stderr = None
11821189
return rtn
11831190

11841191
def emcc(self, filename, args=[], **kwargs): # noqa

test/test_sockets.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,8 @@ def test_enet(self):
318318
# this is also a good test of raw usage of emconfigure and emmake
319319
shutil.copytree(test_file('third_party', 'enet'), 'enet')
320320
with common.chdir('enet'):
321-
self.run_process([path_from_root('emconfigure'), './configure', '--disable-shared'])
322-
self.run_process([path_from_root('emmake'), 'make'])
321+
self.run_process([common.EMCONFIGURE, './configure', '--disable-shared'])
322+
self.run_process([common.EMMAKE, 'make'])
323323
enet = [self.in_dir('enet', '.libs', 'libenet.a'), '-I' + self.in_dir('enet', 'include')]
324324

325325
with CompiledServerHarness(test_file('sockets/test_enet_server.c'), enet, 49210) as harness:

0 commit comments

Comments
 (0)