Ovid wrote: >> Why not just load Perl once and fork for the execution of each test >> script. You can pre-load modules before you fork. > > Forking is also more likely to be used for parallelization. Often code > requires sweeping changes before it can be run in parallel. So this > means we're reduced to running the code sequentially and forking > doesn't offer a huge advantage and can mask hidden state assumptions > like when naughty code is munging globals such as filehandles or > built-in globals.
> Also, since forking is only emulated on Windows, it's not reliable > (I've had it crash and burn more than once). I prefer to avoid writing > modules that are limited to specific platforms. > > (I'm not saying forking is a bad solution, just a different one). > > Finally, Test::Aggregate is designed to have tests run with minimal > changes. For many tests, just move them to the aggregate directory. > No worries about which modules to preload or anything like that. > > Finally, if you think my code is such a bad idea, I'm sure folks would > welcome alternatives. Nono, I was just wondering why that approach, it just seemed quite odd. You've now explained that quite nicely. Actually a large part of my initial reaction was due to the use of the word "concatenation". Looking at the module documentation I see that it's not anywhere near as simplistic as that. Aggregating tests is something that I do a lot of, it's just that normally I'm writing data driven tests - and on larger code bases the module load time can end up taking a non-trivial time. I only care about loading the modules as a part of the test for the first couple of tests; the other ones I just use Test::Depends or something to skip if that module fails to load. So, in the general case I can probably pre-load the lib/ modules for all but a few specially marked tests. However the usual problematic boundary between the harness and the test is there. How do you solve this for Test::Aggregate, is it by making it one test at the TAP level for each aggregated test? Sam