procps/testsuite/pmap.test/pmap.exp
Gilles Espinasse be1bb68c55 Fix pmap -x test in when sizeof(KLONG) != 8
-x test should have work only in sizeof(KLONG) == 8 case where 3 numbers are printed
In sizeof(KLONG) != 8, only one number and three '-' are printed, so allow '-' character

I am compiling x86 32bits userspace, so I should be in (sizeof(KLONG) != 8) case

Signed-off-by: Gilles Espinasse <g.esp@free.fr>
2012-05-08 22:55:23 +10:00

50 lines
2.0 KiB
Plaintext

#
# Dejagnu tests for pgrep - part of procps
#
set pmap "${topdir}pmap"
set mypid [pid]
set pmap_procname "${mypid}:\\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_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*\)+"
set pmap_ext_items "\(\[0-9a-f\]+\\s+\\d+\\s+\\d+\\s+\\d+ \[rwx-\]{5}\\s+\\S+\[^\\r\]+\\s*\)+"
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*\$"
set pmap_ext_footer "\[ -\]+\\s+total kB\\s+\\d+(\\s+\[\\d-\]+){2,3}\\s*\$"
set test "pmap with no arguments"
spawn $pmap
expect_pass "$test" "^\(lt-\)\?pmap: argument missing"
#expect_pass "$test" "^Usage: pmap \\\[-x | -d\\\] \\\[-q\\\] \\\[-A low,high\\\] pid\\.\\.\\.\\s+-x\\s+show details\\s+-d\\s+show offset and device number\\s+-q\\s+quiet; less header/footer info\\s+-V\\s+show the version number\\s+-A\\s+limit results to the given range\\s*"
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