fstests: add _require_sysctl_variable helper
authorEric Sandeen <sandeen@redhat.com>
Mon, 18 May 2020 16:11:31 +0000 (11:11 -0500)
committerEryu Guan <guaneryu@gmail.com>
Sun, 24 May 2020 14:49:59 +0000 (22:49 +0800)
New _require_sysctl_variable test to ensure that the sysctl we wish to
test is available on the system.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/rc

index b25cad0ed8b098c51807e878a465247679ae618c..629520367db7cfda6a02c17800c438d19597fd25 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -4209,6 +4209,12 @@ _require_bsd_process_accounting()
        $ACCTON_PROG off >> $seqres.full
 }
 
+_require_sysctl_variable()
+{
+       local name=$1
+       sysctl $name &>/dev/null || _notrun "$name sysctl unavailable"
+}
+
 init_rc
 
 ################################################################################