Skip to contentSkip to conversation

ktest: update ndctl and xfstests

RFC New Matthew Wilcox 1 participant 1 message Jun 15, 2018 VFS

lore
Share & tools
lore
#0 lore raw

RFC 1/1 ktest: update ndctl and xfstests

This makes them part of the root image. I didn't see any existing code for automatically installing these things. There's no attempt to check and magically install dependencies ... but I do skip rebuilding them if they haven't been updated since last git pull.

root_image +38 -0
index 42f9293..6861949 100755
@@ -195,12 +195,50 @@ ZZ
     sed -i s/$/-kvm/ "$MNT/etc/hostname"
 }
 
+update_git()
+{
+    if [ -d $1 ]; then
+	cd $1
+	git fetch
+	if cmp -n40 -s .git/FETCH_HEAD .git/refs/heads/master; then
+	    cd ..
+	    exit 0;
+	fi
+	git merge FETCH_HEAD
+    else
+	git clone $2
+	cd $1
+    fi
+    case $1 in
+	ndctl)
+	    ./autogen.sh
+	    ./configure CFLAGS='-g -O2' --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib
+	    ;;
+    esac
+    make
+    make DESTDIR=$MNT install
+    case $1 in
+	xfstests-dev)
+# need to make these not fail if the user already exists -- help?
+#	    _chroot "$MNT" useradd fsgqa
+#	    _chroot "$MNT" groupadd fsgqa
+#	    _chroot "$MNT" useradd 123456-fsgqa
+	    ;;
+    esac
+    cd ..
+}
+
 update_packages()
 {
     _chroot "$MNT" apt update
     _chroot "$MNT" apt upgrade -y
     _chroot "$MNT" apt install -y "${PACKAGES[@]}"
     rm -f "$MNT/var/cache/apt/archives/*.deb"
+
+    # ndctl is not yet available as a Debian package
+    update_git ndctl https://github.com/pmem/ndctl.git
+    # we want the latest version of xfstests from git
+    update_git xfstests-dev
 }
 
 trim_image()