2018-06-27 20:47:21 +00:00
|
|
|
{ stdenv, acl, attr, autoconf, automake, bash, bc, coreutils, e2fsprogs
|
|
|
|
, fetchgit, fio, gawk, keyutils, killall, lib, libaio, libcap, libtool
|
2018-07-21 00:44:44 +00:00
|
|
|
, libuuid, libxfs, lvm2, openssl, perl, procps, quota
|
2020-11-24 15:29:28 +00:00
|
|
|
, time, util-linux, which, writeScript, xfsprogs, runtimeShell }:
|
2015-09-04 11:05:03 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
2021-08-02 09:42:46 +00:00
|
|
|
pname = "xfstests";
|
|
|
|
version = "unstable-2019-09-08";
|
2015-09-04 11:05:03 +00:00
|
|
|
|
|
|
|
src = fetchgit {
|
2016-09-01 18:02:47 +00:00
|
|
|
url = "git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git";
|
2019-09-13 15:40:16 +00:00
|
|
|
rev = "0837e907988a5f410cae0ae714f42f9c4242e072";
|
|
|
|
sha256 = "1f5cv0vwc1g9difzp69k49rc5nfd08y72vdg318j25nv3rwv7wc9";
|
2015-09-04 11:05:03 +00:00
|
|
|
};
|
|
|
|
|
2018-04-21 10:52:24 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
autoconf automake libtool
|
|
|
|
];
|
|
|
|
buildInputs = [
|
|
|
|
acl attr gawk libaio libuuid libxfs openssl perl
|
|
|
|
];
|
2015-09-04 11:05:03 +00:00
|
|
|
|
2016-02-26 17:38:15 +00:00
|
|
|
hardeningDisable = [ "format" ];
|
2017-04-01 16:42:41 +00:00
|
|
|
enableParallelBuilding = true;
|
2016-02-20 21:58:30 +00:00
|
|
|
|
2015-09-04 11:05:03 +00:00
|
|
|
patchPhase = ''
|
2019-09-13 15:40:16 +00:00
|
|
|
substituteInPlace Makefile \
|
|
|
|
--replace "cp include/install-sh ." "cp -f include/install-sh ."
|
|
|
|
|
2015-09-04 11:05:03 +00:00
|
|
|
# Patch the destination directory
|
|
|
|
sed -i include/builddefs.in -e "s|^PKG_LIB_DIR\s*=.*|PKG_LIB_DIR=$out/lib/xfstests|"
|
|
|
|
|
|
|
|
# Don't canonicalize path to mkfs (in util-linux) - otherwise e.g. mkfs.ext4 isn't found
|
|
|
|
sed -i common/config -e 's|^export MKFS_PROG=.*|export MKFS_PROG=mkfs|'
|
|
|
|
|
2017-04-01 16:50:09 +00:00
|
|
|
# Move the Linux-specific test output files to the correct place, or else it will
|
|
|
|
# try to move them at runtime. Also nuke all the irix crap.
|
|
|
|
for f in tests/*/*.out.linux; do
|
|
|
|
mv $f $(echo $f | sed -e 's/\.linux$//')
|
|
|
|
done
|
|
|
|
rm -f tests/*/*.out.irix
|
|
|
|
|
|
|
|
# Fix up lots of impure paths
|
2015-09-04 11:05:03 +00:00
|
|
|
for f in common/* tools/* tests/*/*; do
|
|
|
|
sed -i $f -e 's|/bin/bash|${bash}/bin/bash|'
|
|
|
|
sed -i $f -e 's|/bin/true|true|'
|
|
|
|
sed -i $f -e 's|/usr/sbin/filefrag|${e2fsprogs}/bin/filefrag|'
|
|
|
|
sed -i $f -e 's|hostname -s|hostname|' # `hostname -s` seems problematic on NixOS
|
|
|
|
sed -i $f -e 's|$(_yp_active)|1|' # NixOS won't ever have Yellow Pages enabled
|
|
|
|
done
|
|
|
|
|
|
|
|
for f in src/*.c src/*.sh; do
|
|
|
|
sed -e 's|/bin/rm|${coreutils}/bin/rm|' -i $f
|
|
|
|
sed -e 's|/usr/bin/time|${time}/bin/time|' -i $f
|
|
|
|
done
|
|
|
|
|
|
|
|
patchShebangs .
|
|
|
|
'';
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
# The configure scripts really don't like looking in PATH at all...
|
|
|
|
export AWK=$(type -P awk)
|
2017-03-07 09:33:06 +00:00
|
|
|
export ECHO=$(type -P echo)
|
2015-09-04 11:05:03 +00:00
|
|
|
export LIBTOOL=$(type -P libtool)
|
|
|
|
export MAKE=$(type -P make)
|
|
|
|
export SED=$(type -P sed)
|
|
|
|
export SORT=$(type -P sort)
|
2017-07-25 13:53:28 +00:00
|
|
|
|
|
|
|
make configure
|
2015-09-04 11:05:03 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
patchShebangs $out/lib/xfstests
|
|
|
|
|
|
|
|
mkdir -p $out/bin
|
|
|
|
substitute $wrapperScript $out/bin/xfstests-check --subst-var out
|
|
|
|
chmod a+x $out/bin/xfstests-check
|
|
|
|
'';
|
|
|
|
|
|
|
|
# The upstream package is pretty hostile to packaging; it looks up
|
|
|
|
# various paths relative to current working directory, and also
|
|
|
|
# wants to write temporary files there. So create a temporary
|
|
|
|
# to run from and symlink the runtime files to it.
|
|
|
|
wrapperScript = writeScript "xfstests-check" ''
|
2019-02-26 11:45:54 +00:00
|
|
|
#!${runtimeShell}
|
2015-09-04 11:05:03 +00:00
|
|
|
set -e
|
|
|
|
export RESULT_BASE="$(pwd)/results"
|
|
|
|
|
|
|
|
dir=$(mktemp --tmpdir -d xfstests.XXXXXX)
|
|
|
|
trap "rm -rf $dir" EXIT
|
|
|
|
|
|
|
|
chmod a+rx "$dir"
|
|
|
|
cd "$dir"
|
2016-08-11 14:00:22 +00:00
|
|
|
for f in $(cd @out@/lib/xfstests; echo *); do
|
2015-09-04 11:05:03 +00:00
|
|
|
ln -s @out@/lib/xfstests/$f $f
|
|
|
|
done
|
|
|
|
|
2018-06-27 20:47:21 +00:00
|
|
|
export PATH=${lib.makeBinPath [acl attr bc e2fsprogs fio gawk keyutils
|
|
|
|
libcap lvm2 perl procps killall quota
|
2020-11-24 15:29:28 +00:00
|
|
|
util-linux which xfsprogs]}:$PATH
|
2015-09-04 11:05:03 +00:00
|
|
|
exec ./check "$@"
|
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2015-09-04 11:05:03 +00:00
|
|
|
description = "Torture test suite for filesystems";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git/";
|
2015-09-04 11:05:03 +00:00
|
|
|
license = licenses.gpl2;
|
|
|
|
maintainers = [ maintainers.dezgeg ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|