From 261a3fae83980a76bfe17243c393d1fb988e3bba Mon Sep 17 00:00:00 2001 From: Craig Small Date: Tue, 29 Nov 2011 22:55:03 +1100 Subject: [PATCH] fixed pgrep and added ps tests --- testsuite/Makefile.am | 3 +++ testsuite/pgrep.test/pgrep.exp | 4 +-- testsuite/ps.test/ps_output.exp | 38 ++++++++++++++++++++++++++++ testsuite/ps.test/ps_personality.exp | 18 +++++++++++++ 4 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 testsuite/ps.test/ps_output.exp create mode 100644 testsuite/ps.test/ps_personality.exp diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am index 50676f97..3951ec42 100644 --- a/testsuite/Makefile.am +++ b/testsuite/Makefile.am @@ -5,6 +5,7 @@ DEJATOOL = \ free \ pgrep \ pmap \ + ps \ pwdx \ uptime \ vmstat \ @@ -18,6 +19,8 @@ EXTRA_DIST = \ config/unix.exp \ uptime.test/uptime.exp \ pmap.test/pmap.exp \ + ps.test/ps_output.exp \ + ps.test/ps_personality.exp \ pwdx.test/pwdx.exp \ free.test/free.exp \ global-conf.exp \ diff --git a/testsuite/pgrep.test/pgrep.exp b/testsuite/pgrep.test/pgrep.exp index dedef793..99d1fff1 100644 --- a/testsuite/pgrep.test/pgrep.exp +++ b/testsuite/pgrep.test/pgrep.exp @@ -45,8 +45,8 @@ spawn $pgrep -d : $newsleep expect_pass "$test" "^${sleep1_pid}:${sleep2_pid}\\s*$" # FIXME - Need to test against -f flag -#set test "pgrep match against full process name" -#untested $test +set test "pgrep match against full process name" +untested $test set test "pgrep with matching gid" spawn $pgrep -G $gid $newsleep diff --git a/testsuite/ps.test/ps_output.exp b/testsuite/ps.test/ps_output.exp new file mode 100644 index 00000000..740e026c --- /dev/null +++ b/testsuite/ps.test/ps_output.exp @@ -0,0 +1,38 @@ +# +# Dejagnu tests for ps (output options) - part of procps +# +set ps ${topdir}ps/pscommand + +set mypid [pid] +set not_ppid [ expr { $mypid + 1 } ] +set uid [ exec id -u ] +set not_uid [ expr { $uid + 1 } ] +set gid [ exec id -g ] +set not_gid [ expr { $gid + 1 } ] +set raw_tty [ exec tty ] +regexp "/dev/(.+)" $raw_tty > tty + +# All the fields +# Cannot do args,cmd,comm +set ps_digit "\\d+\\s*" +set ps_state "\[A-Z