👷 gucc: replace all require + == with require_eq in tests

This commit is contained in:
Vladislav Nepogodin 2024-08-09 15:05:40 +04:00
parent b3929ef98e
commit ce3da4affe
No known key found for this signature in database
GPG Key ID: B62C3D10C54D5DA9
9 changed files with 96 additions and 96 deletions

View File

@ -42,8 +42,8 @@ TEST_CASE("BTRFS test")
gucc::fs::Partition{.fstype = "fat32"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s}, gucc::fs::Partition{.fstype = "fat32"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s},
}; };
REQUIRE(gucc::fs::btrfs_append_subvolumes(partitions, subvolumes)); REQUIRE(gucc::fs::btrfs_append_subvolumes(partitions, subvolumes));
REQUIRE(partitions.size() == 4); REQUIRE_EQ(partitions.size(), 4);
REQUIRE(partitions == expected_partitions); REQUIRE_EQ(partitions, expected_partitions);
} }
SECTION("invalid btrfs with subvolumes") SECTION("invalid btrfs with subvolumes")
{ {
@ -58,8 +58,8 @@ TEST_CASE("BTRFS test")
gucc::fs::Partition{.fstype = "fat32"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s}, gucc::fs::Partition{.fstype = "fat32"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s},
}; };
REQUIRE(!gucc::fs::btrfs_append_subvolumes(partitions, subvolumes)); REQUIRE(!gucc::fs::btrfs_append_subvolumes(partitions, subvolumes));
REQUIRE(partitions.size() == 3); REQUIRE_EQ(partitions.size(), 3);
REQUIRE(partitions == expected_partitions); REQUIRE_EQ(partitions, expected_partitions);
} }
SECTION("invalid (without root part) btrfs with subvolumes") SECTION("invalid (without root part) btrfs with subvolumes")
{ {
@ -74,8 +74,8 @@ TEST_CASE("BTRFS test")
gucc::fs::Partition{.fstype = "fat32"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s}, gucc::fs::Partition{.fstype = "fat32"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s},
}; };
REQUIRE(!gucc::fs::btrfs_append_subvolumes(partitions, subvolumes)); REQUIRE(!gucc::fs::btrfs_append_subvolumes(partitions, subvolumes));
REQUIRE(partitions.size() == 3); REQUIRE_EQ(partitions.size(), 3);
REQUIRE(partitions == expected_partitions); REQUIRE_EQ(partitions, expected_partitions);
} }
SECTION("btrfs without subvolumes") SECTION("btrfs without subvolumes")
{ {
@ -88,8 +88,8 @@ TEST_CASE("BTRFS test")
gucc::fs::Partition{.fstype = "fat32"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s}, gucc::fs::Partition{.fstype = "fat32"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s},
}; };
REQUIRE(gucc::fs::btrfs_append_subvolumes(partitions, {})); REQUIRE(gucc::fs::btrfs_append_subvolumes(partitions, {}));
REQUIRE(partitions.size() == 2); REQUIRE_EQ(partitions.size(), 2);
REQUIRE(partitions == expected_partitions); REQUIRE_EQ(partitions, expected_partitions);
} }
SECTION("luks xfs") SECTION("luks xfs")
{ {
@ -104,7 +104,7 @@ TEST_CASE("BTRFS test")
gucc::fs::Partition{.fstype = "vfat"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s}, gucc::fs::Partition{.fstype = "vfat"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s},
}; };
REQUIRE(!gucc::fs::btrfs_append_subvolumes(partitions, subvolumes)); REQUIRE(!gucc::fs::btrfs_append_subvolumes(partitions, subvolumes));
REQUIRE(partitions == expected_partitions); REQUIRE_EQ(partitions, expected_partitions);
} }
SECTION("valid zfs") SECTION("valid zfs")
{ {
@ -121,7 +121,7 @@ TEST_CASE("BTRFS test")
gucc::fs::Partition{.fstype = "vfat"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s}, gucc::fs::Partition{.fstype = "vfat"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s},
}; };
REQUIRE(!gucc::fs::btrfs_append_subvolumes(partitions, subvolumes)); REQUIRE(!gucc::fs::btrfs_append_subvolumes(partitions, subvolumes));
REQUIRE(partitions == expected_partitions); REQUIRE_EQ(partitions, expected_partitions);
} }
SECTION("luks btrfs with subvolumes") SECTION("luks btrfs with subvolumes")
{ {
@ -136,7 +136,7 @@ TEST_CASE("BTRFS test")
gucc::fs::Partition{.fstype = "fat32"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s}, gucc::fs::Partition{.fstype = "fat32"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s},
}; };
REQUIRE(gucc::fs::btrfs_append_subvolumes(partitions, subvolumes)); REQUIRE(gucc::fs::btrfs_append_subvolumes(partitions, subvolumes));
REQUIRE(partitions.size() == 4); REQUIRE_EQ(partitions.size(), 4);
REQUIRE(partitions == expected_partitions); REQUIRE_EQ(partitions, expected_partitions);
} }
} }

View File

@ -61,7 +61,7 @@ TEST_CASE("crypttab gen test")
gucc::fs::Partition{.fstype = "fat32"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s, .luks_mapper_name = "", .luks_uuid = ""}, gucc::fs::Partition{.fstype = "fat32"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s, .luks_mapper_name = "", .luks_uuid = ""},
}; };
const auto& crypttab_content = gucc::fs::generate_crypttab_content(partitions, "luks"sv); const auto& crypttab_content = gucc::fs::generate_crypttab_content(partitions, "luks"sv);
REQUIRE(crypttab_content == CRYPTTAB_EMPTY_TEST); REQUIRE_EQ(crypttab_content, CRYPTTAB_EMPTY_TEST);
} }
SECTION("basic xfs") SECTION("basic xfs")
{ {
@ -70,7 +70,7 @@ TEST_CASE("crypttab gen test")
gucc::fs::Partition{.fstype = "fat16"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s, .luks_uuid = ""}, gucc::fs::Partition{.fstype = "fat16"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s, .luks_uuid = ""},
}; };
const auto& crypttab_content = gucc::fs::generate_crypttab_content(partitions, "luks"sv); const auto& crypttab_content = gucc::fs::generate_crypttab_content(partitions, "luks"sv);
REQUIRE(crypttab_content == CRYPTTAB_EMPTY_TEST); REQUIRE_EQ(crypttab_content, CRYPTTAB_EMPTY_TEST);
} }
SECTION("luks xfs") SECTION("luks xfs")
{ {
@ -80,7 +80,7 @@ TEST_CASE("crypttab gen test")
gucc::fs::Partition{.fstype = "vfat"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s}, gucc::fs::Partition{.fstype = "vfat"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s},
}; };
const auto& crypttab_content = gucc::fs::generate_crypttab_content(partitions, "luks"sv); const auto& crypttab_content = gucc::fs::generate_crypttab_content(partitions, "luks"sv);
REQUIRE(crypttab_content == CRYPTTAB_UNENCR_BOOT_TEST); REQUIRE_EQ(crypttab_content, CRYPTTAB_UNENCR_BOOT_TEST);
} }
SECTION("zfs") SECTION("zfs")
{ {
@ -91,7 +91,7 @@ TEST_CASE("crypttab gen test")
gucc::fs::Partition{.fstype = "vfat"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s}, gucc::fs::Partition{.fstype = "vfat"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s},
}; };
const auto& crypttab_content = gucc::fs::generate_crypttab_content(partitions, "luks"sv); const auto& crypttab_content = gucc::fs::generate_crypttab_content(partitions, "luks"sv);
REQUIRE(crypttab_content == CRYPTTAB_EMPTY_TEST); REQUIRE_EQ(crypttab_content, CRYPTTAB_EMPTY_TEST);
} }
SECTION("luks btrfs with subvolumes") SECTION("luks btrfs with subvolumes")
{ {
@ -102,7 +102,7 @@ TEST_CASE("crypttab gen test")
gucc::fs::Partition{.fstype = "fat32"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s}, gucc::fs::Partition{.fstype = "fat32"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s},
}; };
const auto& crypttab_content = gucc::fs::generate_crypttab_content(partitions, "luks"sv); const auto& crypttab_content = gucc::fs::generate_crypttab_content(partitions, "luks"sv);
REQUIRE(crypttab_content == CRYPTTAB_UNENCR_BOOT_TEST); REQUIRE_EQ(crypttab_content, CRYPTTAB_UNENCR_BOOT_TEST);
} }
SECTION("luks btrfs with subvolumes {shuffled}") SECTION("luks btrfs with subvolumes {shuffled}")
{ {
@ -113,7 +113,7 @@ TEST_CASE("crypttab gen test")
gucc::fs::Partition{.fstype = "btrfs"s, .mountpoint = "/var/cache"s, .device = "/dev/nvme0n1p1"s, .mount_opts = btrfs_mountopts, .subvolume = "/@cache"s, .luks_mapper_name = "luks-6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"s, .luks_uuid = "6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"s}, gucc::fs::Partition{.fstype = "btrfs"s, .mountpoint = "/var/cache"s, .device = "/dev/nvme0n1p1"s, .mount_opts = btrfs_mountopts, .subvolume = "/@cache"s, .luks_mapper_name = "luks-6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"s, .luks_uuid = "6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"s},
}; };
const auto& crypttab_content = gucc::fs::generate_crypttab_content(partitions, "luks"sv); const auto& crypttab_content = gucc::fs::generate_crypttab_content(partitions, "luks"sv);
REQUIRE(crypttab_content == CRYPTTAB_UNENCR_BOOT_TEST); REQUIRE_EQ(crypttab_content, CRYPTTAB_UNENCR_BOOT_TEST);
} }
/* /*

View File

@ -24,7 +24,7 @@ TEST_CASE("fetch file test")
REQUIRE(!file_content->empty()); REQUIRE(!file_content->empty());
const auto& expected_file_content = gucc::file_utils::read_whole_file(LICENSE_PATH); const auto& expected_file_content = gucc::file_utils::read_whole_file(LICENSE_PATH);
REQUIRE(file_content == expected_file_content); REQUIRE_EQ(file_content, expected_file_content);
} }
SECTION("non existent remote url, existing fallback url") SECTION("non existent remote url, existing fallback url")
{ {
@ -35,7 +35,7 @@ TEST_CASE("fetch file test")
REQUIRE(!file_content->empty()); REQUIRE(!file_content->empty());
const auto& expected_file_content = gucc::file_utils::read_whole_file(LICENSE_PATH); const auto& expected_file_content = gucc::file_utils::read_whole_file(LICENSE_PATH);
REQUIRE(file_content == expected_file_content); REQUIRE_EQ(file_content, expected_file_content);
} }
SECTION("non existent remote url, non existent fallback url") SECTION("non existent remote url, non existent fallback url")
{ {

View File

@ -100,7 +100,7 @@ TEST_CASE("fstab gen test")
gucc::fs::Partition{.fstype = "fat32"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s}, gucc::fs::Partition{.fstype = "fat32"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s},
}; };
const auto& fstab_content = gucc::fs::generate_fstab_content(partitions); const auto& fstab_content = gucc::fs::generate_fstab_content(partitions);
REQUIRE(fstab_content == FSTAB_BTRFS_TEST); REQUIRE_EQ(fstab_content, FSTAB_BTRFS_TEST);
} }
SECTION("basic xfs") SECTION("basic xfs")
{ {
@ -109,7 +109,7 @@ TEST_CASE("fstab gen test")
gucc::fs::Partition{.fstype = "fat16"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s}, gucc::fs::Partition{.fstype = "fat16"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s},
}; };
const auto& fstab_content = gucc::fs::generate_fstab_content(partitions); const auto& fstab_content = gucc::fs::generate_fstab_content(partitions);
REQUIRE(fstab_content == FSTAB_XFS_TEST); REQUIRE_EQ(fstab_content, FSTAB_XFS_TEST);
} }
SECTION("luks xfs") SECTION("luks xfs")
{ {
@ -119,7 +119,7 @@ TEST_CASE("fstab gen test")
gucc::fs::Partition{.fstype = "vfat"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s}, gucc::fs::Partition{.fstype = "vfat"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s},
}; };
const auto& fstab_content = gucc::fs::generate_fstab_content(partitions); const auto& fstab_content = gucc::fs::generate_fstab_content(partitions);
REQUIRE(fstab_content == FSTAB_LUKS_XFS_TEST); REQUIRE_EQ(fstab_content, FSTAB_LUKS_XFS_TEST);
} }
SECTION("zfs") SECTION("zfs")
{ {
@ -130,7 +130,7 @@ TEST_CASE("fstab gen test")
gucc::fs::Partition{.fstype = "vfat"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s}, gucc::fs::Partition{.fstype = "vfat"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s},
}; };
const auto& fstab_content = gucc::fs::generate_fstab_content(partitions); const auto& fstab_content = gucc::fs::generate_fstab_content(partitions);
REQUIRE(fstab_content == FSTAB_ZFS_TEST); REQUIRE_EQ(fstab_content, FSTAB_ZFS_TEST);
} }
SECTION("luks btrfs with subvolumes") SECTION("luks btrfs with subvolumes")
{ {
@ -141,6 +141,6 @@ TEST_CASE("fstab gen test")
gucc::fs::Partition{.fstype = "fat32"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s}, gucc::fs::Partition{.fstype = "fat32"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s},
}; };
const auto& fstab_content = gucc::fs::generate_fstab_content(partitions); const auto& fstab_content = gucc::fs::generate_fstab_content(partitions);
REQUIRE(fstab_content == FSTAB_LUKS_BTRFS_TEST); REQUIRE_EQ(fstab_content, FSTAB_LUKS_BTRFS_TEST);
} }
} }

View File

@ -127,7 +127,7 @@ TEST_CASE("grub config gen test")
{ {
const gucc::bootloader::GrubConfig grub_config{}; const gucc::bootloader::GrubConfig grub_config{};
const auto& grub_config_content = gucc::bootloader::gen_grub_config(grub_config); const auto& grub_config_content = gucc::bootloader::gen_grub_config(grub_config);
REQUIRE(grub_config_content == GRUB_DEFAULTS_TEST); REQUIRE_EQ(grub_config_content, GRUB_DEFAULTS_TEST);
} }
SECTION("optionals set") SECTION("optionals set")
{ {
@ -156,6 +156,6 @@ TEST_CASE("grub config gen test")
.disable_os_prober = false, .disable_os_prober = false,
}; };
const auto& grub_config_content = filtered_res(gucc::bootloader::gen_grub_config(grub_config)); const auto& grub_config_content = filtered_res(gucc::bootloader::gen_grub_config(grub_config));
REQUIRE(grub_config_content == GRUB_OPTIONALS_TEST); REQUIRE_EQ(grub_config_content, GRUB_OPTIONALS_TEST);
} }
} }

View File

@ -34,8 +34,8 @@ TEST_CASE("kernel params get test")
}; };
const auto& kernel_params = gucc::fs::get_kernel_params(partitions, DEFAULT_KERNEL_PARAMS); const auto& kernel_params = gucc::fs::get_kernel_params(partitions, DEFAULT_KERNEL_PARAMS);
REQUIRE(kernel_params.has_value()); REQUIRE(kernel_params.has_value());
REQUIRE(kernel_params->size() == 5); REQUIRE_EQ(kernel_params->size(), 5);
REQUIRE((*kernel_params == std::vector<std::string>{"quiet", "splash", "rw", "rootflags=subvol=/@", "root=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"})); REQUIRE_EQ(*kernel_params, std::vector<std::string>{"quiet", "splash", "rw", "rootflags=subvol=/@", "root=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"});
} }
SECTION("invalid xfs (empty uuid)") SECTION("invalid xfs (empty uuid)")
{ {
@ -63,8 +63,8 @@ TEST_CASE("kernel params get test")
}; };
const auto& kernel_params = gucc::fs::get_kernel_params(partitions, DEFAULT_KERNEL_PARAMS); const auto& kernel_params = gucc::fs::get_kernel_params(partitions, DEFAULT_KERNEL_PARAMS);
REQUIRE(kernel_params.has_value()); REQUIRE(kernel_params.has_value());
REQUIRE(kernel_params->size() == 4); REQUIRE_EQ(kernel_params->size(), 4);
REQUIRE((*kernel_params == std::vector<std::string>{"quiet", "splash", "rw", "root=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"})); REQUIRE_EQ(*kernel_params, std::vector<std::string>{"quiet", "splash", "rw", "root=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"});
} }
SECTION("swap xfs") SECTION("swap xfs")
{ {
@ -75,8 +75,8 @@ TEST_CASE("kernel params get test")
}; };
const auto& kernel_params = gucc::fs::get_kernel_params(partitions, DEFAULT_KERNEL_PARAMS); const auto& kernel_params = gucc::fs::get_kernel_params(partitions, DEFAULT_KERNEL_PARAMS);
REQUIRE(kernel_params.has_value()); REQUIRE(kernel_params.has_value());
REQUIRE(kernel_params->size() == 5); REQUIRE_EQ(kernel_params->size(), 5);
REQUIRE((*kernel_params == std::vector<std::string>{"quiet", "splash", "rw", "root=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f", "resume=UUID=59848b1b-c6be-48f4-b3e1-48179ea72dec"})); REQUIRE_EQ(*kernel_params, std::vector<std::string>{"quiet", "splash", "rw", "root=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f", "resume=UUID=59848b1b-c6be-48f4-b3e1-48179ea72dec"});
} }
SECTION("luks xfs") SECTION("luks xfs")
{ {
@ -87,8 +87,8 @@ TEST_CASE("kernel params get test")
}; };
const auto& kernel_params = gucc::fs::get_kernel_params(partitions, DEFAULT_KERNEL_PARAMS); const auto& kernel_params = gucc::fs::get_kernel_params(partitions, DEFAULT_KERNEL_PARAMS);
REQUIRE(kernel_params.has_value()); REQUIRE(kernel_params.has_value());
REQUIRE(kernel_params->size() == 5); REQUIRE_EQ(kernel_params->size(), 5);
REQUIRE((*kernel_params == std::vector<std::string>{"quiet", "splash", "rw", "cryptdevice=UUID=00e1b836-81b6-433f-83ca-0fd373e3cd50:luks_device", "root=/dev/mapper/luks_device"})); REQUIRE_EQ(*kernel_params, std::vector<std::string>{"quiet", "splash", "rw", "cryptdevice=UUID=00e1b836-81b6-433f-83ca-0fd373e3cd50:luks_device", "root=/dev/mapper/luks_device"});
} }
SECTION("luks swap xfs") SECTION("luks swap xfs")
{ {
@ -99,8 +99,8 @@ TEST_CASE("kernel params get test")
}; };
const auto& kernel_params = gucc::fs::get_kernel_params(partitions, DEFAULT_KERNEL_PARAMS); const auto& kernel_params = gucc::fs::get_kernel_params(partitions, DEFAULT_KERNEL_PARAMS);
REQUIRE(kernel_params.has_value()); REQUIRE(kernel_params.has_value());
REQUIRE(kernel_params->size() == 6); REQUIRE_EQ(kernel_params->size(), 6);
REQUIRE((*kernel_params == std::vector<std::string>{"quiet", "splash", "rw", "cryptdevice=UUID=00e1b836-81b6-433f-83ca-0fd373e3cd50:luks_device", "root=/dev/mapper/luks_device", "resume=/dev/mapper/luks_swap_device"})); REQUIRE_EQ(*kernel_params, std::vector<std::string>{"quiet", "splash", "rw", "cryptdevice=UUID=00e1b836-81b6-433f-83ca-0fd373e3cd50:luks_device", "root=/dev/mapper/luks_device", "resume=/dev/mapper/luks_swap_device"});
} }
SECTION("invalid zfs") SECTION("invalid zfs")
{ {
@ -123,8 +123,8 @@ TEST_CASE("kernel params get test")
}; };
const auto& kernel_params = gucc::fs::get_kernel_params(partitions, DEFAULT_KERNEL_PARAMS, "zpcachyos/ROOT"); const auto& kernel_params = gucc::fs::get_kernel_params(partitions, DEFAULT_KERNEL_PARAMS, "zpcachyos/ROOT");
REQUIRE(kernel_params.has_value()); REQUIRE(kernel_params.has_value());
REQUIRE(kernel_params->size() == 5); REQUIRE_EQ(kernel_params->size(), 5);
REQUIRE((*kernel_params == std::vector<std::string>{"quiet", "splash", "rw", "root=ZFS=zpcachyos/ROOT", "root=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"})); REQUIRE_EQ(*kernel_params, std::vector<std::string>{"quiet", "splash", "rw", "root=ZFS=zpcachyos/ROOT", "root=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"});
} }
SECTION("luks btrfs with subvolumes") SECTION("luks btrfs with subvolumes")
{ {
@ -136,7 +136,7 @@ TEST_CASE("kernel params get test")
}; };
const auto& kernel_params = gucc::fs::get_kernel_params(partitions, DEFAULT_KERNEL_PARAMS); const auto& kernel_params = gucc::fs::get_kernel_params(partitions, DEFAULT_KERNEL_PARAMS);
REQUIRE(kernel_params.has_value()); REQUIRE(kernel_params.has_value());
REQUIRE(kernel_params->size() == 6); REQUIRE_EQ(kernel_params->size(), 6);
REQUIRE((*kernel_params == std::vector<std::string>{"quiet", "splash", "rw", "rootflags=subvol=/@", "cryptdevice=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f:luks-6bdb3301-8efb-4b84-b0b7-4caeef26fd6f", "root=/dev/mapper/luks-6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"})); REQUIRE_EQ(*kernel_params, std::vector<std::string>{"quiet", "splash", "rw", "rootflags=subvol=/@", "cryptdevice=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f:luks-6bdb3301-8efb-4b84-b0b7-4caeef26fd6f", "root=/dev/mapper/luks-6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"});
} }
} }

View File

@ -112,11 +112,11 @@ TEST_CASE("mtab test")
SECTION("running system") SECTION("running system")
{ {
const auto& mtab_entries = gucc::mtab::parse_mtab_content(MTAB_RUNNING_SYSTEM_TEST, "/mnt"sv); const auto& mtab_entries = gucc::mtab::parse_mtab_content(MTAB_RUNNING_SYSTEM_TEST, "/mnt"sv);
REQUIRE(mtab_entries.size() == 2); REQUIRE_EQ(mtab_entries.size(), 2);
REQUIRE(mtab_entries[0].device == "/dev/nvme0n1p3"); REQUIRE_EQ(mtab_entries[0].device, "/dev/nvme0n1p3");
REQUIRE(mtab_entries[0].mountpoint == "/mnt"); REQUIRE_EQ(mtab_entries[0].mountpoint, "/mnt");
REQUIRE(mtab_entries[1].device == "/dev/nvme0n1p1"); REQUIRE_EQ(mtab_entries[1].device, "/dev/nvme0n1p1");
REQUIRE(mtab_entries[1].mountpoint == "/mnt/boot"); REQUIRE_EQ(mtab_entries[1].mountpoint, "/mnt/boot");
} }
SECTION("live iso system") SECTION("live iso system")
{ {
@ -136,36 +136,36 @@ TEST_CASE("mtab test")
fs::remove(filename); fs::remove(filename);
const auto& entries = *mtab_entries; const auto& entries = *mtab_entries;
REQUIRE(entries.size() == 14); REQUIRE_EQ(entries.size(), 14);
REQUIRE(entries[0].device == "/dev/sda2"); REQUIRE_EQ(entries[0].device, "/dev/sda2");
REQUIRE(entries[0].mountpoint == "/tmp/calamares-root-q_z5rdlx"); REQUIRE_EQ(entries[0].mountpoint, "/tmp/calamares-root-q_z5rdlx");
REQUIRE(entries[1].device == "/dev/sda2"); REQUIRE_EQ(entries[1].device, "/dev/sda2");
REQUIRE(entries[1].mountpoint == "/tmp/calamares-root-q_z5rdlx/home"); REQUIRE_EQ(entries[1].mountpoint, "/tmp/calamares-root-q_z5rdlx/home");
REQUIRE(entries[2].device == "/dev/sda2"); REQUIRE_EQ(entries[2].device, "/dev/sda2");
REQUIRE(entries[2].mountpoint == "/tmp/calamares-root-q_z5rdlx/root"); REQUIRE_EQ(entries[2].mountpoint, "/tmp/calamares-root-q_z5rdlx/root");
REQUIRE(entries[3].device == "/dev/sda2"); REQUIRE_EQ(entries[3].device, "/dev/sda2");
REQUIRE(entries[3].mountpoint == "/tmp/calamares-root-q_z5rdlx/srv"); REQUIRE_EQ(entries[3].mountpoint, "/tmp/calamares-root-q_z5rdlx/srv");
REQUIRE(entries[4].device == "/dev/sda2"); REQUIRE_EQ(entries[4].device, "/dev/sda2");
REQUIRE(entries[4].mountpoint == "/tmp/calamares-root-q_z5rdlx/var/cache"); REQUIRE_EQ(entries[4].mountpoint, "/tmp/calamares-root-q_z5rdlx/var/cache");
REQUIRE(entries[5].device == "/dev/sda2"); REQUIRE_EQ(entries[5].device, "/dev/sda2");
REQUIRE(entries[5].mountpoint == "/tmp/calamares-root-q_z5rdlx/var/tmp"); REQUIRE_EQ(entries[5].mountpoint, "/tmp/calamares-root-q_z5rdlx/var/tmp");
REQUIRE(entries[6].device == "/dev/sda2"); REQUIRE_EQ(entries[6].device, "/dev/sda2");
REQUIRE(entries[6].mountpoint == "/tmp/calamares-root-q_z5rdlx/var/log"); REQUIRE_EQ(entries[6].mountpoint, "/tmp/calamares-root-q_z5rdlx/var/log");
REQUIRE(entries[7].device == "/dev/sda1"); REQUIRE_EQ(entries[7].device, "/dev/sda1");
REQUIRE(entries[7].mountpoint == "/tmp/calamares-root-q_z5rdlx/boot"); REQUIRE_EQ(entries[7].mountpoint, "/tmp/calamares-root-q_z5rdlx/boot");
REQUIRE(entries[8].device == "dev"); REQUIRE_EQ(entries[8].device, "dev");
REQUIRE(entries[8].mountpoint == "/tmp/calamares-root-q_z5rdlx/dev"); REQUIRE_EQ(entries[8].mountpoint, "/tmp/calamares-root-q_z5rdlx/dev");
REQUIRE(entries[9].device == "proc"); REQUIRE_EQ(entries[9].device, "proc");
REQUIRE(entries[9].mountpoint == "/tmp/calamares-root-q_z5rdlx/proc"); REQUIRE_EQ(entries[9].mountpoint, "/tmp/calamares-root-q_z5rdlx/proc");
REQUIRE(entries[10].device == "tmpfs"); REQUIRE_EQ(entries[10].device, "tmpfs");
REQUIRE(entries[10].mountpoint == "/tmp/calamares-root-q_z5rdlx/run"); REQUIRE_EQ(entries[10].mountpoint, "/tmp/calamares-root-q_z5rdlx/run");
REQUIRE(entries[11].device == "run"); REQUIRE_EQ(entries[11].device, "run");
REQUIRE(entries[11].mountpoint == "/tmp/calamares-root-q_z5rdlx/run/udev"); REQUIRE_EQ(entries[11].mountpoint, "/tmp/calamares-root-q_z5rdlx/run/udev");
REQUIRE(entries[12].device == "sys"); REQUIRE_EQ(entries[12].device, "sys");
REQUIRE(entries[12].mountpoint == "/tmp/calamares-root-q_z5rdlx/sys"); REQUIRE_EQ(entries[12].mountpoint, "/tmp/calamares-root-q_z5rdlx/sys");
REQUIRE(entries[13].device == "efivarfs"); REQUIRE_EQ(entries[13].device, "efivarfs");
REQUIRE(entries[13].mountpoint == "/tmp/calamares-root-q_z5rdlx/sys/firmware/efi/efivars"); REQUIRE_EQ(entries[13].mountpoint, "/tmp/calamares-root-q_z5rdlx/sys/firmware/efi/efivars");
} }
SECTION("empty file") SECTION("empty file")
{ {

View File

@ -49,26 +49,26 @@ TEST_CASE("package profiles test")
{ {
auto base_profs = gucc::profile::parse_base_profiles(VALID_PROFILE_TEST); auto base_profs = gucc::profile::parse_base_profiles(VALID_PROFILE_TEST);
REQUIRE(base_profs); REQUIRE(base_profs);
REQUIRE((base_profs->base_packages == std::vector<std::string>{"a", "b"})); REQUIRE_EQ(base_profs->base_packages, std::vector<std::string>{"a", "b"});
REQUIRE((base_profs->base_desktop_packages == std::vector<std::string>{"c", "d", "f"})); REQUIRE_EQ(base_profs->base_desktop_packages, std::vector<std::string>{"c", "d", "f"});
auto base_desktop_profs = gucc::profile::parse_desktop_profiles(VALID_PROFILE_TEST); auto base_desktop_profs = gucc::profile::parse_desktop_profiles(VALID_PROFILE_TEST);
REQUIRE(base_desktop_profs); REQUIRE(base_desktop_profs);
REQUIRE(base_desktop_profs->size() == 2); REQUIRE_EQ(base_desktop_profs->size(), 2);
REQUIRE(((*base_desktop_profs)[0].profile_name == "someprofile-1")); REQUIRE_EQ((*base_desktop_profs)[0].profile_name, "someprofile-1");
REQUIRE(((*base_desktop_profs)[0].packages == std::vector<std::string>{"ca", "da", "fa"})); REQUIRE_EQ((*base_desktop_profs)[0].packages, std::vector<std::string>{"ca", "da", "fa"});
REQUIRE(((*base_desktop_profs)[1].profile_name == "someprofile-2")); REQUIRE_EQ((*base_desktop_profs)[1].profile_name, "someprofile-2");
REQUIRE(((*base_desktop_profs)[1].packages == std::vector<std::string>{"cb", "db", "fb"})); REQUIRE_EQ((*base_desktop_profs)[1].packages, std::vector<std::string>{"cb", "db", "fb"});
auto net_profs = gucc::profile::parse_net_profiles(VALID_PROFILE_TEST); auto net_profs = gucc::profile::parse_net_profiles(VALID_PROFILE_TEST);
REQUIRE(net_profs); REQUIRE(net_profs);
REQUIRE((net_profs->base_profiles.base_packages == std::vector<std::string>{"a", "b"})); REQUIRE_EQ(net_profs->base_profiles.base_packages, std::vector<std::string>{"a", "b"});
REQUIRE((net_profs->base_profiles.base_desktop_packages == std::vector<std::string>{"c", "d", "f"})); REQUIRE_EQ(net_profs->base_profiles.base_desktop_packages, std::vector<std::string>{"c", "d", "f"});
REQUIRE(net_profs->desktop_profiles.size() == 2); REQUIRE_EQ(net_profs->desktop_profiles.size(), 2);
REQUIRE((net_profs->desktop_profiles[0].profile_name == "someprofile-1")); REQUIRE_EQ(net_profs->desktop_profiles[0].profile_name, "someprofile-1");
REQUIRE((net_profs->desktop_profiles[0].packages == std::vector<std::string>{"ca", "da", "fa"})); REQUIRE_EQ(net_profs->desktop_profiles[0].packages, std::vector<std::string>{"ca", "da", "fa"});
REQUIRE((net_profs->desktop_profiles[1].profile_name == "someprofile-2")); REQUIRE_EQ(net_profs->desktop_profiles[1].profile_name, "someprofile-2");
REQUIRE((net_profs->desktop_profiles[1].packages == std::vector<std::string>{"cb", "db", "fb"})); REQUIRE_EQ(net_profs->desktop_profiles[1].packages, std::vector<std::string>{"cb", "db", "fb"});
} }
SECTION("invalid profile") SECTION("invalid profile")
{ {

View File

@ -57,48 +57,48 @@ TEST_CASE("refind config gen test")
"quiet", "splash", "rw", "rootflags=subvol=/@", "root=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"}; "quiet", "splash", "rw", "rootflags=subvol=/@", "root=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"};
const auto& refind_config_text = gucc::bootloader::gen_refind_config(kernel_params); const auto& refind_config_text = gucc::bootloader::gen_refind_config(kernel_params);
REQUIRE(refind_config_text == REFIND_CONFIG_SUBVOL_TEST); REQUIRE_EQ(refind_config_text, REFIND_CONFIG_SUBVOL_TEST);
} }
SECTION("basic xfs") SECTION("basic xfs")
{ {
const std::vector<std::string> kernel_params{ const std::vector<std::string> kernel_params{
"quiet", "splash", "rw", "root=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"}; "quiet", "splash", "rw", "root=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"};
const auto& refind_config_text = gucc::bootloader::gen_refind_config(kernel_params); const auto& refind_config_text = gucc::bootloader::gen_refind_config(kernel_params);
REQUIRE(refind_config_text == REFIND_CONFIG_TEST); REQUIRE_EQ(refind_config_text, REFIND_CONFIG_TEST);
} }
SECTION("swap xfs") SECTION("swap xfs")
{ {
const std::vector<std::string> kernel_params{ const std::vector<std::string> kernel_params{
"quiet", "splash", "rw", "root=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f", "resume=UUID=59848b1b-c6be-48f4-b3e1-48179ea72dec"}; "quiet", "splash", "rw", "root=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f", "resume=UUID=59848b1b-c6be-48f4-b3e1-48179ea72dec"};
const auto& refind_config_text = gucc::bootloader::gen_refind_config(kernel_params); const auto& refind_config_text = gucc::bootloader::gen_refind_config(kernel_params);
REQUIRE(refind_config_text == REFIND_CONFIG_SWAP_TEST); REQUIRE_EQ(refind_config_text, REFIND_CONFIG_SWAP_TEST);
} }
SECTION("luks xfs") SECTION("luks xfs")
{ {
const std::vector<std::string> kernel_params{ const std::vector<std::string> kernel_params{
"quiet", "splash", "rw", "cryptdevice=UUID=00e1b836-81b6-433f-83ca-0fd373e3cd50:luks_device", "root=/dev/mapper/luks_device"}; "quiet", "splash", "rw", "cryptdevice=UUID=00e1b836-81b6-433f-83ca-0fd373e3cd50:luks_device", "root=/dev/mapper/luks_device"};
const auto& refind_config_text = gucc::bootloader::gen_refind_config(kernel_params); const auto& refind_config_text = gucc::bootloader::gen_refind_config(kernel_params);
REQUIRE(refind_config_text == REFIND_CONFIG_LUKS_TEST); REQUIRE_EQ(refind_config_text, REFIND_CONFIG_LUKS_TEST);
} }
SECTION("luks swap xfs") SECTION("luks swap xfs")
{ {
const std::vector<std::string> kernel_params{ const std::vector<std::string> kernel_params{
"quiet", "splash", "rw", "cryptdevice=UUID=00e1b836-81b6-433f-83ca-0fd373e3cd50:luks_device", "root=/dev/mapper/luks_device", "resume=/dev/mapper/luks_swap_device"}; "quiet", "splash", "rw", "cryptdevice=UUID=00e1b836-81b6-433f-83ca-0fd373e3cd50:luks_device", "root=/dev/mapper/luks_device", "resume=/dev/mapper/luks_swap_device"};
const auto& refind_config_text = gucc::bootloader::gen_refind_config(kernel_params); const auto& refind_config_text = gucc::bootloader::gen_refind_config(kernel_params);
REQUIRE(refind_config_text == REFIND_CONFIG_LUKS_SWAP_TEST); REQUIRE_EQ(refind_config_text, REFIND_CONFIG_LUKS_SWAP_TEST);
} }
SECTION("valid zfs") SECTION("valid zfs")
{ {
const std::vector<std::string> kernel_params{ const std::vector<std::string> kernel_params{
"quiet", "splash", "rw", "root=ZFS=zpcachyos/ROOT", "root=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"}; "quiet", "splash", "rw", "root=ZFS=zpcachyos/ROOT", "root=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"};
const auto& refind_config_text = gucc::bootloader::gen_refind_config(kernel_params); const auto& refind_config_text = gucc::bootloader::gen_refind_config(kernel_params);
REQUIRE(refind_config_text == REFIND_CONFIG_ZFS_TEST); REQUIRE_EQ(refind_config_text, REFIND_CONFIG_ZFS_TEST);
} }
SECTION("luks btrfs with subvolumes") SECTION("luks btrfs with subvolumes")
{ {
const std::vector<std::string> kernel_params{ const std::vector<std::string> kernel_params{
"quiet", "splash", "rw", "rootflags=subvol=/@", "cryptdevice=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f:luks-6bdb3301-8efb-4b84-b0b7-4caeef26fd6f", "root=/dev/mapper/luks-6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"}; "quiet", "splash", "rw", "rootflags=subvol=/@", "cryptdevice=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f:luks-6bdb3301-8efb-4b84-b0b7-4caeef26fd6f", "root=/dev/mapper/luks-6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"};
const auto& refind_config_text = gucc::bootloader::gen_refind_config(kernel_params); const auto& refind_config_text = gucc::bootloader::gen_refind_config(kernel_params);
REQUIRE(refind_config_text == REFIND_CONFIG_LUKS_SUBVOL_TEST); REQUIRE_EQ(refind_config_text, REFIND_CONFIG_LUKS_SUBVOL_TEST);
} }
} }