WIP: Add parallel test execution to jcpan (-j flag)#426
Merged
Conversation
Add -j N option to jcpan for running CPAN module tests in parallel. This leverages TAP::Harness built-in parallel execution support via the HARNESS_OPTIONS environment variable. Key changes: - jcpan/jcpan.bat: Parse -j N flag, export HARNESS_OPTIONS=jN - TAP::Parser::Iterator::Process: Enable IO::Select on pipe handles even without IPC::Open3 (which requires fork). This allows the TAP::Parser::Multiplexer to use select-based I/O multiplexing for parallel test execution on PerlOnJava. Usage: jcpan -j 4 -t Module::Name # Run tests with 4 parallel jobs jcpan -t Module::Name # Sequential (default, unchanged) Tested with Path::Tiny (30 test files): Sequential: 36s wall clock Parallel -j 4: 18.5s wall clock (about 2x speedup) Generated with Devin (https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Fix the dependency chain for DateTime::Format::ICal on PerlOnJava: - CPAN::Distribution: Fix chained shebang issue where ./Build is executed by bash instead of jperl (jperl is a bash wrapper, so the kernel cannot chain shebangs). Use $^X Build when archname contains java. Also fix install path which bypasses _build_command() and uses mbuild_install_build_command from CPAN config. - Module::Build::Base: Auto-enable pureperl_only when a module declares allow_pureperl and no C compiler is available. This lets modules like Params::Validate build their pure-Perl backend without trying (and failing) to compile XS code. - Devel::Peek stub: Minimal stub providing SvREFCNT() (returns 1, since JVM uses tracing GC) and Dump(). Needed as test_requires dependency for Params::Validate. Result: jcpan -j 4 -t DateTime::Format::ICal passes all 134 tests. Generated with Devin (https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
a22c3cd to
2d047cb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add parallel test execution to
jcpanand fix the Module::Build dependency chain for DateTime::Format::ICal.Parallel test execution (
-j Nflag)jcpan/jcpan.bat: Parse-j N, exportHARNESS_OPTIONS=jNTAP::Parser::Iterator::Process: EnableIO::Selecton pipe handles in the non-fork fallback path, allowing theTAP::Parser::Multiplexerto useselect()-based I/O multiplexingBenchmark (Path::Tiny, 30 test files): 36s sequential -> 18.5s with
-j 4(~2x speedup)Module::Build chained shebang fix
CPAN::Distribution:./Buildrelies on chained shebangs which don't work when jperl is a bash wrapper script. Fixed_build_command()and the install path to use$^X Buildwhenarchnamecontainsjava.Module::Build auto-pureperl
Module::Build::Base: Auto-enablepureperl_onlywhen a module declaresallow_pureperland no C compiler is available. Modules like Params::Validate now build their pure-Perl backend instead of failing on XS compilation.Devel::Peek stub
SvREFCNT()(returns 1 — JVM uses tracing GC) andDump(). Needed astest_requiresfor Params::Validate.Result
Files changed
jcpan-j N, exportHARNESS_OPTIONSjcpan.batTAP::Parser::Iterator::ProcessCPAN::Distribution$^X Buildinstead of./Buildon PerlOnJavaModule::Build::BaseDevel::Peekdev/modules/datetime_format_ical.mdTest plan
makepasses (all unit tests)jprove -j 4works with unit testsjcpan -j 4 -t Path::Tinysame results as sequentialjcpan -j 4 -t DateTime::Format::ICal— all 134 tests passjcpan -f -i Params::Validateinstalls successfullyjcpan -f -i DateTime::Setinstalls and tests passGenerated with Devin