File: 30-skip.t

package info (click to toggle)
libtest-valgrind-perl 1.19-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 424 kB
  • sloc: perl: 2,779; makefile: 22
file content (47 lines) | stat: -rw-r--r-- 1,504 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!perl

use strict;
use warnings;

BEGIN { delete $ENV{PATH} }

use lib 't/lib';
use VPIT::TestHelpers 'capture';

use Test::More tests => 3;

use Test::Valgrind::FakeValgrind;

SKIP: {
 my ($stat, $out, $err) = capture_perl 'BEGIN { delete $ENV{PATH} } use Test::Valgrind; 1';
 skip CAPTURE_PERL_FAILED($out) => 1 unless defined $stat;
 like $out, qr/^1\.\.0 # (?:SKIP|Skip) Empty valgrind candidates list/,
            'correctly skip when no valgrind is available';
}

SKIP: {
 my $old_vg = Test::Valgrind::FakeValgrind->new(
  exe_name => 'valgrind',
  version  => '3.0.0',
 );
 skip $old_vg => 1 unless ref $old_vg;
 my $tmp_dir = $old_vg->dir;

 my ($stat, $out, $err) = capture_perl "BEGIN { \$ENV{PATH} = q[$tmp_dir] } use Test::Valgrind; 1";
 skip CAPTURE_PERL_FAILED($out) => 1 unless defined $stat;
 like $out, qr/^1\.\.0 # (?:SKIP|Skip) No appropriate valgrind executable could be found/, 'correctly skip when no good valgrind was found';
}

SKIP: {
 my $new_vg = Test::Valgrind::FakeValgrind->new(
  exe_name => 'valgrind',
  version  => '3.4.0',
 );
 skip $new_vg => 1 unless ref $new_vg;
 my $tmp_dir = $new_vg->dir;

 my ($stat, $out, $err) = capture_perl "BEGIN { \$ENV{PATH} = q[$tmp_dir] } use Test::Valgrind no_def_supp => 1, extra_supps => [ q[t/supp/no_perl] ]; 1";
 skip CAPTURE_PERL_FAILED($out) => 1 unless defined $stat;
 like $out, qr/^1\.\.0 # (?:SKIP|Skip) No compatible suppressions available/,
            'correctly skip when no compatible suppressions were available';
}