mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-09-21 12:38:41 +03:00
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>
This commit is contained in:
parent
2518521108
commit
b262225972
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user