diff --git a/lib/anaconda.pm b/lib/anaconda.pm index 9949ec1d..b3bac3b2 100644 --- a/lib/anaconda.pm +++ b/lib/anaconda.pm @@ -8,7 +8,7 @@ use Exporter; use testapi; use utils; -our @EXPORT = qw/select_disks custom_scheme_select custom_blivet_add_partition custom_change_type custom_change_fs custom_change_device custom_delete_part get_full_repo get_mirrorlist_url/; +our @EXPORT = qw/select_disks custom_scheme_select custom_blivet_add_partition custom_blivet_format_partition custom_blivet_resize_partition custom_change_type custom_change_fs custom_change_device custom_delete_part get_full_repo get_mirrorlist_url/; sub select_disks { # Handles disk selection. Has one optional argument - number of @@ -174,6 +174,52 @@ sub custom_blivet_add_partition { } } +sub custom_blivet_format_partition { + # This subroutine formats a selected partition. To use it, you must select the + # partition by other means before you format it using this routine. + # You have to create a needle for any non-existing filesystem that is + # passed via the $type, such as anaconda_blivet_part_select_ext4. + my %args = @_; + # Start editing the partition and select the Format option + assert_and_click "anaconda_blivet_part_edit"; + assert_and_click "anaconda_blivet_part_format"; + # Select the appropriate filesystem type. + assert_and_click "anaconda_blivet_part_drop_select"; + assert_and_click "anaconda_blivet_part_select_$args{type}"; + wait_still_screen 2; + # Fill in the label if needed. + send_key "tab"; + if ($args{label}) { + type_very_safely $args{label}; + } + # Fill in the mountpoint. + send_key "tab"; + type_very_safely $args{mountpoint}; + assert_and_click "anaconda_blivet_part_format_button"; +} + +sub custom_blivet_resize_partition { + # This subroutine resizes the selected (active) partition to a given value. Note, that + # if the selected value is bigger than the available space, it will only be + # resized to fill up the available space no matter the number. + # This routine cannot will not be able to select a particular partition!!! + my %args = @_; + # Start editing the partition and select the Resize option + assert_and_click "anaconda_blivet_part_edit"; + assert_and_click "anaconda_blivet_part_resize"; + # Select the appropriate units. Note, that there must a be needle existing + # for each possible unit that you might want to use, such as + # "anaconda_blivet_size_unit_gib". + assert_and_click "anaconda_blivet_part_drop_select"; + assert_and_click "anaconda_blivet_size_unit_$args{units}"; + # Move back to the value field. + send_key "shift-tab"; + # Type in the new size. + type_very_safely $args{size}; + assert_and_click "anaconda_blivet_part_resize_button"; +} + + sub custom_change_type { # Used to set different device types for specified partition (e.g. # RAID). Should be called when custom partitioning spoke is diff --git a/needles/anaconda/partitioning/blivet/anaconda_blivet_part_drop_select.json b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_drop_select.json new file mode 100644 index 00000000..d4bcdd79 --- /dev/null +++ b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_drop_select.json @@ -0,0 +1,16 @@ +{ + "properties": [], + "tags": [ + "anaconda_blivet_part_fs_select", + "anaconda_blivet_part_drop_select" + ], + "area": [ + { + "xpos": 657, + "ypos": 313, + "width": 18, + "height": 15, + "type": "match" + } + ] +} \ No newline at end of file diff --git a/needles/anaconda/partitioning/blivet/anaconda_blivet_part_drop_select.png b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_drop_select.png new file mode 100644 index 00000000..7802aed5 Binary files /dev/null and b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_drop_select.png differ diff --git a/needles/anaconda/partitioning/blivet/anaconda_blivet_part_edit.json b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_edit.json new file mode 100644 index 00000000..14ad3a7f --- /dev/null +++ b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_edit.json @@ -0,0 +1,15 @@ +{ + "properties": [], + "tags": [ + "anaconda_blivet_part_edit" + ], + "area": [ + { + "xpos": 312, + "ypos": 247, + "width": 19, + "height": 19, + "type": "match" + } + ] +} \ No newline at end of file diff --git a/needles/anaconda/partitioning/blivet/anaconda_blivet_part_edit.png b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_edit.png new file mode 100644 index 00000000..d40a3edb Binary files /dev/null and b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_edit.png differ diff --git a/needles/anaconda/partitioning/blivet/anaconda_blivet_part_format.json b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_format.json new file mode 100644 index 00000000..9182a8a7 --- /dev/null +++ b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_format.json @@ -0,0 +1,15 @@ +{ + "properties": [], + "tags": [ + "anaconda_blivet_part_format" + ], + "area": [ + { + "xpos": 329, + "ypos": 325, + "width": 56, + "height": 15, + "type": "match" + } + ] +} \ No newline at end of file diff --git a/needles/anaconda/partitioning/blivet/anaconda_blivet_part_format.png b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_format.png new file mode 100644 index 00000000..a99e3924 Binary files /dev/null and b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_format.png differ diff --git a/needles/anaconda/partitioning/blivet/anaconda_blivet_part_format_button.json b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_format_button.json new file mode 100644 index 00000000..a8d221ec --- /dev/null +++ b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_format_button.json @@ -0,0 +1,15 @@ +{ + "properties": [], + "tags": [ + "anaconda_blivet_part_format_button" + ], + "area": [ + { + "xpos": 629, + "ypos": 496, + "width": 49, + "height": 16, + "type": "match" + } + ] +} \ No newline at end of file diff --git a/needles/anaconda/partitioning/blivet/anaconda_blivet_part_format_button.png b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_format_button.png new file mode 100644 index 00000000..d18627a3 Binary files /dev/null and b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_format_button.png differ diff --git a/needles/anaconda/partitioning/blivet/anaconda_blivet_part_fs_ext4_selected-20200507.json b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_fs_ext4_selected-20200507.json new file mode 100644 index 00000000..dc03bc74 --- /dev/null +++ b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_fs_ext4_selected-20200507.json @@ -0,0 +1,17 @@ +{ + "area": [ + { + "xpos": 320, + "ypos": 419, + "type": "match", + "width": 171, + "height": 24 + } + ], + "properties": [], + "tags": [ + "LANGUAGE-english", + "anaconda_blivet_part_fs", + "anaconda_blivet_part_fs_ext4_selected" + ] +} \ No newline at end of file diff --git a/needles/anaconda/partitioning/blivet/anaconda_blivet_part_fs_ext4_selected-20200507.png b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_fs_ext4_selected-20200507.png new file mode 100644 index 00000000..63f2592a Binary files /dev/null and b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_fs_ext4_selected-20200507.png differ diff --git a/needles/anaconda/partitioning/blivet/anaconda_blivet_part_resize.json b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_resize.json new file mode 100644 index 00000000..0cf522f1 --- /dev/null +++ b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_resize.json @@ -0,0 +1,15 @@ +{ + "properties": [], + "tags": [ + "anaconda_blivet_part_resize" + ], + "area": [ + { + "xpos": 331, + "ypos": 298, + "width": 43, + "height": 19, + "type": "match" + } + ] +} \ No newline at end of file diff --git a/needles/anaconda/partitioning/blivet/anaconda_blivet_part_resize.png b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_resize.png new file mode 100644 index 00000000..f00c46d1 Binary files /dev/null and b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_resize.png differ diff --git a/needles/anaconda/partitioning/blivet/anaconda_blivet_part_resize_button.json b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_resize_button.json new file mode 100644 index 00000000..14f7f102 --- /dev/null +++ b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_resize_button.json @@ -0,0 +1,15 @@ +{ + "properties": [], + "tags": [ + "anaconda_blivet_part_resize_button" + ], + "area": [ + { + "xpos": 718, + "ypos": 434, + "width": 41, + "height": 16, + "type": "match" + } + ] +} \ No newline at end of file diff --git a/needles/anaconda/partitioning/blivet/anaconda_blivet_part_resize_button.png b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_resize_button.png new file mode 100644 index 00000000..77f2f9f6 Binary files /dev/null and b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_resize_button.png differ diff --git a/needles/anaconda/partitioning/blivet/anaconda_blivet_part_root_inactive.json b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_root_inactive.json new file mode 100644 index 00000000..9e9912b3 --- /dev/null +++ b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_root_inactive.json @@ -0,0 +1,15 @@ +{ + "properties": [], + "tags": [ + "anaconda_blivet_part_root_inactive" + ], + "area": [ + { + "xpos": 559, + "ypos": 186, + "width": 45, + "height": 16, + "type": "match" + } + ] +} \ No newline at end of file diff --git a/needles/anaconda/partitioning/blivet/anaconda_blivet_part_root_inactive.png b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_root_inactive.png new file mode 100644 index 00000000..84448b89 Binary files /dev/null and b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_root_inactive.png differ diff --git a/needles/anaconda/partitioning/blivet/anaconda_blivet_part_select_ext4.json b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_select_ext4.json new file mode 100644 index 00000000..a9d7c0cd --- /dev/null +++ b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_select_ext4.json @@ -0,0 +1,15 @@ +{ + "properties": [], + "tags": [ + "anaconda_blivet_part_select_ext4" + ], + "area": [ + { + "xpos": 519, + "ypos": 315, + "width": 31, + "height": 17, + "type": "match" + } + ] +} \ No newline at end of file diff --git a/needles/anaconda/partitioning/blivet/anaconda_blivet_part_select_ext4.png b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_select_ext4.png new file mode 100644 index 00000000..b876b8ce Binary files /dev/null and b/needles/anaconda/partitioning/blivet/anaconda_blivet_part_select_ext4.png differ diff --git a/needles/anaconda/partitioning/blivet/anaconda_blivet_size_unit_gib.json b/needles/anaconda/partitioning/blivet/anaconda_blivet_size_unit_gib.json new file mode 100644 index 00000000..09dcef5d --- /dev/null +++ b/needles/anaconda/partitioning/blivet/anaconda_blivet_size_unit_gib.json @@ -0,0 +1,16 @@ +{ + "area": [ + { + "xpos": 714, + "ypos": 314, + "width": 28, + "height": 17, + "type": "match" + } + ], + "properties": [], + "tags": [ + "anaconda_blivet_size_unit_gib", + "anaconda_blivet_size_unit_GiB" + ] +} \ No newline at end of file diff --git a/needles/anaconda/partitioning/blivet/anaconda_blivet_size_unit_mib-20200116.png b/needles/anaconda/partitioning/blivet/anaconda_blivet_size_unit_gib.png similarity index 100% rename from needles/anaconda/partitioning/blivet/anaconda_blivet_size_unit_mib-20200116.png rename to needles/anaconda/partitioning/blivet/anaconda_blivet_size_unit_gib.png diff --git a/needles/anaconda/partitioning/blivet/anaconda_blivet_size_unit_mib-20200116.json b/needles/anaconda/partitioning/blivet/anaconda_blivet_size_unit_mib.json similarity index 100% rename from needles/anaconda/partitioning/blivet/anaconda_blivet_size_unit_mib-20200116.json rename to needles/anaconda/partitioning/blivet/anaconda_blivet_size_unit_mib.json diff --git a/needles/anaconda/partitioning/blivet/anaconda_blivet_size_unit_mib.png b/needles/anaconda/partitioning/blivet/anaconda_blivet_size_unit_mib.png new file mode 100644 index 00000000..7e31750e Binary files /dev/null and b/needles/anaconda/partitioning/blivet/anaconda_blivet_size_unit_mib.png differ diff --git a/tests/disk_custom_blivet_resize.pm b/tests/disk_custom_blivet_resize.pm new file mode 100644 index 00000000..f978538c --- /dev/null +++ b/tests/disk_custom_blivet_resize.pm @@ -0,0 +1,53 @@ +use base "anacondatest"; +use strict; +use testapi; +use anaconda; +use utils; + +sub run { + my $self = shift; + # Navigate to "Installation destionation" and select blivet-gui + # to manipulate the partitions. This will be automatically + # done using the following method, because PARTITIONING starts + # with "custom_blivet". + select_disks(); + assert_and_click "anaconda_spoke_done"; + + # The following procedure will use Blivet to resize the root partition from + # a previous Linux installation and prepare the disk for new installation + # which will be then followed through. + + # Partitioning starts out of the LVM on VD1. We will use it to recreate + # the "/boot" partition in there. + custom_blivet_format_partition(type => 'ext4', label => 'boot', mountpoint => '/boot'); + + # Select the LVM root partition, resize it, and format it. + assert_and_click "anaconda_blivet_volumes_icon"; + if (check_screen "anaconda_blivet_part_root_inactive") { + # If the root partition is not active, click on it to + # activate it. + assert_and_click "anaconda_blivet_part_root_inactive"; + } + custom_blivet_resize_partition(size => '13', units => 'GiB'); + + # Now format the resized root partition + custom_blivet_format_partition(type => 'ext4', label => 'root', mountpoint => '/'); + + # Select the newly created free space + assert_and_click "anaconda_blivet_free_space"; + + # Create a partition and format it. + custom_blivet_add_partition(filesystem => 'ext4', mountpoint => '/home'); + + # Close the spoke. + assert_and_click "anaconda_spoke_done"; + + # Confirm changes + assert_and_click "anaconda_part_accept_changes"; +} + +sub test_flags { + return { fatal => 1 }; +} + +1;