Explicitly skip TAP tests under Meson if disabled
authorPeter Eisentraut <[email protected]>
Thu, 16 Nov 2023 07:06:12 +0000 (08:06 +0100)
committerPeter Eisentraut <[email protected]>
Thu, 16 Nov 2023 07:14:33 +0000 (08:14 +0100)
If the tap_tests option is disabled under Meson, the TAP tests are
currently not registered at all.  But this makes it harder to see what
is going on, why suddently there are fewer tests than before.

Instead, run testwrap with an option that marks the test as skipped.
That way, the total list and count of tests is constant whether the
option is enabled or not.

Reviewed-by: Andres Freund <[email protected]>
Discussion: https://www.postgresql.org/message-id/ad5ec96d-69ec-317b-a137-367ea5019b61@eisentraut.org

meson.build
src/tools/testwrap

index 47c8fcdc532b1c995b4bb59d2d947e1a38cefc15..286d7e42698ca57f774eeecd25ca33116deed006 100644 (file)
@@ -3252,8 +3252,9 @@ foreach test_dir : tests
 
       testport += 1
     elif kind == 'tap'
+      testwrap_tap = testwrap_base
       if not tap_tests_enabled
-        continue
+        testwrap_tap += ['--skip', 'TAP tests not enabled']
       endif
 
       test_command = [
@@ -3293,7 +3294,7 @@ foreach test_dir : tests
         test(test_dir['name'] / onetap_p,
           python,
           kwargs: test_kwargs,
-          args: testwrap_base + [
+          args: testwrap_tap + [
             '--testgroup', test_dir['name'],
             '--testname', onetap_p,
             '--', test_command,
index 7a64fe76a2d797b6b321eeb54f18b907fc17e68d..d01e61051cbae8e5e03c1613e46abca255d18bba 100755 (executable)
@@ -12,6 +12,7 @@ parser.add_argument('--srcdir', help='source directory of test', type=str)
 parser.add_argument('--basedir', help='base directory of test', type=str)
 parser.add_argument('--testgroup', help='test group', type=str)
 parser.add_argument('--testname', help='test name', type=str)
+parser.add_argument('--skip', help='skip test (with reason)', type=str)
 parser.add_argument('test_command', nargs='*')
 
 args = parser.parse_args()
@@ -23,6 +24,10 @@ print('# executing test in {} group {} test {}'.format(
     testdir, args.testgroup, args.testname))
 sys.stdout.flush()
 
+if args.skip is not None:
+    print('1..0 # Skipped: ' + args.skip)
+    sys.exit(0)
+
 if os.path.exists(testdir) and os.path.isdir(testdir):
     shutil.rmtree(testdir)
 os.makedirs(testdir)