44 lines
1.4 KiB
Diff
44 lines
1.4 KiB
Diff
|
From 8e97e5f7ad7cc8a1e6233306a45fcdbf08c959bd Mon Sep 17 00:00:00 2001
|
||
|
From: Ross Burton <ross.burton@arm.com>
|
||
|
Date: Mon, 9 Aug 2021 15:25:51 +0100
|
||
|
Subject: [PATCH 28/30] 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>
|
||
|
---
|
||
|
tests/t-lib-helpers.sh | 10 ++++++++++
|
||
|
1 file changed, 10 insertions(+)
|
||
|
|
||
|
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"
|
||
|
+}
|
||
|
--
|
||
|
2.31.1
|
||
|
|