diff options
author | aszlig <aszlig@redmoonstudios.org> | 2013-07-01 00:47:56 +0200 |
---|---|---|
committer | aszlig <aszlig@redmoonstudios.org> | 2013-07-01 19:05:38 +0200 |
commit | b262225972114023ac3199b5ca8ebcb508bfa828 (patch) | |
tree | f6242db7bc28588acfb5438319207c205d678d48 /tests | |
parent | 2518521108cb41ea3acc84feb8e8bf188a62f3c4 (diff) | |
download | nixpkgs-b262225972114023ac3199b5ca8ebcb508bfa828.tar nixpkgs-b262225972114023ac3199b5ca8ebcb508bfa828.tar.gz nixpkgs-b262225972114023ac3199b5ca8ebcb508bfa828.tar.bz2 nixpkgs-b262225972114023ac3199b5ca8ebcb508bfa828.tar.lz nixpkgs-b262225972114023ac3199b5ca8ebcb508bfa828.tar.xz nixpkgs-b262225972114023ac3199b5ca8ebcb508bfa828.tar.zst nixpkgs-b262225972114023ac3199b5ca8ebcb508bfa828.zip |
tests/partition: Check if nixpart loses mounts.
As the whole partitioning run is quite an invasive procedure, we want to especially make sure that it doesn't unmount any filesystems that were mounted before the partitioner was run. Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/partition.nix | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/partition.nix b/tests/partition.nix index 4cee14e4e5c..0051b290c92 100644 --- a/tests/partition.nix +++ b/tests/partition.nix @@ -65,12 +65,23 @@ in { testScript = '' my $diskStart; + my @mtab; + + sub getMtab { + my $mounts = $machine->succeed("cat /proc/mounts"); + chomp $mounts; + return map [split], split /\n/, $mounts; + } sub parttest { my ($desc, $code) = @_; $machine->start; $machine->waitForUnit("default.target"); + + # Gather mounts and superblock + @mtab = getMtab; $diskStart = $machine->succeed("dd if=/dev/vda bs=512 count=1"); + subtest($desc, $code); $machine->shutdown; } @@ -83,6 +94,21 @@ in { "something into the first 512 bytes of /dev/vda!"); die; } + + # Check whether nixpart has unmounted anything + my @currentMtab = getMtab; + for my $mount (@mtab) { + my $path = $mount->[1]; + unless (grep { $_->[1] eq $path } @currentMtab) { + $machine->log("The partitioner seems to have unmounted $path."); + die; + } + } + } + + sub checkMount { + my $mounts = $machine->succeed("cat /proc/mounts"); + } sub kickstart { |