summaryrefslogtreecommitdiffstats
path: root/t/superuser--rpm.t
blob: d0e807d982e63d2abd89ad65420f2c2b11ef41ae (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
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/perl
# vim:et:ai:ts=4:sts=4:sw=4

use strict;
use lib '.', 't';
use helper;
use Config;
use Test::More;

if ($Config{archname} =~ /bsd/) {
    plan skip_all => "we cannot build rpm-query-in-scriptlet on FreeBSD due to cpio failure";
} else {
    plan 'no_plan';
}


my $name = 'rpm-query-in-scriptlet';

need_root_and_prepare();
system_('mkdir -p root/var/lib/rpm');
test_rpm_query_in_scriptlet();
done_testing();

sub test_rpm_query_in_scriptlet {
    system_("rpm --root $::pwd/root -i media/$name/$name*.rpm --nodeps");
    check_installed_names($name);
    rebuilddb();
    check_installed_names($name);
}

sub rebuilddb {
    # testing rebuilddb (could be done elsewhere, but here is 
    system_("rpm --root $::pwd/root --rebuilddb");
    my @dirs = glob("$::pwd/root/var/lib/rpmrebuilddb*");
    is($dirs[0], undef, "@dirs should not be there");
}