6 use Test::Valgrind::Session;
10 use Test::More tests => 7;
12 my $sess = eval { Test::Valgrind::Session->new(
15 like $@, qr/^Empty valgrind candidates list/, 'no search_dirs';
17 $sess = eval { Test::Valgrind::Session->new(
20 like $@, qr/^No appropriate valgrind executable/, 'nonexistant valgrind';
26 if (\@ARGV == 1 && \$ARGV[0] eq '--version') {
27 print "valgrind-$version\n";
35 skip 'Only on linux' => 5 unless $^O eq 'linux';
37 my $vg_old = File::Temp->new(UNLINK => 1);
38 print $vg_old fake_vg('3.0.0');
40 chmod 0755, $vg_old->filename;
42 my $sess = eval { Test::Valgrind::Session->new(
43 valgrind => $vg_old->filename,
44 min_version => '3.1.0',
46 like $@, qr/^No appropriate valgrind executable/, 'old valgrind';
48 my $vg_new = File::Temp->new(UNLINK => 1);
49 print $vg_new fake_vg('3.4.0');
51 chmod 0755, $vg_new->filename;
53 $sess = eval { Test::Valgrind::Session->new(
54 valgrind => $vg_new->filename,
55 min_version => '3.1.0',
57 is $@, '', 'new valgrind';
58 isa_ok $sess, 'Test::Valgrind::Session', 'new valgrind isa Test::Valgrind::Session';
60 $sess = eval { Test::Valgrind::Session->new(
62 valgrind => [ $vg_old->filename, $vg_new->filename ],
63 min_version => '3.1.0',
65 is $@, '', 'old and new valgrind';
66 isa_ok $sess, 'Test::Valgrind::Session', 'old and new valgrind isa Test::Valgrind::Session';