Bernhard Reutner-Fischer | 82338d8 | 2005-10-06 12:50:11 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # pidof tests. |
Bernhard Reutner-Fischer | 6c4dade | 2008-09-25 12:13:34 +0000 | [diff] [blame] | 4 | # Copyright 2005 by Bernhard Reutner-Fischer |
Bernhard Reutner-Fischer | 82338d8 | 2005-10-06 12:50:11 +0000 | [diff] [blame] | 5 | # Licensed under GPL v2, see file LICENSE for details. |
| 6 | |
Denis Vlasenko | 9213a9e | 2006-09-17 16:28:10 +0000 | [diff] [blame] | 7 | # AUDIT: |
Bernhard Reutner-Fischer | 82338d8 | 2005-10-06 12:50:11 +0000 | [diff] [blame] | 8 | |
Mike Frysinger | caa7940 | 2009-11-04 18:41:22 -0500 | [diff] [blame] | 9 | . ./testing.sh |
Bernhard Reutner-Fischer | 82338d8 | 2005-10-06 12:50:11 +0000 | [diff] [blame] | 10 | |
| 11 | # testing "test name" "options" "expected result" "file input" "stdin" |
| 12 | |
Rob Landley | 4bb1b04 | 2006-03-16 15:20:45 +0000 | [diff] [blame] | 13 | testing "pidof (exit with error)" \ |
| 14 | "pidof veryunlikelyoccuringbinaryname ; echo \$?" "1\n" "" "" |
| 15 | testing "pidof (exit with success)" "pidof pidof > /dev/null; echo \$?" \ |
| 16 | "0\n" "" "" |
| 17 | # We can get away with this because it says #!/bin/sh up top. |
Bernhard Reutner-Fischer | 82338d8 | 2005-10-06 12:50:11 +0000 | [diff] [blame] | 18 | |
Rob Landley | 4bb1b04 | 2006-03-16 15:20:45 +0000 | [diff] [blame] | 19 | testing "pidof this" "pidof pidof.tests | grep -o -w $$" "$$\n" "" "" |
Bernhard Reutner-Fischer | 82338d8 | 2005-10-06 12:50:11 +0000 | [diff] [blame] | 20 | |
Rob Landley | 48c6157 | 2005-11-07 08:50:53 +0000 | [diff] [blame] | 21 | optional FEATURE_PIDOF_SINGLE |
Rob Landley | 4bb1b04 | 2006-03-16 15:20:45 +0000 | [diff] [blame] | 22 | testing "pidof -s" "pidof -s init" "1\n" "" "" |
Denys Vlasenko | bfa1b2e | 2010-05-11 03:53:57 +0200 | [diff] [blame^] | 23 | SKIP= |
Bernhard Reutner-Fischer | 82338d8 | 2005-10-06 12:50:11 +0000 | [diff] [blame] | 24 | |
Denys Vlasenko | bfa1b2e | 2010-05-11 03:53:57 +0200 | [diff] [blame^] | 25 | optional FEATURE_PIDOF_OMIT FEATURE_PIDOF_SINGLE |
Denis Vlasenko | 6446c2d | 2007-11-25 04:54:13 +0000 | [diff] [blame] | 26 | # This test fails now because process name matching logic has changed, |
| 27 | # but new logic is not "wrong" either... see find_pid_by_name.c comments |
| 28 | #testing "pidof -o %PPID" "pidof -o %PPID pidof.tests | grep -o -w $$" "" "" "" |
Rob Landley | 4bb1b04 | 2006-03-16 15:20:45 +0000 | [diff] [blame] | 29 | testing "pidof -o %PPID NOP" "pidof -o %PPID -s init" "1\n" "" "" |
Denis Vlasenko | 9213a9e | 2006-09-17 16:28:10 +0000 | [diff] [blame] | 30 | testing "pidof -o init" "pidof -o 1 init | grep -o -w 1" "" "" "" |
Denys Vlasenko | bfa1b2e | 2010-05-11 03:53:57 +0200 | [diff] [blame^] | 31 | SKIP= |
Bernhard Reutner-Fischer | 82338d8 | 2005-10-06 12:50:11 +0000 | [diff] [blame] | 32 | |
| 33 | exit $FAILCOUNT |