diff options
author | Karel Zak <kzak@redhat.com> | 2016-11-04 11:23:39 +0100 |
---|---|---|
committer | Karel Zak <kzak@redhat.com> | 2016-11-09 10:02:32 +0100 |
commit | 2b68dc7d0dcb84efb5a0c976665569752171d055 (patch) | |
tree | 32e280ff6d8650bb351873f9024982d19b902518 | |
parent | 3845c7302d3fbb452f915703ac628b3466272446 (diff) | |
download | util-linux-2b68dc7d0dcb84efb5a0c976665569752171d055.tar.gz |
tests: cleanup and update lsmem
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r-- | tests/expected/lsmem/lsmem-s390-zvm-6g | 199 | ||||
-rwxr-xr-x | tests/ts/lsmem/lsmem | 32 |
2 files changed, 126 insertions, 105 deletions
diff --git a/tests/expected/lsmem/lsmem-s390-zvm-6g b/tests/expected/lsmem/lsmem-s390-zvm-6g index be244ad5c4..29ccbb5f7c 100644 --- a/tests/expected/lsmem/lsmem-s390-zvm-6g +++ b/tests/expected/lsmem/lsmem-s390-zvm-6g @@ -1,91 +1,108 @@ ->lsmem -RANGE SIZE STATE REMOVABLE BLOCK -0x0000000000000000-0x000000006fffffff 1.8G online yes 0-6 -0x0000000070000000-0x000000007fffffff 256M online no 7 -0x0000000080000000-0x000000009fffffff 512M online yes 8-9 -0x00000000a0000000-0x00000000bfffffff 512M online no 10-11 -0x00000000c0000000-0x00000000dfffffff 512M online yes 12-13 -0x00000000e0000000-0x00000000efffffff 256M offline - 14 -0x00000000f0000000-0x00000000ffffffff 256M online yes 15 -0x0000000100000000-0x000000011fffffff 512M online no 16-17 -0x0000000120000000-0x000000013fffffff 512M online yes 18-19 -0x0000000140000000-0x000000017fffffff 1G offline - 20-23 - -Memory block size : 256M -Total online memory : 4.8G -Total offline memory: 1.3G - ->lsmem -a -RANGE SIZE STATE REMOVABLE BLOCK -0x0000000000000000-0x000000000fffffff 256M online yes 0 -0x0000000010000000-0x000000001fffffff 256M online yes 1 -0x0000000020000000-0x000000002fffffff 256M online yes 2 -0x0000000030000000-0x000000003fffffff 256M online yes 3 -0x0000000040000000-0x000000004fffffff 256M online yes 4 -0x0000000050000000-0x000000005fffffff 256M online yes 5 -0x0000000060000000-0x000000006fffffff 256M online yes 6 -0x0000000070000000-0x000000007fffffff 256M online no 7 -0x0000000080000000-0x000000008fffffff 256M online yes 8 -0x0000000090000000-0x000000009fffffff 256M online yes 9 -0x00000000a0000000-0x00000000afffffff 256M online no 10 -0x00000000b0000000-0x00000000bfffffff 256M online no 11 -0x00000000c0000000-0x00000000cfffffff 256M online yes 12 -0x00000000d0000000-0x00000000dfffffff 256M online yes 13 -0x00000000e0000000-0x00000000efffffff 256M offline - 14 -0x00000000f0000000-0x00000000ffffffff 256M online yes 15 -0x0000000100000000-0x000000010fffffff 256M online no 16 -0x0000000110000000-0x000000011fffffff 256M online no 17 -0x0000000120000000-0x000000012fffffff 256M online yes 18 -0x0000000130000000-0x000000013fffffff 256M online yes 19 -0x0000000140000000-0x000000014fffffff 256M offline - 20 -0x0000000150000000-0x000000015fffffff 256M offline - 21 -0x0000000160000000-0x000000016fffffff 256M offline - 22 -0x0000000170000000-0x000000017fffffff 256M offline - 23 - -Memory block size : 256M -Total online memory : 4.8G -Total offline memory: 1.3G - ->lsmem -e -RANGE SIZE STATE REMOVABLE BLOCK NODE -0x0000000000000000-0x000000006fffffff 1.8G online yes 0-6 0 -0x0000000070000000-0x000000007fffffff 256M online no 7 0 -0x0000000080000000-0x000000009fffffff 512M online yes 8-9 0 -0x00000000a0000000-0x00000000bfffffff 512M online no 10-11 0 -0x00000000c0000000-0x00000000dfffffff 512M online yes 12-13 0 -0x00000000e0000000-0x00000000efffffff 256M offline - 14 0 -0x00000000f0000000-0x00000000ffffffff 256M online yes 15 0 -0x0000000100000000-0x000000011fffffff 512M online no 16-17 0 -0x0000000120000000-0x000000013fffffff 512M online yes 18-19 0 -0x0000000140000000-0x000000017fffffff 1G offline - 20-23 0 - -Memory block size : 256M -Total online memory : 4.8G -Total offline memory: 1.3G - ->lsmem -p -a -# RANGE,SIZE,STATE,REMOVABLE,BLOCK,NODE -0x0000000000000000-0x000000000fffffff,268435456,online,yes,0,0 -0x0000000010000000-0x000000001fffffff,268435456,online,yes,1,0 -0x0000000020000000-0x000000002fffffff,268435456,online,yes,2,0 -0x0000000030000000-0x000000003fffffff,268435456,online,yes,3,0 -0x0000000040000000-0x000000004fffffff,268435456,online,yes,4,0 -0x0000000050000000-0x000000005fffffff,268435456,online,yes,5,0 -0x0000000060000000-0x000000006fffffff,268435456,online,yes,6,0 -0x0000000070000000-0x000000007fffffff,268435456,online,no,7,0 -0x0000000080000000-0x000000008fffffff,268435456,online,yes,8,0 -0x0000000090000000-0x000000009fffffff,268435456,online,yes,9,0 -0x00000000a0000000-0x00000000afffffff,268435456,online,no,10,0 -0x00000000b0000000-0x00000000bfffffff,268435456,online,no,11,0 -0x00000000c0000000-0x00000000cfffffff,268435456,online,yes,12,0 -0x00000000d0000000-0x00000000dfffffff,268435456,online,yes,13,0 -0x00000000e0000000-0x00000000efffffff,268435456,offline,-,14,0 -0x00000000f0000000-0x00000000ffffffff,268435456,online,yes,15,0 -0x0000000100000000-0x000000010fffffff,268435456,online,no,16,0 -0x0000000110000000-0x000000011fffffff,268435456,online,no,17,0 -0x0000000120000000-0x000000012fffffff,268435456,online,yes,18,0 -0x0000000130000000-0x000000013fffffff,268435456,online,yes,19,0 -0x0000000140000000-0x000000014fffffff,268435456,offline,-,20,0 -0x0000000150000000-0x000000015fffffff,268435456,offline,-,21,0 -0x0000000160000000-0x000000016fffffff,268435456,offline,-,22,0 -0x0000000170000000-0x000000017fffffff,268435456,offline,-,23,0 + +--- + +$ lsmem +RANGE SIZE STATE REMOVABLE BLOCK +0x0000000000000000-0x000000006fffffff 1.8G online yes 0-6 +0x0000000070000000-0x000000007fffffff 256M online no 7 +0x0000000080000000-0x000000009fffffff 512M online yes 8-9 +0x00000000a0000000-0x00000000bfffffff 512M online no 10-11 +0x00000000c0000000-0x00000000dfffffff 512M online yes 12-13 +0x00000000e0000000-0x00000000efffffff 256M offline - 14 +0x00000000f0000000-0x00000000ffffffff 256M online yes 15 +0x0000000100000000-0x000000011fffffff 512M online no 16-17 +0x0000000120000000-0x000000013fffffff 512M online yes 18-19 +0x0000000140000000-0x000000017fffffff 1G offline - 20-23 + +Memory block size: 256M +Total online memory: 4.8G +Total offline memory: 1.3G + +--- + +$ lsmem --output RANGE,SIZE +RANGE SIZE +0x0000000000000000-0x000000017fffffff 6G + +Memory block size: 256M +Total online memory: 6G +Total offline memory: 0B + +--- + +$ lsmem --output RANGE,SIZE,STATE +RANGE SIZE STATE +0x0000000000000000-0x00000000dfffffff 3.5G online +0x00000000e0000000-0x00000000efffffff 256M offline +0x00000000f0000000-0x000000013fffffff 1.3G online +0x0000000140000000-0x000000017fffffff 1G offline + +Memory block size: 256M +Total online memory: 4.8G +Total offline memory: 1.3G + +--- + +$ lsmem --all --output RANGE,SIZE,STATE,REMOVABLE,BLOCK,NODE +RANGE SIZE STATE REMOVABLE BLOCK NODE +0x0000000000000000-0x000000000fffffff 256M online yes 0 0 +0x0000000010000000-0x000000001fffffff 256M online yes 1 0 +0x0000000020000000-0x000000002fffffff 256M online yes 2 0 +0x0000000030000000-0x000000003fffffff 256M online yes 3 0 +0x0000000040000000-0x000000004fffffff 256M online yes 4 0 +0x0000000050000000-0x000000005fffffff 256M online yes 5 0 +0x0000000060000000-0x000000006fffffff 256M online yes 6 0 +0x0000000070000000-0x000000007fffffff 256M online no 7 0 +0x0000000080000000-0x000000008fffffff 256M online yes 8 0 +0x0000000090000000-0x000000009fffffff 256M online yes 9 0 +0x00000000a0000000-0x00000000afffffff 256M online no 10 0 +0x00000000b0000000-0x00000000bfffffff 256M online no 11 0 +0x00000000c0000000-0x00000000cfffffff 256M online yes 12 0 +0x00000000d0000000-0x00000000dfffffff 256M online yes 13 0 +0x00000000e0000000-0x00000000efffffff 256M offline - 14 0 +0x00000000f0000000-0x00000000ffffffff 256M online yes 15 0 +0x0000000100000000-0x000000010fffffff 256M online no 16 0 +0x0000000110000000-0x000000011fffffff 256M online no 17 0 +0x0000000120000000-0x000000012fffffff 256M online yes 18 0 +0x0000000130000000-0x000000013fffffff 256M online yes 19 0 +0x0000000140000000-0x000000014fffffff 256M offline - 20 0 +0x0000000150000000-0x000000015fffffff 256M offline - 21 0 +0x0000000160000000-0x000000016fffffff 256M offline - 22 0 +0x0000000170000000-0x000000017fffffff 256M offline - 23 0 + +Memory block size: 256M +Total online memory: 4.8G +Total offline memory: 1.3G + +--- + +$ lsmem --raw --output RANGE,SIZE,STATE,REMOVABLE,BLOCK,NODE +RANGE SIZE STATE REMOVABLE BLOCK NODE +0x0000000000000000-0x000000006fffffff 1.8G online yes 0-6 0 +0x0000000070000000-0x000000007fffffff 256M online no 7 0 +0x0000000080000000-0x000000009fffffff 512M online yes 8-9 0 +0x00000000a0000000-0x00000000bfffffff 512M online no 10-11 0 +0x00000000c0000000-0x00000000dfffffff 512M online yes 12-13 0 +0x00000000e0000000-0x00000000efffffff 256M offline - 14 0 +0x00000000f0000000-0x00000000ffffffff 256M online yes 15 0 +0x0000000100000000-0x000000011fffffff 512M online no 16-17 0 +0x0000000120000000-0x000000013fffffff 512M online yes 18-19 0 +0x0000000140000000-0x000000017fffffff 1G offline - 20-23 0 + +--- + +$ lsmem --json --output RANGE,SIZE,STATE,REMOVABLE,BLOCK,NODE +{ + "memory": [ + {"range": "0x0000000000000000-0x000000006fffffff", "size": "1.8G", "state": "online", "removable": "yes", "block": "0-6", "node": "0"}, + {"range": "0x0000000070000000-0x000000007fffffff", "size": "256M", "state": "online", "removable": "no", "block": "7", "node": "0"}, + {"range": "0x0000000080000000-0x000000009fffffff", "size": "512M", "state": "online", "removable": "yes", "block": "8-9", "node": "0"}, + {"range": "0x00000000a0000000-0x00000000bfffffff", "size": "512M", "state": "online", "removable": "no", "block": "10-11", "node": "0"}, + {"range": "0x00000000c0000000-0x00000000dfffffff", "size": "512M", "state": "online", "removable": "yes", "block": "12-13", "node": "0"}, + {"range": "0x00000000e0000000-0x00000000efffffff", "size": "256M", "state": "offline", "removable": "-", "block": "14", "node": "0"}, + {"range": "0x00000000f0000000-0x00000000ffffffff", "size": "256M", "state": "online", "removable": "yes", "block": "15", "node": "0"}, + {"range": "0x0000000100000000-0x000000011fffffff", "size": "512M", "state": "online", "removable": "no", "block": "16-17", "node": "0"}, + {"range": "0x0000000120000000-0x000000013fffffff", "size": "512M", "state": "online", "removable": "yes", "block": "18-19", "node": "0"}, + {"range": "0x0000000140000000-0x000000017fffffff", "size": "1G", "state": "offline", "removable": "-", "block": "20-23", "node": "0"} + ] +} diff --git a/tests/ts/lsmem/lsmem b/tests/ts/lsmem/lsmem index 7e6e2f959c..79c0523b96 100755 --- a/tests/ts/lsmem/lsmem +++ b/tests/ts/lsmem/lsmem @@ -22,6 +22,18 @@ ts_init "$*" ts_check_test_command "$TS_CMD_LSMEM" +LSCOLUMNS="RANGE,SIZE,STATE,REMOVABLE,BLOCK,NODE" + + +function do_lsmem { + local opts="$*" + + echo -e "\n---\n" >>${TS_OUTPUT} + echo "\$ lsmem $opts" >>${TS_OUTPUT} + ${TS_CMD_LSMEM} $opts --sysroot "${dumpdir}/${name}" >>${TS_OUTPUT} 2>&1 + +} + for dump in $(ls $TS_SELF/dumps/*.tar.bz2 | sort); do name=$(basename $dump .tar.bz2) dumpdir="$TS_OUTDIR/dumps" @@ -31,20 +43,12 @@ for dump in $(ls $TS_SELF/dumps/*.tar.bz2 | sort); do tar -C $dumpdir -jxf $dump - echo ">lsmem" >>"${TS_OUTPUT}" - "${TS_CMD_LSMEM}" -s "${dumpdir}/${name}" >>"${TS_OUTPUT}" 2>&1 - - echo >>"${TS_OUTPUT}" - echo ">lsmem -a" >>"${TS_OUTPUT}" - "${TS_CMD_LSMEM}" -a -s "${dumpdir}/${name}" >>"${TS_OUTPUT}" 2>&1 - - echo >>"${TS_OUTPUT}" - echo ">lsmem -e" >>"${TS_OUTPUT}" - "${TS_CMD_LSMEM}" -e -s "${dumpdir}/${name}" >>"${TS_OUTPUT}" 2>&1 - - echo >>"${TS_OUTPUT}" - echo ">lsmem -p -a" >>"${TS_OUTPUT}" - "${TS_CMD_LSMEM}" -p -a -s "${dumpdir}/${name}" >>"${TS_OUTPUT}" 2>&1 + do_lsmem + do_lsmem --output RANGE,SIZE + do_lsmem --output RANGE,SIZE,STATE + do_lsmem --all --output $LSCOLUMNS + do_lsmem --raw --output $LSCOLUMNS + do_lsmem --json --output $LSCOLUMNS ts_finalize_subtest done |