diff options
Diffstat (limited to 'plugins/tests/check_procs.t')
-rwxr-xr-x | plugins/tests/check_procs.t | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/plugins/tests/check_procs.t b/plugins/tests/check_procs.t index 1ad2c2f..54d43d9 100755 --- a/plugins/tests/check_procs.t +++ b/plugins/tests/check_procs.t | |||
@@ -48,21 +48,26 @@ SKIP: { | |||
48 | like( $result->output, '/^PROCS OK: 1 process with command name \'launchd\', UID = 501 (.*)$/', "Output correct" ); | 48 | like( $result->output, '/^PROCS OK: 1 process with command name \'launchd\', UID = 501 (.*)$/', "Output correct" ); |
49 | } | 49 | } |
50 | 50 | ||
51 | $result = NPTest->testCmd( "$command -u -2 -w 2:2" ); | 51 | SKIP: { |
52 | is( $result->return_code, 1, "Checking processes with userid=-2" ); | 52 | skip 'user with uid -2 required', 8 unless getpwuid(-2); |
53 | like( $result->output, '/^PROCS WARNING: 3 processes with UID = -2 \(nobody\)$/', "Output correct" ); | 53 | skip 'uid -2 must have name "nobody"', 8 unless getpwuid(-2) eq 'nobody'; |
54 | |||
55 | $result = NPTest->testCmd( "$command -u -2 -w 2:2" ); | ||
56 | is( $result->return_code, 1, "Checking processes with userid=-2" ); | ||
57 | like( $result->output, '/^PROCS WARNING: 3 processes with UID = -2 \(nobody\)$/', "Output correct" ); | ||
54 | 58 | ||
55 | $result = NPTest->testCmd( "$command -u -2 -w 3:3" ); | 59 | $result = NPTest->testCmd( "$command -u -2 -w 3:3" ); |
56 | is( $result->return_code, 0, "Checking processes with userid=-2 past threshold" ); | 60 | is( $result->return_code, 0, "Checking processes with userid=-2 past threshold" ); |
57 | like( $result->output, '/^PROCS OK: 3 processes with UID = -2 \(nobody\)$/', "Output correct" ); | 61 | like( $result->output, '/^PROCS OK: 3 processes with UID = -2 \(nobody\)$/', "Output correct" ); |
58 | 62 | ||
59 | $result = NPTest->testCmd( "$command -u -2 -a usb" ); | 63 | $result = NPTest->testCmd( "$command -u -2 -a usb" ); |
60 | is( $result->return_code, 0, "Checking processes with userid=-2 and usb in arguments" ); | 64 | is( $result->return_code, 0, "Checking processes with userid=-2 and usb in arguments" ); |
61 | like( $result->output, '/^PROCS OK: 1 process with UID = -2 \(nobody\), args \'usb\'/', "Output correct" ); | 65 | like( $result->output, '/^PROCS OK: 1 process with UID = -2 \(nobody\), args \'usb\'/', "Output correct" ); |
62 | 66 | ||
63 | $result = NPTest->testCmd( "$command -u -2 -a UsB" ); | 67 | $result = NPTest->testCmd( "$command -u -2 -a UsB" ); |
64 | is( $result->return_code, 0, "Checking case sensitivity of args" ); | 68 | is( $result->return_code, 0, "Checking case sensitivity of args" ); |
65 | like( $result->output, '/^PROCS OK: 0 processes with UID = -2 \(nobody\), args \'UsB\'/', "Output correct" ); | 69 | like( $result->output, '/^PROCS OK: 0 processes with UID = -2 \(nobody\), args \'UsB\'/', "Output correct" ); |
70 | }; | ||
66 | 71 | ||
67 | $result = NPTest->testCmd( "$command --ereg-argument-array='mdworker.*501'" ); | 72 | $result = NPTest->testCmd( "$command --ereg-argument-array='mdworker.*501'" ); |
68 | is( $result->return_code, 0, "Checking regexp search of arguments" ); | 73 | is( $result->return_code, 0, "Checking regexp search of arguments" ); |