runtime.vars: add helper to check fstests configuration
authorDavid Disseldorp <ddiss@suse.de>
Wed, 17 May 2017 15:38:58 +0000 (17:38 +0200)
committerDavid Disseldorp <ddiss@suse.de>
Wed, 17 May 2017 15:38:58 +0000 (17:38 +0200)
_rt_require_fstests() checks that the fstests source directory exists,
and that the check executable is present.

This prepares for migration from a FSTESTS_DIR=<parent_path> rapido.conf
parameter, where <parent_path> is assumed to have an immediate xfstests
subdir, to an FSTESTS_SRC=<src_path>. This migration is possible now
that Dracut correctly handles installation of immediate files, when
installed via "dracut --include <dir_path> <initramfs_path>" - this was
broken in previous versions.

Signed-off-by: David Disseldorp <ddiss@suse.de>
runtime.vars

index 841d0c009165a9665482368e7f51e53018c49616..a25007cbf5baa7582ee786c37f3410c51838772a 100644 (file)
@@ -16,6 +16,10 @@ function _fail() {
        exit 1
 }
 
+function _warn() {
+       echo "warning: $*"
+}
+
 # process user defined configuration
 . ${RAPIDO_DIR}/rapido.conf \
        || _fail "rapido.conf missing - see rapido.conf.example"
@@ -94,6 +98,24 @@ function _rt_require_ceph {
        [ -f "$CEPH_KEYRING" ] || _fail "missing $CEPH_KEYRING"
 }
 
+function _rt_require_fstests() {
+       if [ -n "$FSTESTS_DIR" ]; then
+               # FSTESTS_DIR is an old config parameter which was used when
+               # Dracut didn't correctly install files directly nested under
+               # "--include <dir>" paths, only subdirectories were handled.
+               # To work around this, FSTESTS_DIR referred to a path with an
+               # immediate xfstests subdirectory.
+               [ -n "$FSTESTS_SRC" ] \
+                       && _fail "both FSTESTS_DIR and FSTESTS_SRC defined"
+               FSTESTS_SRC="${FSTESTS_DIR}/xfstests"
+               _warn "FSTESTS_DIR deprecated, use FSTESTS_SRC=${FSTESTS_SRC}"
+       fi
+
+       [ -n "$FSTESTS_SRC" ] || _fail "FSTESTS_SRC not configured"
+       [ -d "$FSTESTS_SRC" ] || _fail "missing $FSTESTS_SRC directory"
+       [ -x "$FSTESTS_SRC/check" ] || _fail "missing $FSTESTS_SRC/check"
+}
+
 function _rt_require_zram_params {
        # initramfs ramdisk details
        ZRAM_INITRD_SIZE="1G"