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
This commit is contained in:
Noah Misch 2024-06-27 19:21:04 -07:00
parent 473a352fb3
commit 22a4b104ba
1 changed files with 13 additions and 3 deletions

View File

@ -41,12 +41,22 @@ env_dict = {**os.environ,
'TESTDATADIR': os.path.join(testdir, 'data'),
'TESTLOGDIR': os.path.join(testdir, 'log')}
sp = subprocess.run(args.test_command, env=env_dict)
sp = subprocess.Popen(args.test_command, env=env_dict, stdout=subprocess.PIPE)
# Meson categorizes a passing TODO test point as bad
# (https://github.com/mesonbuild/meson/issues/13183). Remove the TODO
# directive, so Meson computes the file result like Perl does. This could
# have the side effect of delaying stdout lines relative to stderr. That
# doesn't affect the log file, and the TAP protocol uses stdout only.
for line in sp.stdout:
if line.startswith(b'ok '):
line = line.replace(b' # TODO ', b' # testwrap-overridden-TODO ', 1)
sys.stdout.buffer.write(line)
returncode = sp.wait()
if sp.returncode == 0:
if returncode == 0:
print('# test succeeded')
open(os.path.join(testdir, 'test.success'), 'x')
else:
print('# test failed')
open(os.path.join(testdir, 'test.fail'), 'x')
sys.exit(sp.returncode)
sys.exit(returncode)