From 0ced3fbba0402eede91b039f18d669806ae5767a Mon Sep 17 00:00:00 2001 From: "Craig A. Berry" Date: Sun, 4 Aug 2024 08:00:32 -0500 Subject: [PATCH 1/2] Don't test fork() when fork() not available --- t/regression/291-async-subtest-done-testing.t | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/t/regression/291-async-subtest-done-testing.t b/t/regression/291-async-subtest-done-testing.t index 3f1cc466..3aabb09e 100644 --- a/t/regression/291-async-subtest-done-testing.t +++ b/t/regression/291-async-subtest-done-testing.t @@ -1,4 +1,11 @@ use Test2::V0; + +BEGIN { + require Config; + skip_all('no fork') + unless ($Config::Config{d_fork} or $Config::Config{d_pseudofork}); +} + use Test2::Tools::AsyncSubtest qw/fork_subtest/; my $st = fork_subtest foo => sub { From 2c4f6f630c7e1c05c10041f176600a20d8e16ee7 Mon Sep 17 00:00:00 2001 From: "Craig A. Berry" Date: Sun, 4 Aug 2024 08:01:55 -0500 Subject: [PATCH 2/2] Avoid list assignment to %ENV It's not portable and isn't needed here, where we only want to override a single element. --- t/modules/Require/AutomatedTesting.t | 3 +-- t/modules/Require/ExtendedTesting.t | 3 +-- t/modules/Require/NonInteractiveTesting.t | 3 +-- t/modules/Require/ReleaseTesting.t | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/t/modules/Require/AutomatedTesting.t b/t/modules/Require/AutomatedTesting.t index b67afadb..274163f1 100644 --- a/t/modules/Require/AutomatedTesting.t +++ b/t/modules/Require/AutomatedTesting.t @@ -1,8 +1,7 @@ use Test2::Bundle::Extended -target => 'Test2::Require::AutomatedTesting'; { - local %ENV = %ENV; - $ENV{AUTOMATED_TESTING} = 0; + local $ENV{AUTOMATED_TESTING} = 0; is($CLASS->skip(), 'Automated test, set the $AUTOMATED_TESTING environment variable to run it', "will skip"); $ENV{AUTOMATED_TESTING} = 1; diff --git a/t/modules/Require/ExtendedTesting.t b/t/modules/Require/ExtendedTesting.t index b69f6893..798fd2fe 100644 --- a/t/modules/Require/ExtendedTesting.t +++ b/t/modules/Require/ExtendedTesting.t @@ -1,8 +1,7 @@ use Test2::Bundle::Extended -target => 'Test2::Require::ExtendedTesting'; { - local %ENV = %ENV; - $ENV{EXTENDED_TESTING} = 0; + local $ENV{EXTENDED_TESTING} = 0; is($CLASS->skip(), 'Extended test, set the $EXTENDED_TESTING environment variable to run it', "will skip"); $ENV{EXTENDED_TESTING} = 1; diff --git a/t/modules/Require/NonInteractiveTesting.t b/t/modules/Require/NonInteractiveTesting.t index 6019625d..8fadc5cf 100644 --- a/t/modules/Require/NonInteractiveTesting.t +++ b/t/modules/Require/NonInteractiveTesting.t @@ -1,8 +1,7 @@ use Test2::Bundle::Extended -target => 'Test2::Require::NonInteractiveTesting'; { - local %ENV = %ENV; - $ENV{NONINTERACTIVE_TESTING} = 0; + local $ENV{NONINTERACTIVE_TESTING} = 0; is($CLASS->skip(), 'NonInteractive test, set the $NONINTERACTIVE_TESTING environment variable to run it', "will skip"); $ENV{NONINTERACTIVE_TESTING} = 1; diff --git a/t/modules/Require/ReleaseTesting.t b/t/modules/Require/ReleaseTesting.t index c6981867..08dad254 100644 --- a/t/modules/Require/ReleaseTesting.t +++ b/t/modules/Require/ReleaseTesting.t @@ -1,8 +1,7 @@ use Test2::Bundle::Extended -target => 'Test2::Require::ReleaseTesting'; { - local %ENV = %ENV; - $ENV{RELEASE_TESTING} = 0; + local $ENV{RELEASE_TESTING} = 0; is($CLASS->skip(), 'Release test, set the $RELEASE_TESTING environment variable to run it', "will skip"); $ENV{RELEASE_TESTING} = 1;