File: secbits.t

package info (click to toggle)
liblinux-prctl-perl 1.6.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 400 kB
  • sloc: perl: 163; ansic: 19; makefile: 2
file content (21 lines) | stat: -rw-r--r-- 926 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use strict;
use warnings;

use Test::More tests => 13;
use Linux::Prctl qw(:constants :securebits);

SKIP: {
    skip "set_securebits not available", 13 unless Linux::Prctl->can('set_securebits');
    skip "This test only makes sense when run as root", 13 unless $< == 0;
    is(defined(tied %Linux::Prctl::securebits), 1, "Have a tied securebits object");
    for(qw(keep_caps noroot no_setuid_fixup)) {
        is($Linux::Prctl::securebits{$_}, 0, "Checking whether $_ is 0");
        $Linux::Prctl::securebits{$_} = 1;
        is($Linux::Prctl::securebits{$_}, 1, "Checking whether $_ is 1");
        $Linux::Prctl::securebits{$_} = 0;
        is($Linux::Prctl::securebits{$_}, 0, "Checking whether $_ is 0");
        $Linux::Prctl::securebits{$_ . '_locked'} = 1;
        $Linux::Prctl::securebits{$_ . '_locked'} = 0;
        is($Linux::Prctl::securebits{$_ . '_locked'}, 1, "Checking whether ${_}_locked is 1");
    }
}