summaryrefslogtreecommitdiffstats
path: root/t/superuser--buggy-rpms.t
blob: 256f45f8d5443d60d3e19dcced78b93433a7da96 (plain)
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
#!/usr/bin/perl

use strict;
use lib '.', 't';
use helper;
use Test::More 'no_plan';
BEGIN { use_ok "URPM" }

need_root_and_prepare();

#- things are going to be noisy, and that's normal
open STDERR, '>/dev/null';

my @pkgs = map { "data/rpm-buggy/$_" } 'invalid-signature.rpm', 'not-a-rpm.rpm', 'weird-header.rpm';
foreach (@pkgs) {
    # rpm-4.14.2's errors messages mess up with TAP:
    system("rpm -K $_ &>/dev/null");
    is($?, 1 << 8, "rpm -K $_");

    system(urpmi_cmd() . " $_");
    is($?, 2 << 8, "urpmi $_");

    my $verif = URPM::verify_signature($_);
    ok($verif =~ /NOT OK/);
}