#!/usr/bin/perl -T BEGIN { require "./debian/tests/utils/mock.pm"; CryptrootTest::Mock::->import(); } my %passphrases; $passphrases{$_} = $_ foreach qw/testvg-lv0_crypt testvg-lv1_crypt md0_crypt vdd_crypt/; unlock_disk(\%passphrases) for 1 .. scalar(%passphrases); # check that the above was done at initramfs stage expect($SERIAL => qr#\bRunning /scripts/init-bottom\s*\.\.\. #); login("root"); # make sure the root FS and swap are help by dm-crypt devices shell(q{cryptsetup luksOpen --test-passphrase /dev/md0 << 0); shell(q{cryptsetup luksOpen --test-passphrase /dev/vdd << 0); shell(q{cryptsetup luksOpen --test-passphrase /dev/testvg/lv1 << 0); my $out = shell(q{lsblk -in -oNAME,TYPE,MOUNTPOINT /dev/vda3}); die unless $out =~ m#^[`|]-testvg-lv0\s+lvm\s*$#m; die unless $out =~ m#^[| ] `-testvg-lv0_crypt\s+crypt\s+\[SWAP\]\s*$#m; die unless $out =~ m#^[`|]-testvg-lv1\s+lvm\s*$#m; die unless $out =~ m#^[| ] `-testvg-lv1_crypt\s+crypt\s*$#m; die unless $out =~ m#^[| ] `-md0\s+raid1\s*$#m; die unless $out =~ m#^[| ] `-md0_crypt\s+crypt(?:\s+/(?:home|usr|var)?)?\s*$#m; $out = shell(q{lsblk -in -oNAME,TYPE,MOUNTPOINT /dev/vdb}); die unless $out =~ m#^`-testvg-lv1\s+lvm\s*$#m; die unless $out =~ m#^ `-testvg-lv1_crypt\s+crypt\s*$#m; die unless $out =~ m#^ `-md0\s+raid1\s*$#m; die unless $out =~ m#^ `-md0_crypt\s+crypt(?:\s+/(?:home|usr|var)?)?\s*$#m; $out = shell(q{lsblk -in -oNAME,TYPE,MOUNTPOINT /dev/vdc}); die unless $out =~ m#^`-md0\s+raid1\s*$#m; die unless $out =~ m#^ `-md0_crypt\s+crypt(?:\s+/(?:home|usr|var)?)?\s*$#m; $out = shell(q{btrfs filesystem show /}); die unless $out =~ m#^\s*devid\s+1\s.*\s/dev/mapper/vdd_crypt\s*$#m; die unless $out =~ m#^\s*devid\s+2\s.*\s/dev/mapper/md0_crypt\s*$#m; QMP::quit();