summaryrefslogtreecommitdiff
path: root/t/TEST
diff options
context:
space:
mode:
authorVincent Pit <perl@profvince.com>2009-08-31 18:02:57 +0200
committerVincent Pit <perl@profvince.com>2009-08-31 18:02:57 +0200
commit9324df28556b263f20fee6f11794460ebd71f846 (patch)
tree1eb96ab49cca0eb31df5f161c8efda08421cee95 /t/TEST
parentd1fe220a89ae3a3c1578cd8eaad59ad885769cf4 (diff)
downloadperl-9324df28556b263f20fee6f11794460ebd71f846.tar.gz
Put the chdir logic into the two new helpers _before_fork() and _after_fork()
Diffstat (limited to 't/TEST')
-rwxr-xr-xt/TEST34
1 files changed, 25 insertions, 9 deletions
diff --git a/t/TEST b/t/TEST
index d20f94e02a..ab543f8a1e 100755
--- a/t/TEST
+++ b/t/TEST
@@ -242,6 +242,29 @@ sub _cmd {
return $cmd;
}
+sub _before_fork {
+ my ($options) = @_;
+
+ if ($options->{run_dir}) {
+ my $run_dir = $options->{run_dir};
+ chdir $run_dir or die "Can't chdir to '$run_dir': $!";
+ }
+
+ return;
+}
+
+sub _after_fork {
+ my ($options) = @_;
+
+ if ($options->{return_dir}) {
+ my $return_dir = $options->{return_dir};
+ chdir $return_dir
+ or die "Can't chdir from '$options->{run_dir}' to '$return_dir': $!";
+ }
+
+ return;
+}
+
sub _run_test {
my($harness, $test, $type) = @_;
if (!defined $type) {
@@ -253,20 +276,13 @@ sub _run_test {
$test = $options->{test}; # Might have changed if we're in ext/Foo
- if ($options->{run_dir}) {
- my $run_dir = $options->{run_dir};
- chdir $run_dir or die "Can't chdir to '$run_dir': $!";
- }
+ _before_fork($options);
my $cmd = _cmd($options, $type);
open(my $results, "$cmd |") or print "can't run '$cmd': $!.\n";
- if ($options->{return_dir}) {
- my $return_dir = $options->{return_dir};
- chdir $return_dir
- or die "Can't chdir from '$options->{run_dir}' to '$return_dir': $!";
- }
+ _after_fork($options);
# Our environment may force us to use UTF-8, but we can't be sure that
# anything we're reading from will be generating (well formed) UTF-8