|
Packit |
9e4112 |
#!/bin/sh
|
|
Packit |
9e4112 |
# Test df's behavior for skipping the pseudo "rootfs" file system.
|
|
Packit |
9e4112 |
|
|
Packit |
9e4112 |
# Copyright (C) 2012-2018 Free Software Foundation, Inc.
|
|
Packit |
9e4112 |
|
|
Packit |
9e4112 |
# This program is free software: you can redistribute it and/or modify
|
|
Packit |
9e4112 |
# it under the terms of the GNU General Public License as published by
|
|
Packit |
9e4112 |
# the Free Software Foundation, either version 3 of the License, or
|
|
Packit |
9e4112 |
# (at your option) any later version.
|
|
Packit |
9e4112 |
|
|
Packit |
9e4112 |
# This program is distributed in the hope that it will be useful,
|
|
Packit |
9e4112 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
9e4112 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit |
9e4112 |
# GNU General Public License for more details.
|
|
Packit |
9e4112 |
|
|
Packit |
9e4112 |
# You should have received a copy of the GNU General Public License
|
|
Packit |
9e4112 |
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
Packit |
9e4112 |
|
|
Packit |
9e4112 |
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
|
|
Packit |
9e4112 |
print_ver_ df
|
|
Packit |
9e4112 |
|
|
Packit |
9e4112 |
# Protect against inaccessible remote mounts etc.
|
|
Packit |
9e4112 |
timeout 10 df || skip_ "df fails"
|
|
Packit |
9e4112 |
|
|
Packit |
9e4112 |
# Verify that rootfs is in mtab (and shown when the -a option is specified).
|
|
Packit |
9e4112 |
# Note this is the case when /proc/self/mountinfo is parsed
|
|
Packit |
9e4112 |
# rather than /proc/mounts. I.e., when libmount is being used.
|
|
Packit |
9e4112 |
df -a >out || fail=1
|
|
Packit |
9e4112 |
grep '^rootfs' out || skip_ 'no rootfs in mtab'
|
|
Packit |
9e4112 |
|
|
Packit |
9e4112 |
# Ensure that rootfs is suppressed when no options is specified.
|
|
Packit |
9e4112 |
df >out || fail=1
|
|
Packit |
9e4112 |
grep '^rootfs' out && { fail=1; cat out; }
|
|
Packit |
9e4112 |
|
|
Packit |
9e4112 |
# Ensure that rootfs is yet skipped when explicitly specifying "-t rootfs".
|
|
Packit |
9e4112 |
# As df emits "no file systems processed" in this case, it would be a failure
|
|
Packit |
9e4112 |
# if df exited with status Zero.
|
|
Packit |
9e4112 |
returns_ 1 df -t rootfs >out || fail=1
|
|
Packit |
9e4112 |
grep '^rootfs' out && { fail=1; cat out; }
|
|
Packit |
9e4112 |
|
|
Packit |
9e4112 |
# Ensure that the rootfs is shown when explicitly both specifying "-t rootfs"
|
|
Packit |
9e4112 |
# and the -a option.
|
|
Packit |
9e4112 |
df -t rootfs -a >out || fail=1
|
|
Packit |
9e4112 |
grep '^rootfs' out || { fail=1; cat out; }
|
|
Packit |
9e4112 |
|
|
Packit |
9e4112 |
# Ensure that the rootfs is omitted in all_fs mode when it is explicitly
|
|
Packit |
9e4112 |
# black-listed.
|
|
Packit |
9e4112 |
df -a -x rootfs >out || fail=1
|
|
Packit |
9e4112 |
grep '^rootfs' out && { fail=1; cat out; }
|
|
Packit |
9e4112 |
|
|
Packit |
9e4112 |
test "$fail" = 1 && dump_mount_list_
|
|
Packit |
9e4112 |
|
|
Packit |
9e4112 |
Exit $fail
|