[procps] [PATCH] Run pgrep and pkill tests whithout host ps

  • From: Gilles Espinasse <g.esp@xxxxxxx>
  • To: procps@xxxxxxxxxxxxx
  • Date: Wed, 27 Jun 2012 23:21:50 +0200

When ps is not available (like it may happen in a chroot), pgrep.exp and 
pkill.exp tests fail.
Use just build ps instead.

Signed-off-by: Gilles Espinasse <g.esp@xxxxxxx>
---
 testsuite/pgrep.test/pgrep.exp |    3 ++-
 testsuite/pkill.test/pkill.exp |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/testsuite/pgrep.test/pgrep.exp b/testsuite/pgrep.test/pgrep.exp
index 0234099..0ec52c3 100644
--- a/testsuite/pgrep.test/pgrep.exp
+++ b/testsuite/pgrep.test/pgrep.exp
@@ -8,6 +8,7 @@ set uid [ exec id -u ]
 set not_uid [ expr { $uid + 1 } ] 
 set gid [ exec id -g ]
 set not_gid [ expr { $gid + 1 } ] 
+set ps "${topdir}ps/pscommand"
 set raw_tty [ exec tty ]
 regexp "/dev/(.+)" $raw_tty > tty
 
@@ -15,7 +16,7 @@ make_testproc
 
 set testproc_len [ string length $testproc_comm ]
 set testproc_trim [ string range $testproc_comm 0 [ expr { $testproc_len - 2 } 
] ]
-set testproc1_sid [ string trim [ exec ps --no-headers -o sid $testproc1_pid ] 
]
+set testproc1_sid [ string trim [ exec $ps --no-headers -o sid $testproc1_pid 
] ]
 
 set test "pgprep with no arguments"
 spawn $pgrep
diff --git a/testsuite/pkill.test/pkill.exp b/testsuite/pkill.test/pkill.exp
index 83a6d75..be0e2d9 100644
--- a/testsuite/pkill.test/pkill.exp
+++ b/testsuite/pkill.test/pkill.exp
@@ -8,13 +8,14 @@ set uid [ exec id -u ]
 set not_uid [ expr { $uid + 1 } ] 
 set gid [ exec id -g ]
 set not_gid [ expr { $gid + 1 } ] 
+set ps "${topdir}ps/pscommand"
 set raw_tty [ exec tty ]
 regexp "/dev/(.+)" $raw_tty > tty
 
 make_testproc
 set testproc_len [ string length $testproc_comm ]
 set testproc_trim [ string range $testproc_comm 0 [ expr { $testproc_len - 2 } 
] ]
-set testproc1_sid [ exec ps --no-headers -o sid $testproc1_pid ]
+set testproc1_sid [ exec $ps --no-headers -o sid $testproc1_pid ]
 
 set test "pkill with no arguments"
 spawn $pkill
-- 
1.7.2.5


Other related posts:

  • » [procps] [PATCH] Run pgrep and pkill tests whithout host ps - Gilles Espinasse