]> git.ipfire.org Git - thirdparty/util-linux.git/blob - tests/ts/lsmem/lsmem
cleanup: Remove some spurious spaces
[thirdparty/util-linux.git] / tests / ts / lsmem / lsmem
1 #!/bin/bash
2 #
3 # This file is part of util-linux.
4 #
5 # This file is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # This file is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #
18 TS_TOPDIR="${0%/*}/../.."
19 . $TS_TOPDIR/functions.sh
20
21 ts_init "$*"
22
23 ts_check_test_command "$TS_CMD_LSMEM"
24 ts_check_prog "tar"
25 ts_check_prog "bzip2"
26
27 LSCOLUMNS="RANGE,SIZE,STATE,REMOVABLE,BLOCK,NODE"
28
29
30 function do_lsmem {
31 local opts="$*"
32
33 echo -e "\n---\n" >>${TS_OUTPUT}
34 echo "\$ lsmem $opts" >>${TS_OUTPUT}
35 ${TS_CMD_LSMEM} $opts --sysroot "${dumpdir}/${name}" >> $TS_OUTPUT 2>> $TS_ERRLOG
36
37 }
38
39 for dump in $(ls $TS_SELF/dumps/*.tar.bz2 | sort); do
40 name=$(basename $dump .tar.bz2)
41 dumpdir="$TS_OUTDIR/dumps"
42
43 ts_init_subtest $name
44 mkdir -p $dumpdir
45
46 tar -C $dumpdir -jxf $dump
47
48 do_lsmem --split=STATE,REMOVABLE
49 do_lsmem --output RANGE,SIZE --split none
50 do_lsmem --output RANGE,SIZE,STATE --split STATE
51 do_lsmem --all --output $LSCOLUMNS
52 do_lsmem --raw --output $LSCOLUMNS --split $LSCOLUMNS
53 do_lsmem --json --output $LSCOLUMNS --split $LSCOLUMNS
54 do_lsmem -o +ZONES
55 do_lsmem
56
57 ts_finalize_subtest
58 done
59
60 ts_finalize