Hi Roman, On Tue, 19 May 2015 19:42:52 -0700 Roman Parparov <[email protected]> wrote:
> Hi guys, > > I noticed that when I am trying to run a test script using Test::More > (perl -Mblib t/script.t) that has really a lot of tests (over 1M) perl > swells in memory badly. Obviously Test::More is storing the test results > - and I don't need that history. > Is there a way to run it in a lean way, so that only the minimal > statistical footprint is kept in memory? Here are a few ways I can think of: 1. Use subtests - https://metacpan.org/pod/Test::More#subtest - I'm not sure whether this also stores the results of the assertions in the subtest or not, but you should check. 2. If that fails, you can try aggregating tests yourself. For example (Pseudocode and not tested): ««« sub aggregate_test { local $Test::Builder::Level = $Test::Builder::Level + 1; my @failed; foreach my $idx (1 .. 1000) { if (not TEST_FOR_IDX($idx)) { push @failed, $idx; } } return ok( scalar(@failed == 0), ( "Test failures are:" . join(",",@failed[0 .. 3]) ), ); } »»» 3. Another option would be to split the tests into several distinct test scripts. I wrote https://metacpan.org/release/Test-Data-Split for that, but it can also be easily done without it. ====== Hope it helps. Regards, Shlomi Fish > > Thanks, > R. > _______________________________________________ > Perl mailing list > [email protected] > http://mail.perl.org.il/mailman/listinfo/perl -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Best Introductory Programming Language - http://shlom.in/intro-lang There was one Napoleon, one George Washington, and one me! — Big Boy Caprice in http://en.wikiquote.org/wiki/Dick_Tracy_%281990_film%29 Please reply to list if it's a mailing list post - http://shlom.in/reply . _______________________________________________ Perl mailing list [email protected] http://mail.perl.org.il/mailman/listinfo/perl
