summaryrefslogtreecommitdiff
path: root/t/924903.t
blob: 92ca4b070baa8c196c15775e19de4c64e5fc8127 (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
#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 3;
use File::Path qw(remove_tree);
use File::Copy::Recursive qw(dircopy);
use File::stat;

sub prepare_source_package {
    die '$0 does not match expected format'
        unless ($0 =~ m#t/([0-9]+)\.t#);
    my $number = $1;
    my $srcdir = (-d "t/base/${number}") ? "t/base/${number}" : "t/base/default";
    my $testdir = "t/${number}";
    dircopy($srcdir, $testdir);
    chdir($testdir);
    return $testdir;
}

sub system_ok {
    ok(system(@_) == 0, "external command @_");
}

prepare_source_package();

system_ok('dh_runit', 'debian/test.runscript', 'name=test');
my $path = 'debian/dh-runit-test/var/lib/runit/supervise/test';
ok(-d $path, 'supervise directory correctly created');
my $info = stat($path);
my $mode = sprintf("%o", $info->mode & 0777);
is($mode, '700', 'supervise directory have conservative permissions');