]> git.ipfire.org Git - thirdparty/rsync.git/commitdiff
runtests.py: error early when test helper programs are missing
authorAndrew Tridgell <andrew@tridgell.net>
Wed, 29 Apr 2026 01:35:47 +0000 (11:35 +1000)
committerAndrew Tridgell <andrew@tridgell.net>
Wed, 29 Apr 2026 07:00:55 +0000 (17:00 +1000)
When invoked directly (rather than via 'make check'), runtests.py
previously left the user with a wall of confusing "not found" errors
from inside individual test scripts if the CHECK_PROGS helpers had not
been built. Detect this up front and point the user at the make
target that builds them.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
runtests.py

index 54ca0a05b01d92d43bb8e1437571b359c579c1bd..f82799d923bf7096d394438f10fa701240b45d6a 100755 (executable)
@@ -297,6 +297,22 @@ def main():
         sys.stderr.write(f"srcdir {srcdir} is not a directory\n")
         sys.exit(2)
 
+    # Helper programs the test scripts invoke directly. Missing any of these
+    # would cause many tests to fail with confusing "not found" errors, so
+    # check up front and point the user at the make target that builds them.
+    required_helpers = ['tls', 'trimslash', 't_unsafe', 'wildtest',
+                        'getgroups', 'getfsdev']
+    missing = [h for h in required_helpers
+               if not os.path.isfile(os.path.join(tooldir, h))]
+    if missing:
+        sys.stderr.write(
+            f"runtests.py: missing test helper program(s) in {tooldir}: "
+            f"{', '.join(missing)}\n"
+            f"Build them with: make {' '.join(missing)}\n"
+            f"or run the full test target: make check\n"
+        )
+        sys.exit(2)
+
     testuser = get_testuser()
 
     # Print header