Abe Timmerman > Test-Smoke > Test::Smoke::Util



Annotate this POD


New  15
Open  4
Stalled  1
View/Report Bugs
Module Version: 0.58   Source   Latest Release: Test-Smoke-1.61_03


Test::Smoke::Util - Take out some of the functions of the smoke suite.


I've taken out some of the general stuff and put it here. Now I can write some tests!

Configure_win32( $command[, $win32_maker[, @args]] )

Configure_win32() alters the settings of the makefile for MSWin32.

$command is in the form of './Configure -des -Dusedevel ...'

$win32_maker should either be nmake or dmake, the default is nmake.

@args is a list of option=value pairs that will (eventually) be passed to Config.pm.

PLEASE read README.win32 and study the comments in the makefile.

It supports these options:

set_vms_rooted_logical( $logical, $dir )

This will set a VMS rooted logical like:

    define/translation=concealed $logical $dir

get_cfg_filename( )

get_cfg_filename() tries to find a cfg file and returns it.

read_logfile( )

Read the logfile. If an argument is passed, force to (re)read the log If no argument is passed, return the stored log if available otherwise read the logfile

grepccmsg( $cc, $logfile, $verbose )

This is a port of Jarkko Hietaniemi's grepccerr script.

get_local_patches( $ddir )

get_local_patches() reads patchlevel.h to scan for the locally applied patches array.

set_local_patch( $ddir, @descr )

Copy the code from patchlevel.h. Older (pre 5.8.1) perls do not have it and it doesn't work on MSWin32.

get_config( $filename )

Read and parse the configuration from file, or return the default config.

get_patch( [$ddir] )

Try to find the patchlevel, look for .patch or try to get it from patchlevel.h as a fallback.

version_from_patchlevel_h( $ddir )

version_from_patchlevel_h() returns a "dotted" version as derived from the patchlevel.h file in the distribution.

get_ncpu( $osname )

get_ncpu() returns the number of available (online/active/enabled) CPUs.

It does this by using some operating system specific trick (usually by running some external command and parsing the output).

If it cannot recognize your operating system an empty string is returned. If it can recognize it but the external command failed, "? cpus" is returned.

In the first case (where we really have no idea how to proceed), also a warning (get_ncpu: unknown operating system) is sent to STDERR.


If you get the warning get_ncpu: unknown operating system, you will need to help us-- how does one tell the number of available CPUs in your operating system? Sometimes there are several different ways: please try to find the fastest one, and a one that does not require superuser (administrator) rights.

Thanks to Jarkko Hietaniemi for donating this!

get_smoked_Config( $dir, @keys )

get_smoked_Config() returns a hash (a listified hash) with the specified keys. It will try to find lib/Config.pm to get those values, if that cannot be found (make error?) we can try config.sh which is used to build lib/Config.pm. If config.sh is not there (./Configure error?) we try to get some fallback information from POSIX::uname() and patchlevel.h.

parse_report_Config( $report )

parse_report_Config() returns a list attributes from a smoke report.

    my( $version, $plevel, $os, $osvers, $archname, $summary, $branch ) = 
        parse_report_Config( $rpt );

get_regen_headers( $ddir )

get_regen_headers() looks in $ddir to find either regen_headers.pl or regen.pl (change 18851).

Returns undef if not found or a string like $^X "$regen_headers_pl"

run_regen_headers( $ddir, $verbose );

run_regen_headers() gets its executable from get_regen_headers() and opens a pipe from it. warn()s on error.

whereis( $prog )

Try to find an executable instance of $prog in $ENV{PATH}.

Rreturns a full file-path (with extension) to it.

vms_whereis( $prog )

First look in the SYMBOLS to see if $prog is there. Next look in the KFE-table INSTALL LIST if it is there. As a last resort we can scan DCL$PATH like we do on *nix/Win32

clean_filename( $fname )

clean_filename() basically returns a vmsify() type of filename for VMS, and returns an upcase filename for case-ignorant filesystems.

calc_timeout( $killtime[, $from] )

calc_timeout() calculates the timeout in seconds. $killtime can be one of two formats:


This format represents a duration and is the easy format as we only need to translate that to seconds.


This format represents a clock time (localtime). Calculate minutes from midnight for both $killtime and localtime($from), and get the difference. If $from is omitted, time() is used.

If $killtime is the actual time, the timeout will be 24 hours!

time_in_hhmm( $diff )

Create a string telling elapsed time in days, hours, minutes, seconds from the number of seconds.

do_pod2man( %pod2usage_options )

If Pod::Usage is there then call its pod2usage(). In the other case, print the general message passed with the myusage key.

skip_config( $config )

Returns true if this config should be skipped. $config should be a Test::Smoke::BuildCFG::Config object.

skip_filter( $line )

skip_filter() returns true if the filter rules apply to $line.


(c) 2001-2003, All rights reserved.

  * H. Merijn Brand <h.m.brand@hccnet.nl>
  * Nicholas Clark <nick@unfortu.net>
  * Jarkko Hietaniemi <jhi@iki.fi>
  * Abe Timmerman <abeltje@cpan.org>



  * <http://www.perl.com/perl/misc/Artistic.html>,
  * <http://www.gnu.org/copyleft/gpl.html>


syntax highlighting: