Test::Valgrind::Session(3) Test::Valgrind session object.

VERSION

Version 1.18

DESCRIPTION

This class supervises the execution of the "valgrind" process. It also acts as a dispatcher between the different components.

METHODS

new

    my $tvs = Test::Valgrind::Session->new(
     search_dirs    => \@search_dirs,
     valgrind       => $valgrind,  # One candidate
     valgrind       => \@valgrind, # Several candidates
     min_version    => $min_version,
     regen_def_supp => $regen_def_supp,
     no_def_supp    => $no_def_supp,
     allow_no_supp  => $allow_no_supp,
     extra_supps    => \@extra_supps,
    );

The package constructor, which takes several options :

  • All the directories from @search_dirs will have valgrind appended to create a list of candidates for the "valgrind" executable.

    Defaults to the current "PATH" environment variable.

  • If a simple scalar $valgrind is passed as the value to 'valgrind', it will be the only candidate. @search_dirs will then be ignored.

    If an array refernce "\@valgrind" is passed, its values will be prepended to the list of the candidates resulting from @search_dirs.

  • $min_version specifies the minimal "valgrind" version required. The constructor will croak if it's not able to find an adequate "valgrind" from the supplied candidates list and search path.

    Defaults to none.

  • If $regen_def_supp is true, the default suppression file associated with the tool and the command will be forcefully regenerated.

    Defaults to false.

  • If $no_def_supp is true, "valgrind" won't read the default suppression file associated with the tool and the command.

    Defaults to false.

  • If $allow_no_supp is true, the command will always be run into "valgrind" even if no appropriate suppression file is available.

    Defaults to false.

  • $extra_supps is a reference to an array of optional suppression files that will be passed to "valgrind".

    Defaults to none.

valgrind

    my $valgrind_path = $tvs->valgrind;

The path to the selected "valgrind" executable.

version

    my $valgrind_version = $tvs->version;

The Test::Valgrind::Version object associated to the selected "valgrind".

regen_def_supp

    my $regen_def_supp = $tvs->regen_def_supp;

Read-only accessor for the "regen_def_supp" option.

no_def_supp

    my $no_def_supp = $tvs->no_def_supp;

Read-only accessor for the "no_def_supp" option.

allow_no_supp

    my $allow_no_supp = $tvs->allow_no_supp;

Read-only accessor for the "allow_no_supp" option.

extra_supps

    my @extra_supps = $tvs->extra_supps;

Read-only accessor for the "extra_supps" option.

run

    $tvs->run(
     action  => $action,
     tool    => $tool,
     command => $command,
    );

Runs the command $command through "valgrind" with the tool $tool, which will report to the action $action.

If the command is a Test::Valgrind::Command::Aggregate object, the action and the tool will be initialized once before running all the aggregated commands.

action

Read-only accessor for the "action" associated to the current run.

tool

Read-only accessor for the "tool" associated to the current run.

parser

Read-only accessor for the "parser" associated to the current tool.

command

Read-only accessor for the "command" associated to the current run.

do_suppressions

Forwards to "->action->do_suppressions".

parser_class

Calls "->tool->parser_class" with the current session object as the unique argument.

report_class

Calls "->tool->report_class" with the current session object as the unique argument.

def_supp_file

Returns an absolute path to the default suppression file associated to the current session.

"undef" will be returned as soon as any of "->command->suppressions_tag" or "->tool->suppressions_tag" are also "undef". Otherwise, the file part of the name is builded by joining those two together, and the directory part is roughly File::HomeDir->my_home / .perl / Test-Valgrind / suppressions / $VERSION.

suppressions

    my @suppressions = $tvs->suppressions;

Returns the list of all the suppressions that will be passed to "valgrind". Honors ``no_def_supp'' and ``extra_supps''.

start

    $tvs->start;

Starts the action and tool associated to the current run. It's automatically called at the beginning of ``run''.

abort

    $tvs->abort($msg);

Forwards to "->action->abort" after unshifting the session object to the argument list.

report

    $tvs->report($report);

Forwards to "->action->report" after unshifting the session object to the argument list.

finish

    $tvs->finish;

Finishes the action and tool associated to the current run. It's automatically called at the end of ``run''.

status

    my $status = $tvs->status;

Returns the status code of the last run of the session.

AUTHOR

Vincent Pit, "<perl at profvince.com>", <http://www.profvince.com>.

You can contact me by mail or on "irc.perl.org" (vincent).

BUGS

Please report any bugs or feature requests to "bug-test-valgrind at rt.cpan.org", or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Valgrind>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Test::Valgrind::Session

COPYRIGHT & LICENSE

Copyright 2009,2010,2011,2013,2015 Vincent Pit, all rights reserved.

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