Merge pull request #236830 from helsinki-systems/fix/lvm2-thinpool-test-older-kernel

nixos/tests/lvm2/thinpool: fix xfs creation on older kernels
This commit is contained in:
Ryan Lahfa 2023-06-09 16:22:57 +02:00 committed by GitHub
commit 64a245838f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -2,7 +2,7 @@
, config ? { }
, pkgs ? import ../../.. { inherit system config; }
, lib ? pkgs.lib
, kernelVersionsToTest ? [ "4.19" "5.4" "5.10" "5.15" "latest" ]
, kernelVersionsToTest ? [ "4.19" "5.4" "5.10" "5.15" "6.1" "latest" ]
}:
# For quickly running a test, the nixosTests.lvm2.lvm-thinpool-linux-latest attribute is recommended

View File

@ -1,5 +1,5 @@
{ kernelPackages ? null }:
import ../make-test-python.nix ({ pkgs, ... }: {
import ../make-test-python.nix ({ pkgs, lib, ... }: {
name = "lvm2-thinpool";
meta.maintainers = with pkgs.lib.maintainers; [ ajs124 ];
@ -17,11 +17,13 @@ import ../make-test-python.nix ({ pkgs, ... }: {
boot = lib.mkIf (kernelPackages != null) { inherit kernelPackages; };
};
testScript = ''
testScript = let
mkXfsFlags = lib.optionalString (lib.versionOlder kernelPackages.kernel.version "5.10") "-m bigtime=0 -m inobtcount=0";
in ''
machine.succeed("vgcreate test_vg /dev/vdb")
machine.succeed("lvcreate -L 512M -T test_vg/test_thin_pool")
machine.succeed("lvcreate -n test_lv -V 16G --thinpool test_thin_pool test_vg")
machine.succeed("mkfs.xfs /dev/test_vg/test_lv")
machine.succeed("mkfs.xfs ${mkXfsFlags} /dev/test_vg/test_lv")
machine.succeed("mkdir /mnt; mount /dev/test_vg/test_lv /mnt")
assert "/dev/mapper/test_vg-test_lv" == machine.succeed("findmnt -no SOURCE /mnt").strip()
machine.succeed("dd if=/dev/zero of=/mnt/empty.file bs=1M count=1024")