2 # Test df's behavior for skipping the pseudo "rootfs" file system.
4 # Copyright (C) 2012-2017 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 .
"${srcdir=.}/tests/init.sh"; path_prepend_ .
/src
22 # Protect against inaccessible remote mounts etc.
23 timeout
10 df || skip_
"df fails"
25 # Verify that rootfs is in mtab (and shown when the -a option is specified).
26 # Note this is the case when /proc/self/mountinfo is parsed
27 # rather than /proc/mounts. I.e., when libmount is being used.
29 grep '^rootfs' out || skip_
'no rootfs in mtab'
31 # Ensure that rootfs is suppressed when no options is specified.
33 grep '^rootfs' out
&& { fail
=1; cat out
; }
35 # Ensure that rootfs is yet skipped when explicitly specifying "-t rootfs".
36 # As df emits "no file systems processed" in this case, it would be a failure
37 # if df exited with status Zero.
38 returns_
1 df
-t rootfs
>out || fail
=1
39 grep '^rootfs' out
&& { fail
=1; cat out
; }
41 # Ensure that the rootfs is shown when explicitly both specifying "-t rootfs"
43 df
-t rootfs
-a >out || fail
=1
44 grep '^rootfs' out ||
{ fail
=1; cat out
; }
46 # Ensure that the rootfs is omitted in all_fs mode when it is explicitly
48 df
-a -x rootfs
>out || fail
=1
49 grep '^rootfs' out
&& { fail
=1; cat out
; }
51 test "$fail" = 1 && dump_mount_list_