Test::...Session(3pm)

✨ NAME ✨

Test::Valgrind::Session β€” the Test::Valgrind session object, bestie πŸ’– (this is the page from User Contributed Perl Documentation, and yes the title line is being extra with the dots, we love that for it)


🌸 VERSION 🌸

Version 1.19 β€” that's the one, no cap.


πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so picture this: this class is the main character that supervises the execution of the valgrind process. That's the whole job, and honestly? She ate. πŸ‘‘

But wait, there's more β€” she also acts as a dispatcher</> between the different components. Like a group chat admin who actually keeps everyone on topic. Iconic behaviour, fr fr.


πŸ’… 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, aka the birth of the session. She takes several options, and here they all are, one by one, no skipping, I don't do skipping:

  • Every single directory from @search_dirs gets valgrind appended to it, which builds up a whole little list of candidates for the valgrind executable. Defaults to the current PATH environment variable. πŸ’«
  • If you pass a simple scalar $valgrind as the value for 'valgrind', then that's the only candidate, periodt. @search_dirs will just be ignored in that case, sorry bestie. If instead you pass an array reference \@valgrind, its values get prepended to the candidate list that came out of @search_dirs.
  • $min_version says what the minimal valgrind version required is. If the constructor can't find a suitable valgrind from the candidate list and search path you gave her, she will croak. 😭 Defaults to none.
  • If $regen_def_supp is true, the default suppression file associated with the tool and the command gets forcefully regenerated. Defaults to false.
  • If $no_def_supp is true, valgrind will not 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 when no appropriate suppression file is available. Defaults to false.
  • $extra_supps is a reference to an array of optional suppression files that get passed to valgrind. Defaults to none.

πŸŽ€ valgrind πŸŽ€

my $valgrind_path = $tvs->valgrind;

The path to the valgrind executable that got selected. That's it, that's the method.


🌈 version 🌈

my $valgrind_version = $tvs->version;

The Test::Valgrind::Version object associated with the selected valgrind. Cute little version wrapper, we stan.


πŸ’œ regen_def_supp πŸ’œ

my $regen_def_supp = $tvs->regen_def_supp;

Read-only accessor for the regen_def_supp option. Look, don't touch. πŸ™ˆ


🧚 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 using the tool $tool, and that tool will report to the action $action. Big moment. Main event energy. 🎬

If the command happens to be a Test::Valgrind::Command::Aggregate object, then the action and the tool get initialized once before running all the aggregated commands. Efficiency slay.


πŸ‘‘ action πŸ‘‘

Read-only accessor for the action associated with the current run.


🫢 tool 🫢

Read-only accessor for the tool associated with the current run.


πŸ’– parser πŸ’–

Read-only accessor for the parser associated with the current tool.


🌸 command 🌸

Read-only accessor for the command associated with the current run.


πŸ¦‹ do_suppressions πŸ¦‹

Forwards to ->action->do_suppressions. Just passing the vibe along, iykyk.


πŸ’… 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 with the current session.

undef gets 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. (Yes, "builded". We're keeping it exactly as written. It's part of the lore now. 😌)


πŸ’œ 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, like a good listener.


🧚 start 🧚

$tvs->start;

Starts the action and tool associated with the current run. It's automatically called at the beginning of run, so it's kind of self-sufficient like that.


⭐ 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 with the current run. It's automatically called at the end of run. Closure, we love to see it. 🫢


πŸ‘‘ status πŸ‘‘

my $status = $tvs->status;

Returns the status code of the last run of the session. The receipts, basically.


🌈 SEE ALSO 🌈

Test::Valgrind, Test::Valgrind::Action, Test::Valgrind::Command, Test::Valgrind::Tool, Test::Valgrind::Parser.

File::HomeDir.

Go read them, they're all connected, it's giving extended universe. πŸ’«


πŸ’– AUTHOR πŸ’–

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

You can contact him by mail or on irc.perl.org (vincent). Bestie is reachable, respect. 🫑


πŸ™ˆ 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>. He will be notified, and then you'll automatically be notified of progress on your bug as he makes changes. It's giving mutual updates, we love a feedback loop. πŸ’Œ


πŸŽ€ SUPPORT πŸŽ€

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

perldoc Test::Valgrind::Session

Copyright 2009,2010,2011,2013,2015,2016 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.


And that's a wrap on Test::...Session(3pm), babes β€” this page came from perl v5.40.1 and it's dated 2025-04-13, so it's fresh, it's current, it's literally the moment. Stay validating, stay suppressions-having, and go read a manpage for fun sometime. Slay. πŸ’…βœ¨

πŸ“¦ where this page comes from