NAME

Test::RunValgrind - tests that an external program is valgrind-clean.

VERSION

version 0.2.1

SYNOPSIS

use Test::More tests => 1;
use Test::RunValgrind;

# TEST
Test::RunValgrind->new( {} )->run(
    {
        log_fn => './expr--valgrind-log.txt',
        prog   => '/usr/bin/expr',
        argv   => [qw/5 + 6/],
        blurb  => 'valgrind likes /usr/bin/expr',
    }
);

DESCRIPTION

valgrind is an open source and convenient memory debugger that runs on some platforms. This module runs valgrind (http://en.wikipedia.org/wiki/Valgrind) on an executable and makes sure that valgrind did not find any faults in it.

It originated from some code used to test the Freecell Solver executables using valgrind, and was extracted into its own CPAN module to allow for reuse by other projects, including fortune-mod (https://github.com/shlomif/fortune-mod).

VERSION

version 0.2.1

METHODS

my $obj = Test::RunValgrind->new({})

The constructor - currently accepts a single hash reference and if its 'supress_stderr' key's value is true, supresses outputting STDERR if on successful subsequent tests (starting from version 0.0.2). Furthermore if 'ignore_leaks' is true, then reported memory leaks are ignored and their presence will still allow the tests to pass (starting from version 0.2.0, and see https://rt.cpan.org/Public/Bug/Display.html?id=119988 ).

'valgrind_args' may point to an array reference of extra command line arguments to valgrind. See https://github.com/shlomif/perl-Test-RunValgrind/issues/4 ; since version 0.2.0.

$obj->run({ ... })

Runs valgrind.

Accepts a hash ref with the following keys:

  • blurb

    The Test::More test assertion blurb.

  • log_fn

    The path to write the log file to (and read from it). Make sure it is secured.

  • prog

    The path to the executable to run.

  • argv

    An array reference contains strings with command line arguments to the executable.

See the synopsis for an example.

SEE ALSO

Test::Valgrind - seems to be only for running perl itself under valgrind.

Devel::Valgrind::Client

http://en.wikipedia.org/wiki/Valgrind - wikipedia page.

http://github.com/shlomif/fc-solve/blob/master/fc-solve/source/t/t/lib/FC_Solve/Test/Valgrind.pm - original code using Test::RunValgrind in Freecell Solver

AUTHOR

Shlomi Fish <shlomif@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2016 by Shlomi Fish.

This is free software, licensed under:

The MIT (X11) License

BUGS

Please report any bugs or feature requests on the bugtracker website https://github.com/shlomif/perl-Test-RunValgrind/issues

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

SUPPORT

Perldoc

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

perldoc Test::RunValgrind

Websites

The following websites have more information about this module, and may be of help to you. As always, in addition to those websites please use your favorite search engine to discover more resources.

Bugs / Feature Requests

Please report any bugs or feature requests by email to bug-test-runvalgrind at rt.cpan.org, or through the web interface at https://rt.cpan.org/Public/Bug/Report.html?Queue=Test-RunValgrind. You will be automatically notified of any progress on the request by the system.

Source Code

The code is open to the world, and available for you to hack on. Please feel free to browse it and play with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull from your repository :)

https://github.com/shlomif/perl-Test-RunValgrind

git clone git://github.com/shlomif/perl-Test-RunValgrind.git