File: 140-psfind.t

package info (click to toggle)
libsys-statistics-linux-perl 0.66-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 424 kB
  • sloc: perl: 1,655; makefile: 2
file content (25 lines) | stat: -rw-r--r-- 556 bytes parent folder | download | duplicates (5)
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
use strict;
use warnings;
use Test::More;
use Sys::Statistics::Linux;

for my $f ("/proc/$$/stat","/proc/$$/statm","/proc/$$/status","/proc/$$/cmdline","/proc/$$/wchan") {
    if (!-r $f) {
        plan skip_all => "$f is not readable";
        exit(0);
    }
}

my $sys = Sys::Statistics::Linux->new();
$sys->set(processes => 1);
sleep 1;
my $stat = $sys->get;

if (!scalar keys %{$stat->processes}) {
    plan skip_all => "processlist is empty";
    exit(0);
}

plan tests => 1;
my $foo  = $stat->psfind({cmd => qr/\w/});
ok(@{$foo}, "checking psfind");