On Mon, 28 Jul 2003, David Wheeler wrote:
On Monday, July 28, 2003, at 06:33 PM, Randy Kobes wrote:
What about just skipping the tests if root is running the tests, and printing out an explanatory message why the tests are skipped?
I don't think you can necessarily do this, because not all test need to have access to t/. My test suite for MasonX::ApacheHandler::WithCallbacks, for example, doesn't need to have the Apache user access those files. They're loaded up by the user that starts apache (root), and then the process forks off to nobody-owned children that never access the files. So my tests work fine even under root.
That's a good point ... As you say below, it'd be better for the test writer to decide on an individual basis which tests should be skipped if run as root.
this means 99.9% tests in mod_perl 2.0. But we really want to have users run the tests. Otherwise what's the point of having a test suite. If things are potentially wrong on a user's system we want him to know about it as early as possible and not by trial and error with their own code.
I'd suggest to first try to find a real solution so the tests could be run under root as well. copying -r ./t to /tmp seems to me like a possible solution, even though an ugly one.
And since many, _many_ users simply install modules via CPAN.pm as root, you'd be eliminating a huge group of people who can run tests.
That's true, although that practice is discouraged ... I think this issue has come up in the context of other CPAN modules, where some do skip tests if run as root, for similar reasons - some tests aren't designed for being run as root, and in principle may give false positive (or negative) results if run as such.
the practice was/is discouraged where the problem wasn't dealt with. I'd love to see it solved and make it transparent for the user.
I think a better idea is to introduce a test function like "have_lwp", maybe called "has_access_to_t", that can be used by the module developer to skip the relevant tests, if necessary.
I think we can do it better.
__________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com