pileofrogs has asked for the wisdom of the Perl Monks concerning the following question:

I've written a module, Unix::SavedIDs, that's mouldering in alfa. One of the things that keeps bugging me, but I only just realised consciously is about polite testing practices.

Basically, my module is for people who want to drop root privileges completely. To test, I make a root-owned file in /tmp and try to overwrite it later after dropping privileges. (Okay, that's a massive oversimplification, see the mod above for details if you're curious.) I currently ask the user, but that's a pain during CPAN installs of multiple modules.

Is it polite to make files in people's /tmp dir as part of a test?

Thanks!

--Pileofrogs

Replies are listed 'Best First'.
Re: CPAN Module Testing Etiquette?
by Corion (Patriarch) on Feb 02, 2009 at 19:21 UTC

    Personally, I prefer it if you use File::Temp to create your temp files, because that works everywhere, and not only where there exists /tmp. In addition, your module becomes testable in situations where there are multiple tests running concurrently.

Re: CPAN Module Testing Etiquette?
by JavaFan (Canon) on Feb 02, 2009 at 20:32 UTC
    To test, I make a root-owned file in /tmp
    That of course can only be done if 'make test' is run as root. You ought to make this clear in the README. Furthermore, you ought to skip the test (with an appropriate message) if make test isn't run as root, and not fail.