From 5d2619774ea77b02e4642401fb3c1dbd02253011 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Sat, 4 Jun 2016 09:26:14 -0700 Subject: Basic success/failure return from pgrep/pkill. The man page says they also return 2 for syntax errors and 3 for "fatal error: out of memory etc", but I don't know how to implement that and don't need it (or have any reason to believe anyone needs it). Bug: 29092208 --- tests/pkill.test | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'tests/pkill.test') diff --git a/tests/pkill.test b/tests/pkill.test index 0bea32ab..3f20d260 100755 --- a/tests/pkill.test +++ b/tests/pkill.test @@ -92,10 +92,16 @@ testing "-P parent_prodId pattern" "pkill -P $proc_p yes && sleep 1 && killall yes >/dev/null 2>&1 yes >/dev/null & -proc=$! -proc_parent=`cat /proc/${proc}/stat | awk '{ print $4 }'` sleep 1 testing "-9 pattern" "pkill -9 yes && sleep 1 && (pgrep yes || echo 'yes')" "yes\n" "" "" killall yes >/dev/null 2>&1 +yes >/dev/null & +sleep 1 +testing "return success" "pkill yes && echo success" "success\n" "" "" +killall yes >/dev/null 2>&1 + +testing "return failure" "pkill almost-certainly-not || echo failure" \ + "failure\n" "" "" + -- cgit v1.2.3