From: Nicholas Clark Date: Mon, 6 Dec 2004 14:39:59 +0000 (+0000) Subject: sanity check the arguments to runperl(), to try to avoid it X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9a731dbde319d4ad89a923cac3bdf4af379645dc;p=p5sagit%2Fp5-mst-13.2.git sanity check the arguments to runperl(), to try to avoid it hanging waiting on STDIN for a script. p4raw-id: //depot/perl@23615 --- diff --git a/t/test.pl b/t/test.pl index a35eb83..e2edccb 100644 --- a/t/test.pl +++ b/t/test.pl @@ -412,6 +412,12 @@ sub _create_runperl { # Create the string to qx in runperl(). } } elsif (defined $args{progfile}) { $runperl .= qq( "$args{progfile}"); + } else { + # You probaby didn't want to be sucking in from the upstream stdin + die "test.pl:runperl(): none of prog, progs, progfile, args, " + . " switches or stdin specified" + unless defined $args{args} or defined $args{switches} + or defined $args{stdin}; } if (defined $args{stdin}) { # so we don't try to put literal newlines and crs onto the @@ -455,6 +461,8 @@ sub _create_runperl { # Create the string to qx in runperl(). } sub runperl { + die "test.pl:runperl() does not take a hashref" + if ref $_[0] and ref $_[0] eq 'HASH'; my $runperl = &_create_runperl; my $result = `$runperl`; $result =~ s/\n\n/\n/ if $is_vms; # XXX pipes sometimes double these