Re: [PATCH] t5150: skip request-pull test if Perl is disabled
From: Ruud van Asseldonk <hidden>
Date: 2019-11-27 22:42:32
Thanks for having a look Jonathan. Jonathan Nieder wrote:
Ruud van Asseldonk wrote:quoted
The git-request-pull.sh script invokes Perl,Okay, on second glance I found it: set fnord $(git ls-remote "$url" | @@PERL@@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev") This does seem pretty inherently to require perl, so makes sense. I wonder if we can generalize this. For example, would it make sense to have a helper that looks for @@PERL@@ in a file, so we could say if uses_perl git-request-pull.sh && ! test_have_prereq PERL then ... fi That way, this would be more futureproof in case someone eliminates the perl dependency (either by improving that particular parsing step or by rewriting the whole program in C).
That sounds like a good idea. How about turning that into a test itself? The test would check that the script mentions @@PERL@@, as the first subtest. That way, if somebody removes the Perl dependency in the future, that will make the test fail, and that will be a reminder to remove the check from the test, so the test runs unconditionally.
In any event, Reviewed-by: Jonathan Nieder <redacted> Do the request-pull tests in t7006-pager.sh need the same treatment?
I think these tests are fine, they run "git -p request-pull", not enough arguments to make request-pull do something, so it prints its usage and exits with 1. The tests use test_must_fail to verify the exit code, and printing usage does go through the pager. request-pull does not call Perl when it only prints its usage.