diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2020-02-21 20:49:46 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2020-02-22 00:45:42 +0100 |
| commit | 43e282accc17c8ff2156448e4e8fdd0d04d7ba1c (patch) | |
| tree | d7a68cfeae8852bf569cee69a84a3878b8c3658d | |
| parent | 5c04b00cf463a543b8ffc9eb55991f6b4cc145dd (diff) | |
tests: Factorize LUKS passphrase.
* gnu/tests/install.scm (%luks-passphrase): New variable.
(%encrypted-root-installation-script): Use it.
(enter-luks-passphrase): Use it.
| -rw-r--r-- | gnu/tests/install.scm | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm index d475bda2c79..335efbd468d 100644 --- a/gnu/tests/install.scm +++ b/gnu/tests/install.scm | |||
| @@ -651,9 +651,13 @@ by 'mdadm'.") | |||
| 651 | (guix combinators))))) | 651 | (guix combinators))))) |
| 652 | %base-services)))) | 652 | %base-services)))) |
| 653 | 653 | ||
| 654 | (define %luks-passphrase | ||
| 655 | ;; LUKS encryption passphrase used in tests. | ||
| 656 | "thepassphrase") | ||
| 657 | |||
| 654 | (define %encrypted-root-installation-script | 658 | (define %encrypted-root-installation-script |
| 655 | ;; Shell script of a simple installation. | 659 | ;; Shell script of a simple installation. |
| 656 | "\ | 660 | (string-append "\ |
| 657 | . /etc/profile | 661 | . /etc/profile |
| 658 | set -e -x | 662 | set -e -x |
| 659 | guix --version | 663 | guix --version |
| @@ -665,9 +669,9 @@ parted --script /dev/vdb mklabel gpt \\ | |||
| 665 | mkpart primary ext2 3M 1.4G \\ | 669 | mkpart primary ext2 3M 1.4G \\ |
| 666 | set 1 boot on \\ | 670 | set 1 boot on \\ |
| 667 | set 1 bios_grub on | 671 | set 1 bios_grub on |
| 668 | echo -n thepassphrase | \\ | 672 | echo -n " %luks-passphrase " | \\ |
| 669 | cryptsetup luksFormat --uuid=12345678-1234-1234-1234-123456789abc -q /dev/vdb2 - | 673 | cryptsetup luksFormat --uuid=12345678-1234-1234-1234-123456789abc -q /dev/vdb2 - |
| 670 | echo -n thepassphrase | \\ | 674 | echo -n " %luks-passphrase " | \\ |
| 671 | cryptsetup open --type luks --key-file - /dev/vdb2 the-root-device | 675 | cryptsetup open --type luks --key-file - /dev/vdb2 the-root-device |
| 672 | mkfs.ext4 -L my-root /dev/mapper/the-root-device | 676 | mkfs.ext4 -L my-root /dev/mapper/the-root-device |
| 673 | mount LABEL=my-root /mnt | 677 | mount LABEL=my-root /mnt |
| @@ -677,7 +681,7 @@ cp /etc/target-config.scm /mnt/etc/config.scm | |||
| 677 | guix system build /mnt/etc/config.scm | 681 | guix system build /mnt/etc/config.scm |
| 678 | guix system init /mnt/etc/config.scm /mnt --no-substitutes | 682 | guix system init /mnt/etc/config.scm /mnt --no-substitutes |
| 679 | sync | 683 | sync |
| 680 | reboot\n") | 684 | reboot\n")) |
| 681 | 685 | ||
| 682 | (define (enter-luks-passphrase marionette) | 686 | (define (enter-luks-passphrase marionette) |
| 683 | "Return a gexp to be inserted in the basic system test running on MARIONETTE | 687 | "Return a gexp to be inserted in the basic system test running on MARIONETTE |
| @@ -698,7 +702,8 @@ to enter the LUKS passphrase." | |||
| 698 | ;; when the passphrase should be entered. | 702 | ;; when the passphrase should be entered. |
| 699 | (wait-for-screen-text #$marionette passphrase-prompt? | 703 | (wait-for-screen-text #$marionette passphrase-prompt? |
| 700 | #:ocrad #$ocrad) | 704 | #:ocrad #$ocrad) |
| 701 | (marionette-type "thepassphrase\n" #$marionette) | 705 | (marionette-type #$(string-append %luks-passphrase "\n") |
| 706 | #$marionette) | ||
| 702 | 707 | ||
| 703 | ;; Now wait until we leave the boot screen. This is necessary so | 708 | ;; Now wait until we leave the boot screen. This is necessary so |
| 704 | ;; we can then be sure we match the "Enter passphrase" prompt from | 709 | ;; we can then be sure we match the "Enter passphrase" prompt from |
| @@ -714,7 +719,8 @@ to enter the LUKS passphrase." | |||
| 714 | (wait-for-screen-text #$marionette passphrase-prompt? | 719 | (wait-for-screen-text #$marionette passphrase-prompt? |
| 715 | #:ocrad #$ocrad | 720 | #:ocrad #$ocrad |
| 716 | #:timeout 60) | 721 | #:timeout 60) |
| 717 | (marionette-type "thepassphrase\n" #$marionette) | 722 | (marionette-type #$(string-append %luks-passphrase "\n") |
| 723 | #$marionette) | ||
| 718 | 724 | ||
| 719 | ;; Take a screenshot for debugging purposes. | 725 | ;; Take a screenshot for debugging purposes. |
| 720 | (marionette-control (string-append "screendump " #$output | 726 | (marionette-control (string-append "screendump " #$output |
