From 1f1201f89665d16991d0aad1f2c66f33c2bec5a5 Mon Sep 17 00:00:00 2001 From: Craig Small Date: Mon, 24 Dec 2012 10:05:24 +1100 Subject: [PATCH] Added pmap -X and -XX tests The two extra extended pmap options were not tested previously. We test against our known process and process 1 which we should not be able to get data for. Unfortunately, the tests cannot catch SEGSEGVs but they should. Signed-off-by: Craig Small --- .gitignore | 1 + testsuite/pmap.test/pmap.exp | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/.gitignore b/.gitignore index 67b92cbd..92d1e39c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *.lo *.o *.so +*.swp .deps .libs .version diff --git a/testsuite/pmap.test/pmap.exp b/testsuite/pmap.test/pmap.exp index 0917f197..eac9483c 100644 --- a/testsuite/pmap.test/pmap.exp +++ b/testsuite/pmap.test/pmap.exp @@ -5,9 +5,11 @@ set pmap "${topdir}pmap" set mypid [pid] set pmap_procname "${mypid}:\\s+\\S+\[^\\r\]+\\s+" +set pmap_initname "1:\\s+\\S+\[^\\r\]+\\s+" set pmap_std_header $pmap_procname set pmap_device_header "${pmap_procname}Address\\s+Kbytes\\s+Mode\\s+Offset\\s+Device\\s+Mapping\\s+" set pmap_ext_header "${pmap_procname}Address\\s+Kbytes\\s+RSS\\s+Dirty\\s+Mode\\s+Mapping\\s+" +set pmap_generic_header "${pmap_procname}\\s+\(?:\[A-Z\]\[a-z\]+ +\)+" set pmap_std_items "\(\[0-9a-f\]+\\s+\\d+K \[rwx-\]{5}\\s+\\S+\[^\\r\]+\\s*\)+" set pmap_device_items "\(\[0-9a-f\]+\\s+\\d+ \[rwx-\]{5}\\s+\[0-9a-f\]+\\s+\[0-9a-f\]{3}:\[0-9a-f\]{5}\\s+\\S+\[^\\r\]+\\s*\)+" @@ -47,3 +49,20 @@ set test "pmap extended output" spawn $pmap -x $mypid expect_table $test $pmap_ext_header $pmap_ext_items $pmap_ext_footer +# -X and -XX have no real format as its dependent on smaps +set test "pmap extra extended output" +spawn $pmap -X $mypid +expect_table $test $pmap_generic_header ".+" "\[= \]+" + +set test "pmap double extra extended output" +spawn $pmap -XX $mypid +expect_table $test $pmap_generic_header ".+" "\[= \]+" + +set test "pmap X with unreachable process" +spawn $pmap -X 1 +expect_pass $test "$pmap_initname\$" + +set test "pmap XX with unreachable process" +spawn $pmap -XX 1 +expect_pass $test "$pmap_initname\$" + -- 2.40.0