Bernhard Reutner-Fischer | 82338d8 | 2005-10-06 12:50:11 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # pidof tests. |
| 4 | # Copyright 2005 by Bernhard Fischer |
| 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 | |
Bernhard Reutner-Fischer | 82338d8 | 2005-10-06 12:50:11 +0000 | [diff] [blame] | 9 | . testing.sh |
| 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" "" "" |
Bernhard Reutner-Fischer | 82338d8 | 2005-10-06 12:50:11 +0000 | [diff] [blame] | 23 | |
Rob Landley | 48c6157 | 2005-11-07 08:50:53 +0000 | [diff] [blame] | 24 | optional FEATURE_PIDOF_OMIT |
Rob Landley | 4bb1b04 | 2006-03-16 15:20:45 +0000 | [diff] [blame] | 25 | testing "pidof -o %PPID" "pidof -o %PPID pidof.tests | grep -o -w $$" "" "" "" |
| 26 | testing "pidof -o %PPID NOP" "pidof -o %PPID -s init" "1\n" "" "" |
Denis Vlasenko | 9213a9e | 2006-09-17 16:28:10 +0000 | [diff] [blame] | 27 | testing "pidof -o init" "pidof -o 1 init | grep -o -w 1" "" "" "" |
Bernhard Reutner-Fischer | 82338d8 | 2005-10-06 12:50:11 +0000 | [diff] [blame] | 28 | |
| 29 | exit $FAILCOUNT |