Subject: | [PATCH] Skip test using fork() when fork() is not available |
The t/Smtpsend.t test uses fork() and therefore fails when using a perl
which does not have fork() implemented, e.g. on a Windows system when
perl is built without PERL_IMPLICIT_SYS defined.
The attached patch arranges for all the tests to be skipped in this
case, using an idiom borrowed from a fork() test in Test-Simple, and
also checking for (the fairly recentlt added) d_pseudofork option too.
Subject: | MIME-tools-fork.patch |
diff -ruN MIME-tools-5.502.orig/t/Smtpsend.t MIME-tools-5.502/t/Smtpsend.t
--- MIME-tools-5.502.orig/t/Smtpsend.t 2008-09-22 21:54:52.000000000 +0100
+++ MIME-tools-5.502/t/Smtpsend.t 2012-05-22 08:50:25.226816300 +0100
@@ -1,7 +1,18 @@
#!/usr/bin/perl -w
use strict;
use warnings;
-use Test::More tests => 9;
+use Config;
+use Test::More;
+my $can_fork = $Config{d_fork} || $Config{d_pseudofork} ||
+ (($^O eq 'MSWin32' || $^O eq 'NetWare') and
+ $Config{useithreads} and
+ $Config{ccflags} =~ /-DPERL_IMPLICIT_SYS/);
+if ($can_fork) {
+ plan tests => 9;
+}
+else {
+ plan skip_all => 'This system cannot fork';
+}
use MIME::Tools;
use MIME::Entity;