2011-11-27 13:02:10 +05:30
|
|
|
#
|
|
|
|
# Dejagnu tests for pgrep - part of procps
|
|
|
|
#
|
2022-08-29 14:43:10 +05:30
|
|
|
set pmap "${topdir}src/pmap"
|
2011-12-01 17:12:23 +05:30
|
|
|
set mypid [pid]
|
|
|
|
|
|
|
|
set pmap_procname "${mypid}:\\s+\\S+\[^\\r\]+\\s+"
|
2012-12-24 04:35:24 +05:30
|
|
|
set pmap_initname "1:\\s+\\S+\[^\\r\]+\\s+"
|
2011-12-01 17:12:23 +05:30
|
|
|
set pmap_std_header $pmap_procname
|
|
|
|
set pmap_device_header "${pmap_procname}Address\\s+Kbytes\\s+Mode\\s+Offset\\s+Device\\s+Mapping\\s+"
|
2012-01-02 12:09:41 +05:30
|
|
|
set pmap_ext_header "${pmap_procname}Address\\s+Kbytes\\s+RSS\\s+Dirty\\s+Mode\\s+Mapping\\s+"
|
2012-12-24 04:35:24 +05:30
|
|
|
set pmap_generic_header "${pmap_procname}\\s+\(?:\[A-Z\]\[a-z\]+ +\)+"
|
2011-12-01 17:12:23 +05:30
|
|
|
|
|
|
|
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*\)+"
|
2012-01-02 12:09:41 +05:30
|
|
|
set pmap_ext_items "\(\[0-9a-f\]+\\s+\\d+\\s+\\d+\\s+\\d+ \[rwx-\]{5}\\s+\\S+\[^\\r\]+\\s*\)+"
|
2011-12-01 17:12:23 +05:30
|
|
|
|
|
|
|
set pmap_std_footer "total\\s+\\d+K\\s*\$"
|
|
|
|
set pmap_device_footer "mapped:\\s+\\d+K\\s+writeable\/private:\\s+\\d+K\\s+shared:\\s+\\d+K\\s*\$"
|
2012-05-08 18:31:53 +05:30
|
|
|
set pmap_ext_footer "\[ -\]+\\s+total kB\\s+\\d+(\\s+\[\\d-\]+){2,3}\\s*\$"
|
2011-12-01 17:12:23 +05:30
|
|
|
|
|
|
|
set test "pmap with no arguments"
|
|
|
|
spawn $pmap
|
2013-03-16 10:30:00 +05:30
|
|
|
#expect_pass "$test" "^\(lt-\)\?pmap: argument missing"
|
2014-02-02 12:43:01 +05:30
|
|
|
expect_pass "$test" "Usage:\\s+\(lt-\)?pmap \\\[options\\\] PID \\\[PID \.\.\.\\\]"
|
2011-12-01 17:12:23 +05:30
|
|
|
|
|
|
|
set test "pmap standard output"
|
|
|
|
spawn $pmap $mypid
|
|
|
|
expect_table $test $pmap_std_header $pmap_std_items $pmap_std_footer
|
|
|
|
|
|
|
|
set test "pmap standard output with quiet"
|
|
|
|
spawn $pmap -q $mypid
|
|
|
|
expect_table $test $pmap_procname $pmap_std_items "\$"
|
|
|
|
|
|
|
|
set test "pmap device output"
|
|
|
|
spawn $pmap -d $mypid
|
|
|
|
expect_table $test $pmap_device_header $pmap_device_items $pmap_device_footer
|
|
|
|
|
|
|
|
|
|
|
|
set test "pmap device output quiet (dq)"
|
|
|
|
spawn $pmap -dq $mypid
|
|
|
|
expect_table $test $pmap_procname $pmap_device_items "\$"
|
|
|
|
|
|
|
|
set test "pmap device output quiet (qd)"
|
|
|
|
spawn $pmap -qd $mypid
|
|
|
|
expect_table $test $pmap_procname $pmap_device_items "\$"
|
|
|
|
|
|
|
|
set test "pmap extended output"
|
|
|
|
spawn $pmap -x $mypid
|
|
|
|
expect_table $test $pmap_ext_header $pmap_ext_items $pmap_ext_footer
|
2011-11-27 13:02:10 +05:30
|
|
|
|
2012-12-24 04:35:24 +05:30
|
|
|
# -X and -XX have no real format as its dependent on smaps
|
|
|
|
set test "pmap extra extended output"
|
|
|
|
spawn $pmap -X $mypid
|
2013-04-07 14:01:26 +05:30
|
|
|
expect_table $test $pmap_generic_header "\[^=\]+" "\[= \]+"
|
2012-12-24 04:35:24 +05:30
|
|
|
|
|
|
|
set test "pmap double extra extended output"
|
|
|
|
spawn $pmap -XX $mypid
|
2013-04-07 14:01:26 +05:30
|
|
|
expect_table $test $pmap_generic_header "\[^=\]+" "\[= \]+"
|
2012-12-24 04:35:24 +05:30
|
|
|
|
|
|
|
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\$"
|
|
|
|
|
2022-04-26 17:34:05 +05:30
|
|
|
set test "pmap finding shm"
|
|
|
|
make_testshm_proc
|
2022-05-03 15:07:39 +05:30
|
|
|
if { $shmid == "" } {
|
|
|
|
unsupported "$test - could not start test_shm"
|
|
|
|
} else {
|
|
|
|
spawn $pmap $testshmproc_pid
|
|
|
|
expect_pass $test "\[ shmid=0x$shmid \]"
|
|
|
|
}
|
2022-04-26 17:34:05 +05:30
|
|
|
kill_testshm_proc
|