Disk tests added

This commit is contained in:
Alan Marshall 2024-11-12 19:27:36 +00:00
parent 2bd20eed7c
commit 529eff1e84
Signed by: alangm
GPG Key ID: 4DF85D1B967F51A6
9 changed files with 289 additions and 0 deletions

View File

@ -0,0 +1,65 @@
use base "installedtest";
use strict;
use testapi;
use utils;
use disks;
# This script will prepare a disk image with the size of
# 1 GB and will add two partitions to it. This will serve as
# a milestone for other follow-up tests.
#
# This script will test if Disks can create new partitions
# in an empty disk.
sub run {
my $self = shift;
# Switch to the console and perform some pre-settings.
# Switch to the console
$self->root_console(tty => 3);
# Create a disk image in the home folder. We have decided
# to use truncate to be able to create bigger partitions
# that would not require as much space on the disk when
# empty.
script_run("truncate -s 1G /root/disk.img");
# Connect the created partition to the system as a loop device
# using losetup which will make it accessible to the Disks application
# later.
script_run("losetup -P -f --show /root/disk.img");
# Go back to graphics.
desktop_vt();
# Set the update notification_timestamp
set_update_notification_timestamp();
menu_launch_type("disks");
wait_still_screen(3);
# Make it fill the entire window.
send_key("super-up");
wait_still_screen(2);
assert_screen("apps_run_disks");
# Click on the listed icon of the new loop device.
assert_and_click("disks_diskloop_listed");
# Check that the file has been correctly attached.
assert_screen("disks_diskloop_status");
# Format the entire disk with a GPT.
wipe_disk();
# Add partitions.
add_partitions();
}
sub test_flags {
# If this test fails, there is no need to continue.
return {fatal => 1, milestone => 1};
}
1;
# vim: set sw=4 et:

View File

@ -0,0 +1,33 @@
use base "installedtest";
use strict;
use testapi;
use utils;
# This script will open the About dialogue and check
# that it works.
sub run {
# Open the menu
assert_and_click("gnome_burger_menu");
# Click on the About item
assert_and_click("gnome_menu_about");
# Check that the dialogue is shown.
assert_screen("disks_about_shown");
# Click on the Credits button.
assert_and_click("gnome_button_credits");
# Check that Credits are shown.
assert_screen("disks_credits_shown");
# Dismiss the About window using the Esc key.
send_key("esc");
}
sub test_flags {
return {fatal => 0};
}
1;

View File

@ -0,0 +1,22 @@
use base "installedtest";
use strict;
use testapi;
use utils;
use disks;
# This script will test if Disks can delete a partition
# and add a new partition instead.
sub run {
# Select the test disk.
assert_and_click("disks_loopdisk_listed");
# Delete the second partition.
delete_partition("two");
}
sub test_flags {
return {always_rollback => 1};
}
1;

View File

@ -0,0 +1,21 @@
use base "installedtest";
use strict;
use testapi;
use utils;
use disks;
# This script will test if Disks can edit the filesystem name.
sub run {
# Click on the test disk to select it.
assert_and_click("disks_loopdisk_listed");
# Edit the filesystem name.
edit_filesystem("one", "renamed");
}
sub test_flags {
return {always_rollback => 1};
}
1;

View File

@ -0,0 +1,21 @@
use base "installedtest";
use strict;
use testapi;
use utils;
use disks;
# This script will test if Disks can edit the partition name.
sub run {
# Open the menu
assert_and_click("disks_loopdisk_listed");
# Change the type of the partition.
edit_partition("one", "linuxroot", "partroot");
}
sub test_flags {
return {always_rollback => 1};
}
1;

View File

@ -0,0 +1,23 @@
use base "installedtest";
use strict;
use testapi;
use utils;
use disks;
# This script will test if Disks can format an empty
# partition.
sub run {
# Select the test loop disk.
assert_and_click("disks_loopdisk_listed");
# Format partition
format_partition("one", "swap", "backup");
}
sub test_flags {
return {always_rollback => 1};
}
1;

View File

@ -0,0 +1,38 @@
use base "installedtest";
use strict;
use testapi;
use utils;
use disks;
# This script will test if current partitions can be mounted
# via the Disks application.
sub run {
my $self = shift;
# Wipe the entire disk, recreate partitions
wipe_disk();
add_partitions();
# Mount the first partition.
mount_partition("one");
# Mount the second partition.
mount_partition("two");
# Check in the system that the partitions have been mounted.
$self->root_console(tty => 3);
# First partition
assert_script_run("findmnt /dev/loop0p1");
# Second partition
assert_script_run("findmnt /dev/loop0p2");
}
sub test_flags {
return {always_rollback => 1};
}
1;

View File

@ -0,0 +1,28 @@
use base "installedtest";
use strict;
use testapi;
use utils;
use disks;
# This script will test if Disks can resize a partition and
# put a new partition after the resized one.
sub run {
# Select the test loop disk.
assert_and_click("disks_loopdisk_listed");
# Resize the second partition
resize_partition("two", "320");
# Add a new partition to the remainaing space
assert_and_click("disks_free_space");
# Create another partition in the remaining space.
create_partition("terciavolta", "full");
}
sub test_flags {
return {always_rollback => 1};
}
1;

View File

@ -0,0 +1,38 @@
use base "installedtest";
use strict;
use testapi;
use utils;
use disks;
# This script will test if Disks can delete all partitions and
# create three partitions for Standard partitioning, a small boot
# partition, a bigger root partition, and a home partition that
# takes the rest of the space. All partitions will be formatted
# as ext4.
sub run {
# Select the test loop disk.
assert_and_click("disks_loopdisk_listed");
# Remove partitions
wipe_disk();
# Create the partitions (they are formatted as ext4)
create_partition("boot", "200");
assert_and_click("disks_free_space");
create_partition("root", "300");
assert_and_click("disks_free_space");
create_partition("home", "full");
# Mount the partitions
mount_partition("one");
mount_partition("two");
mount_partition("three");
}
sub test_flags {
return {always_rollback => 1};
}
1;