]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t: adapt existing PERL prerequisites
authorPatrick Steinhardt <ps@pks.im>
Thu, 3 Apr 2025 05:05:58 +0000 (07:05 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 7 Apr 2025 21:47:38 +0000 (14:47 -0700)
A couple of our tests depend on the PERL prerequisite even though it
isn't needed. These tests fall into one of the following classes:

  - The underlying logic used to be implemented in Perl but isn't
    anymore. Here we can simply drop the dependency altogether.

  - The test logic used to depend on Perl but doesn't anymore. Again, we
    can simply drop the dependency.

  - The test logic still relies on a Perl interpreter. These tests
    should use the newly introduced PERL_TEST_HELPERS prerequisite.

Adapt test cases accordingly.

Note that in t1006 we have to introduce another new prerequisite
depending on whether or not the IPC::Open2 module is available. Funny
enough, when starting to use `test_lazy_prereq` to do so we also get a
conflict of variables with the "script" variable that contains the Perl
logic because `test_run_lazy_prereq_` also sets that variable. We thus
rename the variable in t1006 to "perl_script".

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t0021-conversion.sh
t/t0090-cache-tree.sh
t/t1006-cat-file.sh
t/t7501-commit-basic-functionality.sh

index 9c3738ebb3f00f5513686243273a50a7fdd18ba3..4a892a917807001d604a6113e245ce5ca692d3e5 100755 (executable)
@@ -841,7 +841,7 @@ test_expect_success 'process filter abort stops processing of all further files'
        )
 '
 
-test_expect_success PERL 'invalid process filter must fail (and not hang!)' '
+test_expect_success 'invalid process filter must fail (and not hang!)' '
        test_config_global filter.protocol.process cat &&
        test_config_global filter.protocol.required true &&
        rm -rf repo &&
@@ -1111,19 +1111,19 @@ do
        branch) opt='-f HEAD' ;;
        esac
 
-       test_expect_success PERL,TTY "delayed checkout shows progress by default on tty ($mode checkout)" '
+       test_expect_success TTY "delayed checkout shows progress by default on tty ($mode checkout)" '
                test_delayed_checkout_progress test_terminal git checkout $opt
        '
 
-       test_expect_success PERL "delayed checkout omits progress on non-tty ($mode checkout)" '
+       test_expect_success "delayed checkout omits progress on non-tty ($mode checkout)" '
                test_delayed_checkout_progress ! git checkout $opt
        '
 
-       test_expect_success PERL,TTY "delayed checkout omits progress with --quiet ($mode checkout)" '
+       test_expect_success TTY "delayed checkout omits progress with --quiet ($mode checkout)" '
                test_delayed_checkout_progress ! test_terminal git checkout --quiet $opt
        '
 
-       test_expect_success PERL,TTY "delayed checkout honors --[no]-progress ($mode checkout)" '
+       test_expect_success TTY "delayed checkout honors --[no]-progress ($mode checkout)" '
                test_delayed_checkout_progress ! test_terminal git checkout --no-progress $opt &&
                test_delayed_checkout_progress test_terminal git checkout --quiet --progress $opt
        '
index ab80c9ef1358f0c29d7cdb877c1dd41e0a98e7aa..d901588294668c40d5490e41e5ad8645152f1ce6 100755 (executable)
@@ -128,7 +128,7 @@ test_expect_success 'second commit has cache-tree' '
        test_cache_tree
 '
 
-test_expect_success PERL 'commit --interactive gives cache-tree on partial commit' '
+test_expect_success 'commit --interactive gives cache-tree on partial commit' '
        test_when_finished "git reset --hard" &&
        cat <<-\EOT >foo.c &&
        int foo()
@@ -162,7 +162,7 @@ test_expect_success PERL 'commit --interactive gives cache-tree on partial commi
        test_cache_tree expected.status
 '
 
-test_expect_success PERL 'commit -p with shrinking cache-tree' '
+test_expect_success 'commit -p with shrinking cache-tree' '
        mkdir -p deep/very-long-subdir &&
        echo content >deep/very-long-subdir/file &&
        git add deep &&
index a574da3df531c8f3e3b3da005c6ab6344275158e..0a22b0a7b8e0609d13ffbc320bd6409a2ffc4fe0 100755 (executable)
@@ -1323,7 +1323,7 @@ test_expect_success 'batch-command flush without --buffer' '
        grep "^fatal:.*flush is only for --buffer mode.*" err
 '
 
-script='
+perl_script='
 use warnings;
 use strict;
 use IPC::Open2;
@@ -1345,12 +1345,16 @@ $? == 0 or die "\$?=$?";
 
 expect="$hello_oid blob $hello_size"
 
-test_expect_success PERL '--batch-check is unbuffered by default' '
-       perl -e "$script" -- --batch-check $hello_oid "$expect"
+test_lazy_prereq PERL_IPC_OPEN2 '
+       perl -MIPC::Open2 -e "exit 0"
 '
 
-test_expect_success PERL '--batch-command info is unbuffered by default' '
-       perl -e "$script" -- --batch-command $hello_oid "$expect" "info "
+test_expect_success PERL_IPC_OPEN2 '--batch-check is unbuffered by default' '
+       perl -e "$perl_script" -- --batch-check $hello_oid "$expect"
+'
+
+test_expect_success PERL_IPC_OPEN2 '--batch-command info is unbuffered by default' '
+       perl -e "$perl_script" -- --batch-command $hello_oid "$expect" "info "
 '
 
 test_done
index cc12f99f11534b898d11a0fc7bbb5d339730ccc8..a37509f0043b46bcb5aa6c45f8462fc96244f5a9 100755 (executable)
@@ -46,7 +46,7 @@ test_expect_success 'paths and -a do not mix' '
        test_must_fail git commit -m foo -a file
 '
 
-test_expect_success PERL 'can use paths with --interactive' '
+test_expect_success 'can use paths with --interactive' '
        echo bong-o-bong >file &&
        # 2: update, 1:st path, that is all, 7: quit
        test_write_lines 2 1 "" 7 |
@@ -345,12 +345,12 @@ test_expect_success 'overriding author from command line' '
        grep Rubber.Duck output
 '
 
-test_expect_success PERL 'interactive add' '
+test_expect_success 'interactive add' '
        echo 7 | test_must_fail git commit --interactive >out &&
        grep "What now" out
 '
 
-test_expect_success PERL "commit --interactive doesn't change index if editor aborts" '
+test_expect_success "commit --interactive doesn't change index if editor aborts" '
        echo zoo >file &&
        test_must_fail git diff --exit-code >diff1 &&
        test_write_lines u "*" q |