Dear Monks,

I'm writing a module that, among other things, writes logs to a file. Logs are kept in a subdirectory of /var/log, so the program can run as user (the subdirectory has the proper permissions). In the development environment all was good, since at the beginning I manually created the directory and set its permissions. Nevertheless, when installing the module in another machine, I found that the tests failed because when the module was going to write something to the logs, the directory didn't exist. Creating it manually wasn't an option, since that's make install responsibility. I needed make install /before/ make test...

A quick search through the monastery led me to testing log messages, and I decided to follow that route. I hadn't any problem and now the tests pass even when no logs are actually created.

However, I'd be surprised if I'd found the best solution in a 15 minute search ;^). Does a better option exist? (for any meaning of "better").

--
David Serrano


In reply to Testing a module that writes logs to a file by Hue-Bond

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.