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 gmake, the default is nmake.

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

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

It supports these options:

  • -Duseperlio

    set USE_PERLIO = define (default) [should be depricated]

  • -Dusethreads

    set USE_ITHREADS = define (also sets USE_MULTI and USE_IMP_SYS)

  • -Duseithreads

    set USE_ITHREADS = define (also sets USE_MULTI and USE_IMP_SYS)

  • -Dusemultiplicity

    sets USE_MULTI = define (also sets USE_ITHREADS and USE_IMP_SYS)

  • -Duseimpsys

    sets USE_IMP_SYS = define (also sets USE_ITHREADS and USE_MULTI)

  • -Uusethreads or -Uuseithreads


  • -Dusemymalloc

    set PERL_MALLOC := define

  • -Duselargefiles

    set USE_LARGE_FILES := define

  • -Duse64bint

    set USE_64_BIT_INT := define (always for win64, needed for -UWIN64)

  • -Duselongdouble

    set USE_LONG_DOUBLE := define (GCC only)

  • -Dusequadmath

    set both USE_QUADMATH := define and I_QUADMATH := define (GCC only)

  • -Dusesitecustomize

    set USE_SITECUST := define

  • -Udefault_inc_excludes_dot

    unsets # DEFAULT_INC_EXCLUDES_DOT := define (comments out the line)

  • -Dbccold

    set BCCOLD = define (this is for bcc32 <= 5.4)

  • -Dgcc_v3_2

    set USE_GCC_V3_2 = define (this is for gcc >= 3.2)


    sets CFG = Debug

  • -DINST_DRV=...

    sets INST_DRV to a new value (default is "c:")

  • -DINST_TOP=...

    sets INST_DRV to a new value (default is "$(INST_DRV)\perl"), this is where perl will be installed when [ng]make install is run.

  • -DINST_VER=...

    sets INST_VER to a new value (default is forced not set), this is also used as part of the installation path to get a more unixy installation. Without INST_VER and INST_ARCH you get an ActiveState like installation.

  • -DINST_ARCH=...

    sets INST_ARCH to a new value (default is forced not set), this is also used as part of the installation path to get a more unixy installation. Without INST_VER and INST_ARCH you get an ActiveState like installation.

  • -DCCHOME=...

    Set the base directory for the C compiler. $(CCHOME)\bin still needs to be in the path!

  • -DIS_WIN95

    sets IS_WIN95 to 'define' to indicate this is Win9[58]

  • -DCRYPT_SRC=...

    The file to use as source for des_fcrypt()

  • -DCRYPT_LIB=...

    The library to use for des_fcrypt()

  • -Dcf_email=...

    Set the cf_email option (

  • -Accflags=...

    Adds the option to BUILDOPT. This is implemented differently for nmake and gmake. Returns the name of the outputfile.

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.

grepnonfatal( $cc, $logfile, $verbose )

This is a way to find known failures that do not cause the tests to fail but are important enough to report, like being unable to install manual pages.

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/ to get those values, if that cannot be found (make error?) we can try which is used to build lib/ If 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 or (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_pod2usage( %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-2014, All rights reserved.

  * H. Merijn Brand <>
  * Nicholas Clark <>
  * Jarkko Hietaniemi <>
  * Abe Timmerman <>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


  * <>,
  * <>

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.