Subject: | [PATCH] Improve parallel testing |
Attached patch improves parallel testing by using a process specific testdir/test$$lib.
--
Reini Urban
Subject: | Pod-HTML-testing.patch |
Improved parallel testing, relative F<testdir/test$$lib>
diff --git ext/Pod-Html/t/crossref.t ext/Pod-Html/t/crossref.t
index bc033c4..4b4e701 100644
--- ext/Pod-Html/t/crossref.t
+++ ext/Pod-Html/t/crossref.t
@@ -1,11 +1,8 @@
#!/usr/bin/perl -w # -*- perl -*-
+our $testlib;
BEGIN {
- require "t/pod2html-lib.pl";
-}
-
-END {
- rem_test_dir();
+ require "./t/pod2html-lib.pl";
}
use strict;
@@ -24,7 +21,7 @@ SKIP: {
convert_n_test("crossref", "cross references",
"--podpath=". File::Spec::Unix->catdir($relcwd, 't') . ":"
- . File::Spec::Unix->catdir($relcwd, 'testdir/test.lib'),
+ . File::Spec::Unix->catdir($relcwd, $testlib),
"--podroot=". catpath($v, '/', ''),
"--quiet",
);
@@ -68,15 +65,15 @@ __DATA__
<p><a href="#non-existent-section">"non existent section"</a></p>
-<p><a href="/[RELCURRENTWORKINGDIRECTORY]/testdir/test.lib/var-copy.html">var-copy</a></p>
+<p><a href="/[RELCURRENTWORKINGDIRECTORY]/[TESTLIBDIR]/var-copy.html">var-copy</a></p>
-<p><a href="/[RELCURRENTWORKINGDIRECTORY]/testdir/test.lib/var-copy.html#pod">"$"" in var-copy</a></p>
+<p><a href="/[RELCURRENTWORKINGDIRECTORY]/[TESTLIBDIR]/var-copy.html#pod">"$"" in var-copy</a></p>
<p><code>var-copy</code></p>
<p><code>var-copy/$"</code></p>
-<p><a href="/[RELCURRENTWORKINGDIRECTORY]/testdir/test.lib/podspec-copy.html#First">"First:" in podspec-copy</a></p>
+<p><a href="/[RELCURRENTWORKINGDIRECTORY]/[TESTLIBDIR]/podspec-copy.html#First">"First:" in podspec-copy</a></p>
<p><code>podspec-copy/First:</code></p>
diff --git ext/Pod-Html/t/crossref2.t ext/Pod-Html/t/crossref2.t
index 70eae7e..1bb9957 100644
--- ext/Pod-Html/t/crossref2.t
+++ ext/Pod-Html/t/crossref2.t
@@ -1,13 +1,10 @@
#!/usr/bin/perl -w # -*- perl -*-
+our $testlib;
BEGIN {
require "t/pod2html-lib.pl";
}
-END {
- rem_test_dir();
-}
-
use strict;
use Cwd;
use Test::More tests => 1;
@@ -19,7 +16,7 @@ SKIP: {
my $cwd = Pod::Html::_unixify(cwd());
convert_n_test("crossref", "cross references",
- "--podpath=t:testdir/test.lib",
+ "--podpath=t:$testlib",
"--podroot=$cwd",
"--htmldir=$cwd",
"--quiet",
@@ -64,15 +61,15 @@ __DATA__
<p><a href="#non-existent-section">"non existent section"</a></p>
-<p><a href="../testdir/test.lib/var-copy.html">var-copy</a></p>
+<p><a href="../[TESTLIBDIR]/var-copy.html">var-copy</a></p>
-<p><a href="../testdir/test.lib/var-copy.html#pod">"$"" in var-copy</a></p>
+<p><a href="../[TESTLIBDIR]/var-copy.html#pod">"$"" in var-copy</a></p>
<p><code>var-copy</code></p>
<p><code>var-copy/$"</code></p>
-<p><a href="../testdir/test.lib/podspec-copy.html#First">"First:" in podspec-copy</a></p>
+<p><a href="../[TESTLIBDIR]/podspec-copy.html#First">"First:" in podspec-copy</a></p>
<p><code>podspec-copy/First:</code></p>
diff --git ext/Pod-Html/t/crossref3.t ext/Pod-Html/t/crossref3.t
index cfa0abc..2337cad 100644
--- ext/Pod-Html/t/crossref3.t
+++ ext/Pod-Html/t/crossref3.t
@@ -1,13 +1,10 @@
#!/usr/bin/perl -w # -*- perl -*-
+our $testlib;
BEGIN {
require "t/pod2html-lib.pl";
}
-END {
- rem_test_dir();
-}
-
use strict;
use Cwd;
use Test::More tests => 1;
@@ -19,7 +16,7 @@ SKIP: {
my $cwd = cwd();
convert_n_test("crossref", "cross references",
- "--podpath=t:testdir/test.lib",
+ "--podpath=t:$testlib",
"--podroot=$cwd",
"--htmlroot=$cwd",
"--quiet",
@@ -64,15 +61,15 @@ __DATA__
<p><a href="#non-existent-section">"non existent section"</a></p>
-<p><a href="[ABSCURRENTWORKINGDIRECTORY]/testdir/test.lib/var-copy.html">var-copy</a></p>
+<p><a href="[ABSCURRENTWORKINGDIRECTORY]/[TESTLIBDIR]/var-copy.html">var-copy</a></p>
-<p><a href="[ABSCURRENTWORKINGDIRECTORY]/testdir/test.lib/var-copy.html#pod">"$"" in var-copy</a></p>
+<p><a href="[ABSCURRENTWORKINGDIRECTORY]/[TESTLIBDIR]/var-copy.html#pod">"$"" in var-copy</a></p>
<p><code>var-copy</code></p>
<p><code>var-copy/$"</code></p>
-<p><a href="[ABSCURRENTWORKINGDIRECTORY]/testdir/test.lib/podspec-copy.html#First">"First:" in podspec-copy</a></p>
+<p><a href="[ABSCURRENTWORKINGDIRECTORY]/[TESTLIBDIR]/podspec-copy.html#First">"First:" in podspec-copy</a></p>
<p><code>podspec-copy/First:</code></p>
diff --git ext/Pod-Html/t/feature2.t ext/Pod-Html/t/feature2.t
index 0cc0072..91a31c6 100644
--- ext/Pod-Html/t/feature2.t
+++ ext/Pod-Html/t/feature2.t
@@ -1,8 +1,8 @@
#!/usr/bin/perl -w # -*- perl -*-
-
+our $testlib;
BEGIN {
- require "t/pod2html-lib.pl";
+ require "./t/pod2html-lib.pl";
}
use strict;
@@ -26,9 +26,9 @@ convert_n_test("feature2", "misc pod-html features 2",
like($warn,
qr(
- \Acaching\ directories\ for\ later\ use\n
+ caching\ directories\ for\ later\ use\n
Converting\ input\ file\ \S+[/\\\]]feature2\.pod\n\z
- )x,
+ )mx,
"misc pod-html --verbose warnings");
__DATA__
diff --git ext/Pod-Html/t/htmldir1.t ext/Pod-Html/t/htmldir1.t
index 6a0857b..b3c45de 100644
--- ext/Pod-Html/t/htmldir1.t
+++ ext/Pod-Html/t/htmldir1.t
@@ -1,13 +1,10 @@
#!/usr/bin/perl -w # -*- perl -*-
+our $testlib;
BEGIN {
require "t/pod2html-lib.pl";
}
-END {
- rem_test_dir();
-}
-
use strict;
use Cwd;
use File::Spec::Functions;
@@ -30,7 +27,7 @@ SKIP: {
convert_n_test("htmldir1", "test --htmldir and --htmlroot 1a",
"--podpath=". File::Spec::Unix->catdir($relcwd, 't') . ":"
- . File::Spec::Unix->catdir($relcwd, 'testdir/test.lib'),
+ . File::Spec::Unix->catdir($relcwd, $testlib),
"--podroot=". catpath($v, '/', ''),
"--htmldir=t",
"--quiet",
@@ -76,7 +73,7 @@ __DATA__
<p>Normal text, a <a>link</a> to nowhere,</p>
-<p>a link to <a href="/[RELCURRENTWORKINGDIRECTORY]/testdir/test.lib/var-copy.html">var-copy</a>,</p>
+<p>a link to <a href="/[RELCURRENTWORKINGDIRECTORY]/[TESTLIBDIR]/var-copy.html">var-copy</a>,</p>
<p><a href="/[RELCURRENTWORKINGDIRECTORY]/t/htmlescp.html">htmlescp</a>,</p>
diff --git ext/Pod-Html/t/htmldir3.t ext/Pod-Html/t/htmldir3.t
index 8006bf0..26db85e 100644
--- ext/Pod-Html/t/htmldir3.t
+++ ext/Pod-Html/t/htmldir3.t
@@ -70,7 +70,7 @@ __DATA__
<p>Normal text, a <a>link</a> to nowhere,</p>
-<p>a link to <a href="[RELCURRENTWORKINGDIRECTORY]/testdir/test.lib/var-copy.html">var-copy</a>,</p>
+<p>a link to <a href="[RELCURRENTWORKINGDIRECTORY]/[TESTLIBDIR]/var-copy.html">var-copy</a>,</p>
<p><a href="[RELCURRENTWORKINGDIRECTORY]/t/htmlescp.html">htmlescp</a>,</p>
diff --git ext/Pod-Html/t/htmldir5.t ext/Pod-Html/t/htmldir5.t
index 820590f..a397153 100644
--- ext/Pod-Html/t/htmldir5.t
+++ ext/Pod-Html/t/htmldir5.t
@@ -1,13 +1,10 @@
#!/usr/bin/perl -w # -*- perl -*-
+our $testlib;
BEGIN {
require "t/pod2html-lib.pl";
}
-END {
- rem_test_dir();
-}
-
use strict;
use Cwd;
use File::Spec::Functions;
@@ -24,7 +21,7 @@ SKIP: {
# this?
convert_n_test("htmldir5", "test --htmldir and --htmlroot 5",
- "--podpath=t:testdir/test.lib",
+ "--podpath=t:$testlib",
"--podroot=$cwd",
"--htmldir=$cwd",
"--htmlroot=/",
@@ -59,7 +56,7 @@ __DATA__
<p>Normal text, a <a>link</a> to nowhere,</p>
-<p>a link to <a href="../testdir/test.lib/var-copy.html">var-copy</a>,</p>
+<p>a link to <a href="../[TESTLIBDIR]/var-copy.html">var-copy</a>,</p>
<p><a href="./htmlescp.html">htmlescp</a>,</p>
diff --git ext/Pod-Html/t/pod2html-lib.pl ext/Pod-Html/t/pod2html-lib.pl
index 27e3e94..e2d9078 100644
--- ext/Pod-Html/t/pod2html-lib.pl
+++ ext/Pod-Html/t/pod2html-lib.pl
@@ -5,27 +5,33 @@ use File::Spec::Functions ':ALL';
use File::Path 'remove_tree';
use File::Copy;
-# make_test_dir and rem_test_dir dynamically create and remove testdir/test.lib.
+our $testlib = "testdir/test$$.lib";
+
+END {
+ rem_test_dir();
+}
+
+# make_test_dir and rem_test_dir dynamically create and remove testdir/test$$.lib.
# it is created dynamically to pass t/filenames.t, which does not allow '.'s in
# filenames as '.' is the directory separator on VMS. All tests that require
# testdir/test.lib to be present are skipped if test.lib cannot be created.
sub make_test_dir {
- if (-d 'testdir/test.lib') {
- warn "Directory 'test.lib' exists (it shouldn't yet) - removing it";
+ if (-d $testlib) {
+ warn "Directory \"$testlib\" exists (it shouldn't yet) - removing it";
rem_test_dir();
}
- mkdir('testdir/test.lib') or return "Could not make test.lib directory: $!\n";
- copy('testdir/perlpodspec-copy.pod', 'testdir/test.lib/podspec-copy.pod')
+ mkdir($testlib) or return "Could not make $testlib directory: $!\n";
+ copy('testdir/perlpodspec-copy.pod', "testdir/$testlib/podspec-copy.pod")
or return "Could not copy perlpodspec-copy: $!";
- copy('testdir/perlvar-copy.pod', 'testdir/test.lib/var-copy.pod')
+ copy('testdir/perlvar-copy.pod', "testdir/$testlib/var-copy.pod")
or return "Could not copy perlvar-copy: $!";
return 0;
}
sub rem_test_dir {
- return unless -d 'testdir/test.lib';
- remove_tree('testdir/test.lib')
- or warn "Error removing temporary directory 'testdir/test.lib'";
+ return unless -d $testlib;
+ remove_tree($testlib)
+ or warn "Error removing temporary directory '$testlib'";
}
sub convert_n_test {
@@ -61,7 +67,8 @@ sub convert_n_test {
$expect =~ s/\[PERLADMIN\]/$Config::Config{perladmin}/;
$expect =~ s/\[RELCURRENTWORKINGDIRECTORY\]/$relcwd/g;
$expect =~ s/\[ABSCURRENTWORKINGDIRECTORY\]/$cwd/g;
+ $expect =~ s|\[TESTLIBDIR\]|$testlib|g;
if (ord("A") == 193) { # EBCDIC.
$expect =~ s/item_mat_3c_21_3e/item_mat_4c_5a_6e/;
}