Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 22a4b10

Browse files
committed
Make TAP todo_start effects the same under Meson and prove_check.
This could have caused spurious failures only on SPARC Linux, because today's only todo_start tests for that platform. Back-patch to v16, where Meson support first appeared. Reviewed by Robert Haas. Discussion: https://postgr.es/m/20240512232923.aa.nmisch@google.com
1 parent 473a352 commit 22a4b10

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/tools/testwrap

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,22 @@ env_dict = {**os.environ,
4141
'TESTDATADIR': os.path.join(testdir, 'data'),
4242
'TESTLOGDIR': os.path.join(testdir, 'log')}
4343

44-
sp = subprocess.run(args.test_command, env=env_dict)
45-
46-
if sp.returncode == 0:
44+
sp = subprocess.Popen(args.test_command, env=env_dict, stdout=subprocess.PIPE)
45+
# Meson categorizes a passing TODO test point as bad
46+
# (https://github.com/mesonbuild/meson/issues/13183). Remove the TODO
47+
# directive, so Meson computes the file result like Perl does. This could
48+
# have the side effect of delaying stdout lines relative to stderr. That
49+
# doesn't affect the log file, and the TAP protocol uses stdout only.
50+
for line in sp.stdout:
51+
if line.startswith(b'ok '):
52+
line = line.replace(b' # TODO ', b' # testwrap-overridden-TODO ', 1)
53+
sys.stdout.buffer.write(line)
54+
returncode = sp.wait()
55+
56+
if returncode == 0:
4757
print('# test succeeded')
4858
open(os.path.join(testdir, 'test.success'), 'x')
4959
else:
5060
print('# test failed')
5161
open(os.path.join(testdir, 'test.fail'), 'x')
52-
sys.exit(sp.returncode)
62+
sys.exit(returncode)

0 commit comments

Comments
 (0)