From e7002f2ad0b0ff895de7904e1be20448b28ad5ab Mon Sep 17 00:00:00 2001 From: Neil Bowers Date: Thu, 21 Apr 2022 00:41:24 +0100 Subject: [PATCH] skip tainting tests if perl was built without taint support --- t/07_taint.t | 9 ++++++++- t/10_formatting.t | 22 ++++++++++++++-------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/t/07_taint.t b/t/07_taint.t index b16ef8e..e54532c 100644 --- a/t/07_taint.t +++ b/t/07_taint.t @@ -1,9 +1,16 @@ #!/usr/bin/perl -wT use strict; -use Test::More tests => 13; +use Test::More; use Scalar::Util qw(tainted); use Config; +if (exists($Config{taint_support}) && not $Config{taint_support}) { + plan skip_all => "your perl was built without taint support"; +} +else { + plan tests => 13; +} + my $perl_path = $Config{perlpath}; if ($^O ne 'VMS') { diff --git a/t/10_formatting.t b/t/10_formatting.t index 6887f89..45e1cd3 100644 --- a/t/10_formatting.t +++ b/t/10_formatting.t @@ -1,24 +1,30 @@ #!/usr/bin/perl -wT use strict; use Test::More tests => 5; +use Config; use_ok("IPC::System::Simple","run"); # A formatting bug caused ISS to mention its name twice in # diagnostics. These tests make sure it's fixed. +SKIP: { + if (exists($Config{taint_support}) && not $Config{taint_support}) { + skip("your perl was built without taint support", 2); + } -eval { - run($^X); -}; + eval { + run($^X); + }; -like($@,qr{^IPC::System::Simple::run called with tainted argument},"Taint pkg only once"); + like($@,qr{^IPC::System::Simple::run called with tainted argument},"Taint pkg only once"); -eval { - run(1); -}; + eval { + run(1); + }; -like($@,qr{^IPC::System::Simple::run called with tainted environment},"Taint env only once"); + like($@,qr{^IPC::System::Simple::run called with tainted environment},"Taint env only once"); +} # Delete everything in %ENV so we can't get taint errors.