File: api.t

package info (click to toggle)
liblinux-io-prio-perl 0.03-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 80 kB
  • sloc: perl: 97; makefile: 2
file content (39 lines) | stat: -rw-r--r-- 940 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use Test::More;
use Linux::IO_Prio qw(:all);
use POSIX qw(ENOSYS);

if( $^O eq 'linux' && Linux::IO_Prio::_load_syscall()) {
    plan tests => 5;	

    ok(ioprio_set(IOPRIO_WHO_PROCESS, $$, IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0)) == 0);

    ok(ioprio_get(IOPRIO_WHO_PROCESS, $$) >= 0);

    ok(ionice(IOPRIO_WHO_PROCESS, $$, IOPRIO_CLASS_IDLE, 0) == 0);

    ok(ionice_class(IOPRIO_WHO_PROCESS, $$) == IOPRIO_CLASS_IDLE);

    ok(ionice_data(IOPRIO_WHO_PROCESS, $$) == 0);

}
else {
    plan tests => 10;

    ok(ioprio_set(IOPRIO_WHO_PROCESS, $$, IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0)) == -1);
    ok($! == ENOSYS);

    ok(ioprio_get(IOPRIO_WHO_PROCESS, $$) == -1);
    ok($! == ENOSYS);

    ok(ionice(IOPRIO_WHO_PROCESS, $$, IOPRIO_CLASS_IDLE, 0) == -1);
    ok($! == ENOSYS);

    ok(ionice_class(IOPRIO_WHO_PROCESS, $$) == -1);
    ok($! == ENOSYS);

    ok(ionice_data(IOPRIO_WHO_PROCESS, $$) == -1);
    ok($! == ENOSYS);

};