diff options
author | Ross Burton <ross.burton@arm.com> | 2021-08-09 15:25:51 +0100 |
---|---|---|
committer | Brian C. Lane <bcl@redhat.com> | 2021-08-10 14:25:11 -0700 |
commit | 8e97e5f7ad7cc8a1e6233306a45fcdbf08c959bd (patch) | |
tree | a142e1b37ad54a8ba61a0c168d463103ef9e108c /tests | |
parent | b5e17a613d2ea9894fcc090499dcc73e3ea07f61 (diff) | |
download | parted-8e97e5f7ad7cc8a1e6233306a45fcdbf08c959bd.tar.gz |
tests: add a helper to check the kernel knows about a file system
Some tests need both the file system tools (eg mkfs.vfat) and kernel
support (eg vfat kernel module) to pass.
There are already helpers such as require_fat_ which check for mkfs.vfat,
but if the kernel doesn't support the filesystem then mounting the disk
image will fail.
Add require_filesystem_, which checks for either the filesystem name in
/proc/filesystems (so it's built-in, or already loaded) or if the name
is a valid module (so can be loaded on demand).
Signed-off-by: Brian C. Lane <bcl@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/t-lib-helpers.sh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/t-lib-helpers.sh b/tests/t-lib-helpers.sh index dddb44e..33151bb 100644 --- a/tests/t-lib-helpers.sh +++ b/tests/t-lib-helpers.sh @@ -418,3 +418,13 @@ require_64bit_() ;; esac } + +# Check if the specified filesystem is either built into the kernel, or can be loaded +# as a module +# Usage: has_filesystem vfat +# Ruturns 0 if the filesystem is available, otherwise skips the test +require_filesystem_() +{ + grep -q $1 /proc/filesystems && return 0 + modprobe --quiet --dry-run $1 || skip_ "this test requires kernel support for $1" +} |