Test::Lintian::Harness (3)
Leading comments
Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) Standard preamble: ========================================================================
NAME
Test::Lintian::Harness -- Helper tools for t/runtestsSYNOPSIS
use Test::Lintian::Harness qw(up_to_date); if (not up_to_date('some/build-stamp', 'some/dir')) { # do rebuild }
DESCRIPTION
Helper functions for t/runtests.FUNCTIONS
- skip_reaon(SKIP_FILE)
-
Return the (human-readable) reason for skipping a test by reading the
SKIP_FILE.
- copy_template_dir(SKEL_DIR, TEST_SRC_DIR, TEST_TARGET_DIR,[EXCL_SKEL[,EXCL_SRC]])
-
Populate TEST_TARGET_DIRwith files/dirs fromSKEL_DIRandTEST_SRC_DIR.If given,EXCL_SKELandEXCL_SRCmust be a listref containing rsync ``--exclude'' options.
- runsystem(CMD...)
-
Run CMDvia system, but throw an error ifCMDdoes not return 0.
- runsystem_ok(CMD...)
-
Run CMDvia system, but throw an error ifCMDdoes not return 0 or 1.
Returns 1 if
CMDreturned successfully (i.e. 0), otherwise 0.This is mostly useful for running Lintian, which may return 0 or 1 on ``success''.
- up_to_date(STAMPFILE,DIR[,RUNNER_TS])
-
Returns true if the mtime of STAMPFILEis greater than or equal to the mtime of all files inDIR.IfRUNNER_TSis given, then the mtime ofSTAMPFILEmust also be greater than or equal to the value ofRUNNER_TS.
If
STAMPFILEdoes not exist, this function returns false unconditionally. - check_test_depends(TESTDATA)
-
Given a TESTDATAwith a dependency requirement, check whether the dependency requirement is satisfied. If satisfied, return "undef", otherwise return a (human-readable) string containing the missing dependencies.
- read_test_desc(FILENAME)
-
Parse FILENAMEas a test description file, do a quick validation of its contents and return it in a hashref. This is similar get_dsc_control (DSCFILE) except for the extra validation.
- fill_in_tmpl(FILE, DATA)
-
Create FILEusing ``${FILE}.in'' as a template andDATAas template data.
- chdir_runcmd(DIR,CMD_REF[,LOG_FILE])
-
Fork, chdir to DIRand exec the command (plus arguments) contained inCMD_REF.The child process'sSTDERRis merged into itsSTDOUT.TheSTDOUTstream of the child process is either directed to the path denoted byLOG_FILE(if given and not "undef") or to /dev/null.
Returns 0 on success and non-zero otherwise.
- is_tag_in_file(TAGNAME, FILENAME)
-
Returns true if FILENAMEappears to be output from Lintian, which emittedTAGNAMEfrom that run.
- find_tests_for_tag(TAGNAME, GLOB_EXPR)
-
Find checks for the Lintian tag denoted by TAGNAMEthat match theGLOB_EXPR.Note thatGLOB_EXPRmust match only the ``desc'' file of the tests.
This function returns a list of the test-data for each of these tests.
- generic_find_test_for_tag(TAGNAME,GLOB_EXPR[,TCODE])
-
Looks for TAGNAMEin all files returned by using glob onGLOB_EXPR. TCODEis called for each file withTAGNAMEas first argument and the filename as second argument.TCODEis expected to return a truth value that if the test should be run. IfTCODEreturns something that is not just a raw truth value (e.g. a hash ref), this will be taken as the ``test'', otherwise this sub will attempt to guess the test name from the file.
If
TCODEis omitted, ``is_tag_in_file(TAGNAME, FILENAME)'' will be used.Returns a list of values returned by
TCODEor guessed test names (as per above)