Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/main/perl/lib/CPAN/Distribution.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3859,6 +3859,11 @@ sub test {
$self->debug("Changed directory to $self->{build_dir}")
if $CPAN::DEBUG;

if (open my $perlonjava_perl5lib_fh, ">", ".perlonjava-cpan-perl5lib") {
print {$perlonjava_perl5lib_fh} $ENV{PERL5LIB} || "";
close $perlonjava_perl5lib_fh;
}

if ($^O eq 'MacOS') {
Mac::BuildTools::make_test($self);
$self->post_test();
Expand Down
11 changes: 8 additions & 3 deletions src/main/perl/lib/ExtUtils/MM_PerlOnJava.pm
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,21 @@ sub test {

return '' unless $tests;

# Set PERL5LIB to add blib/lib and blib/arch to @INC for test subprocesses
# Set PERL5LIB to add blib/lib and blib/arch to @INC for test subprocesses.
# CPAN.pm also writes .perlonjava-cpan-perl5lib during jcpan test runs so
# resumed/manual make test invocations keep tested-but-not-installed deps.
# Test::Harness runs each test file as a subprocess, so we need PERL5LIB
# Use "undef *Test::Harness::Switches" to disable the default -w switch,
# matching standard ExtUtils::MakeMaker behavior (MM_Any::test_via_harness)
return <<"MAKE_FRAG";
PERLONJAVA_CPAN_PERL5LIB = \$(shell test -f .perlonjava-cpan-perl5lib && cat .perlonjava-cpan-perl5lib)
PERLONJAVA_TEST_PERL5LIB = \$(INST_LIB):\$(INST_ARCHLIB):\$(PERLONJAVA_CPAN_PERL5LIB):\$\$PERL5LIB

test :: pure_all
PERL5LIB="\$(INST_LIB):\$(INST_ARCHLIB):\$\$PERL5LIB" \$(FULLPERL) "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(\$(TEST_VERBOSE), '\$(INST_LIB)', '\$(INST_ARCHLIB)')" $tests
PERL5LIB="\$(PERLONJAVA_TEST_PERL5LIB)" \$(FULLPERL) "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(\$(TEST_VERBOSE), '\$(INST_LIB)', '\$(INST_ARCHLIB)')" $tests

test_dynamic :: pure_all
PERL5LIB="\$(INST_LIB):\$(INST_ARCHLIB):\$\$PERL5LIB" \$(FULLPERL) "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(\$(TEST_VERBOSE), '\$(INST_LIB)', '\$(INST_ARCHLIB)')" $tests
PERL5LIB="\$(PERLONJAVA_TEST_PERL5LIB)" \$(FULLPERL) "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(\$(TEST_VERBOSE), '\$(INST_LIB)', '\$(INST_ARCHLIB)')" $tests

test_static ::
\@echo "No static tests for PerlOnJava"
Expand Down
6 changes: 4 additions & 2 deletions src/main/perl/lib/ExtUtils/MakeMaker.pm
Original file line number Diff line number Diff line change
Expand Up @@ -603,10 +603,10 @@ sub _create_install_makefile {
} elsif ($test_glob) {
# Use ExtUtils::Command::MM::test_harness with undef *Test::Harness::Switches
# to disable the default -w switch, matching standard MakeMaker behavior
$test_cmd = qq{PERL5LIB="\$(INST_LIB):\$(INST_ARCHLIB):\$\$PERL5LIB" $perl "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, '\$(INST_LIB)', '\$(INST_ARCHLIB)')" $test_glob};
$test_cmd = qq{PERL5LIB="\$(PERLONJAVA_TEST_PERL5LIB)" $perl "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, '\$(INST_LIB)', '\$(INST_ARCHLIB)')" $test_glob};
} elsif (-f 'test.pl') {
# Legacy convention: some older CPAN dists use test.pl instead of t/*.t
$test_cmd = qq{PERL5LIB="\$(INST_LIB):\$(INST_ARCHLIB):\$\$PERL5LIB" $perl test.pl};
$test_cmd = qq{PERL5LIB="\$(PERLONJAVA_TEST_PERL5LIB)" $perl test.pl};
} else {
$test_cmd = qq{$perl -e "print qq{PerlOnJava: No tests found (no t/ directory)\\n}"};
}
Expand Down Expand Up @@ -795,6 +795,8 @@ INST_LIB = $inst_lib
INST_ARCHLIB = $inst_archlib
INST_LIBDIR = \$(INST_LIB)
INST_ARCHLIBDIR = \$(INST_ARCHLIB)
PERLONJAVA_CPAN_PERL5LIB = \$(shell test -f .perlonjava-cpan-perl5lib && cat .perlonjava-cpan-perl5lib)
PERLONJAVA_TEST_PERL5LIB = \$(INST_LIB):\$(INST_ARCHLIB):\$(PERLONJAVA_CPAN_PERL5LIB):\$\$PERL5LIB
$siteprefix_var
INSTALLSITELIB = $installsitelib
NOECHO = \@
Expand Down
Loading