-
Couldn't load subscription status.
- Fork 26
Description
Given the following stripped down example:
lib/MyExpensive.pm:
package MyExpensive;
sleep 1;
1;lib/MyPreload.pm:
package MyPreload;
use Test2::Harness::Runner::Preload;
stage DEFAULT => sub { default; preload 'MyExpensive' };
1;t/foo.t:
use Test2::V0 -target => 'MyExpensive';
ok $ENV{T2_HARNESS_PRELOAD};
done_testing;Running the tests with preload shows everything passes and the extra second isn't attributed to the test's "startup" cost:
$ yath test -TP MyPreload
( PASSED ) job 1 t/foo.t
( TIME ) job 1 Startup: 0.04258s | Events: 0.00018s | Cleanup: 0.00407s | Total: 0.04683s
However if we add a tainting shebang to the test file:
#!perl -T
use Test2::V0 -target => 'MyExpensive';
ok $ENV{T2_HARNESS_PRELOAD};
done_testing;Then the test fails and takes longer:
$ yath test -TP MyPreload
[ FAIL ] job 1 + <UNNAMED ASSERTION>
( DIAG ) job 1 Failed test at t/foo.t line 5.
( DIAG ) job 1 Seeded srand with seed '20230215' from local date.
( FAILED ) job 1 t/foo.t
( TIME ) job 1 Startup: 1.08933s | Events: 0.00030s | Cleanup: 0.00322s | Total: 1.09285s
Now imagine that you have hundreds of tests, all with tainting enabled and lots of expensive libraries that take seconds to load, suddenly you're in my situation where $WORK's codebase takes tens of minutes to test :-(
I thought this was a regression since I'm sure this used to work but I've yet to find a version where it works correctly.
I appreciate this is hard to make work as you can only adjust the taint mode at perl startup time and the worker you're forking doesn't have it enabled so can we either have multiple workers based on the set of interpreter flags we see in test files? Or an ugly hack to run all of yath under taint worker and all.