You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Fred Moyer <fr...@redhotpenguin.com> on 2010/04/19 22:30:34 UTC

[patch] Skip tests if run by root user on non-Win32

A number of test failures on Apache::Test 1.32 come from tests being
skipped as root user:

http://www.cpantesters.org/distro/A/Apache-Test.html#Apache-Test-1.32

This patch should turn those failures into unknowns, which seems to be
the desired behavior when the test suite cannot be run.

Feedback welcome, I've dealt with some of stuff in this area before,
but am not a guru there yet.

Index: Makefile.PL
===================================================================
--- Makefile.PL (revision 935715)
+++ Makefile.PL (working copy)
@@ -223,3 +223,27 @@
         $string;
     };
 }
+
+sub MY::test {
+    my $self = shift;
+
+    # run tests normally if non root user
+    return $self->Apache::TestMM::test(@_) if (($> != 0) # root user
+                            or ($^O eq 'MSWin32'));
# or win32
+
+    return <<EOF
+test::
+\t\@echo
+\t\@echo Apache::Test tests cannot be run as the root user.
+\t\@echo Apache cannot spawn child processes as 'root', therefore
+\t\@echo we attempt to run the test suite with a non privileged user.
+\t\@echo The problem is that the Apache::Test build directory must be 'rwx',
+\t\@echo so Apache can read and write under that path.
+\t\@echo There are several ways to resolve this issue. One is to move and
+\t\@echo rebuild the distribution to '/tmp/' and repeat the 'make test' phase.
+\t\@echo The other is not to run 'make test' as root, i.e. building
+\t\@echo under your /home/user directory.
+\t\@echo
+EOF
+}
+

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org