Hi all, I am proud to announce Test-Data-Split:
* https://metacpan.org/release/Test-Data-Split * https://github.com/shlomif/perl-Test-Data-Split This is a small Perl module that allows one to automatically generate test files based on data, that can later be run individually or parallelised using prove -j$N . Here's an example. Given this generator file: < CODE > #!/usr/bin/perl use strict; use warnings; use autodie; use FindBin; use lib "$FindBin::Bin/../t/t/lib"; use Test::Data::Split; use FC_Solve::Test::Valgrind; Test::Data::Split->new( { target_dir => 't', filename_cb => sub { my ($self, $args) = @_; return "valgrind--$args->{id}.t"; }, contents_cb => sub { my ($self, $args) = @_; my $id_quoted = quotemeta($args->{id}); return <<"EOF"; #!/usr/bin/perl use strict; use warnings; use Test::More tests => 1; use FC_Solve::Test::Valgrind; # TEST FC_Solve::Test::Valgrind->new->run_valgrind_id_test({ id => qq/$id_quoted/, }); EOF }, data_obj => FC_Solve::Test::Valgrind->new, } )->run; < / CODE > And a FC_Solve::Test::Valgrind module like this one: < CODE > package FC_Solve::Test::Valgrind; use strict; use warnings; use parent 'Test::Data::Split::Backend::Hash'; use Test::More (); use Carp (); use File::Spec (); use File::Temp qw( tempdir ); my %valgrind_tests = ( 'dbm_fc_solver_1' => { prog => "dbm_fc_solver", argv => [ '--offload-dir-path', {type => 'tempdir', }, { type => 'catfile', args => [{ type => 'ENV', arg => 'FCS_SRC_PATH'}, 't', 't', 'data', 'sample-boards', '2freecells-24-mid-with-colons.board' ], } ], blurb => qq{dbm_fc_solver from 24-mid-with-colons.}, }, [snipped] ); sub get_hash { return \%valgrind_tests; } [snipped] sub run_valgrind_id_test { local $Test::Builder::Level = $Test::Builder::Level + 1; my ($self, $args) = @_; my $id = $args->{id}; return _test_using_valgrind($id, $self->lookup_data($id)) } < / CODE > Then I get individual test scripts like: <CODE> #!/usr/bin/perl use strict; use warnings; use Test::More tests => 1; use FC_Solve::Test::Valgrind; # TEST FC_Solve::Test::Valgrind->new->run_valgrind_id_test({ id => qq/board_gen__aisleriot__t_only/, }); </CODE> <CODE> #!/usr/bin/perl use strict; use warnings; use Test::More tests => 1; use FC_Solve::Test::Valgrind; # TEST FC_Solve::Test::Valgrind->new->run_valgrind_id_test({ id => qq/dbm_fc_solver_1/, }); </CODE> Etc. ============= Some plans for the future are: 1. Code several different backends: DBI/SQL, BDB/Google LevelDB , etc. 2. Allow a way to aggregate several IDs into an individual script. 3. Perhaps create an ::Easy interface with more magic. Comments are welcome. Enjoy and Shabbath Shalom. Regards, Shlomi Fish -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Understand what Open Source is - http://shlom.in/oss-fs Chuck Norris can only convince you that you're deceased. Summer Glau can also convince you that you're alive, which is much harder. — http://www.shlomifish.org/humour/bits/facts/Summer-Glau/ Please reply to list if it's a mailing list post - http://shlom.in/reply .