summaryrefslogtreecommitdiff
path: root/test/shell/report-fields.sh
blob: eb81afc98ee5e2932df6e075fa770825793ac5db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/usr/bin/env bash

# Copyright (C) 2015 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

SKIP_WITH_LVMLOCKD=1
SKIP_WITH_LVMPOLLD=1

. lib/inittest

# Test only that there's correct set of fields displayed on output.

aux prepare_pvs 1

OPTS="--nameprefixes --noheadings --rows"

aux lvmconf 'report/pvs_cols="pv_name,pv_size"'
aux lvmconf 'report/compact_output=0'
aux lvmconf 'report/compact_output_cols=""'

pvs $OPTS > out
grep LVM2_PV_NAME out
grep LVM2_PV_SIZE out

pvs $OPTS -o pv_attr > out
grep LVM2_PV_ATTR out
not grep -v LVM2_PV_ATTR out

pvs $OPTS -o+pv_attr > out
grep LVM2_PV_NAME out
grep LVM2_PV_SIZE out
grep LVM2_PV_ATTR out

pvs $OPTS -o-pv_name > out
not grep LVM2_PV_NAME out
grep LVM2_PV_SIZE out

pvs $OPTS -o+pv_attr -o-pv_attr > out
grep LVM2_PV_NAME out
grep LVM2_PV_SIZE out
not grep LVM2_PV_ATTR out

pvs $OPTS -o-pv_attr -o+pv_attr > out
grep LVM2_PV_NAME out
grep LVM2_PV_SIZE out
grep LVM2_PV_ATTR out

pvs $OPTS -o+pv_attr -o-pv_attr -o pv_attr > out
grep LVM2_PV_ATTR out
not grep -v LVM2_PV_ATTR out

# -o-size is the same as -o-pv_size - the prefix is recognized
pvs $OPTS -o-size > out
not grep LVM2_PV_SIZE out

# PV does not have tags nor is it exported if we haven't done that explicitly.
# Check compaction per field is done correctly.
pvs $OPTS -o pv_name,pv_exported,pv_tags -o#pv_tags > out
grep LVM2_PV_NAME out
grep LVM2_PV_EXPORTED out
not grep LVM2_PV_TAGS out

aux lvmconf 'report/compact_output_cols="pv_tags"'

pvs $OPTS -o pv_name,pv_exported,pv_tags > out
grep LVM2_PV_NAME out
grep LVM2_PV_EXPORTED out
not grep LVM2_PV_TAGS out

pvs $OPTS -o pv_name,pv_exported,pv_tags -o#pv_exported > out
grep LVM2_PV_NAME out
not grep LVM2_PV_EXPORTED out
grep LVM2_PV_TAGS out

aux lvmconf 'report/compact_output=1'
pvs $OPTS -o pv_name,pv_exported,pv_tags > out
grep LVM2_PV_NAME out
not grep LVM2_PV_EXPORTED out
not grep LVM2_PV_TAGS out

pvs $OPTS -o pv_name,pv_exported,pv_tags -o#pv_exported > out
grep LVM2_PV_NAME out
not grep LVM2_PV_EXPORTED out
not grep LVM2_PV_TAGS out