diff --git a/lib/disk.rb b/lib/disk.rb index fdf9e0d..4f03868 100755 --- a/lib/disk.rb +++ b/lib/disk.rb @@ -8,7 +8,7 @@ def to_s end def self.to_strings - all.select(&:by_serial).sort_by{|d| d.type_sort_order * 100000000 + d.connection_sort_order * 10000000 + d.capacity_gb}.map(&:to_s) + all.sort_by{|d| d.type_sort_order * 100000000 + d.connection_sort_order * 10000000 + d.capacity_gb}.map(&:to_s) end def self.to_string_list @@ -35,7 +35,7 @@ def self.load log.debug "-----------------------------------------" log.debug " " end - disks + disks.select(&:by_serial) end def id diff --git a/lib/root_installer/questions/boot_type.rb b/lib/root_installer/questions/boot_type.rb index 2e17e86..5e48dbf 100755 --- a/lib/root_installer/questions/boot_type.rb +++ b/lib/root_installer/questions/boot_type.rb @@ -1,46 +1,54 @@ class RootInstaller::Questions::BootType < Question - attr_reader :boot_type, :efi_partition + attr_reader :boot_type, :efi_partition, :efi_choice_dialog, :efi_advisory_dialog, + :mbr_advisory_dialog, :mbr_error_dialog, :efi_partition_dialog def ask - File.directory?("/sys/firmware/efi") ? ask_efi : ask_legacy + self.class.efi_support? ? ask_efi : ask_legacy + end + + def self.efi_support? + @efi_support ||= File.directory?("/sys/firmware/efi") end def ask_efi if has_512k - new_dialog.tap do |d| - d.title = "Boot Type" - d.yes_label = "EFI\\ Boot" - d.no_label = "Legacy\\ MBR\\ Boot" - if d.yesno("\\nThis machine supports both EFI and legacy MBR booting. What boot type would you like?", 8, 50) - @boot_type = :efi - else - @boot_type = :mbr - ask_efi_partition - end + @efi_choice_dialog = new_dialog + @efi_choice_dialog.title = "Boot Type" + @efi_choice_dialog.yes_label = "EFI\\ Boot" + @efi_choice_dialog.no_label = "Legacy\\ MBR\\ Boot" + if @efi_choice_dialog.yesno("\\nThis machine supports both EFI and legacy MBR booting. What boot type would you like?", 8, 50) + @boot_type = :efi + else + @boot_type = :mbr + ask_efi_partition end else - new_dialog.tap do |d| - d.title = "Boot Pool - select disks" - d.msgbox("\\nThis machine only has 4Kn type disks, so it will be configured for UEFI boot.", 8, 50) - end + @efi_advisory_dialog = new_dialog + @efi_advisory_dialog.title = "Boot Type" + @efi_advisory_dialog.msgbox("\\nThis machine only has 4Kn type disks, so it will be configured for UEFI boot.", 8, 50) @boot_type = :efi end end def ask_legacy - new_dialog.tap do |d| - d.title = "Boot Type" - d.msgbox("\\nThis machine does not support UEFI booting, so legacy MBR booting will be configured.", 8, 50) + if has_512k + @mbr_advisory_dialog = new_dialog + @mbr_advisory_dialog.title = "Boot Type" + @mbr_advisory_dialog.msgbox("\\nThis machine does not support UEFI booting, so legacy MBR booting will be configured.", 8, 50) + ask_efi_partition + else + @mbr_error_dialog = new_dialog + @mbr_error_dialog.title = "Boot Type" + @mbr_error_dialog.msgbox('This machine does not support UEFI booting, But none of its disks is reporting 512K sectors that support legacy MBR Boot. This installer cannot work on this machine. Please see https://openzfs.github.io/openzfs-docs/Getting%20Started/Debian/index.html#root-on-zfs for manual install instructions.', 10, 70) + quit 1 end - ask_efi_partition end def ask_efi_partition - new_dialog.tap do |d| - d.title = "Create EFI Partition for future use?" - @efi_partition = d.yesno("\\nLegacy MBR Boot has been selected. Would you also like to create an unused EFI partition in case you need UEFI boot in future?", 9, 50) - end + @efi_partition_dialog = new_dialog + @efi_partition_dialog.title = "Create EFI Partition for future use?" + @efi_partition = @efi_partition_dialog.yesno("\\nLegacy MBR Boot has been selected. Would you also like to create an unused EFI partition in case you need UEFI boot in future?", 9, 50) end diff --git a/runtest.sh b/runtest.sh index b00ecee..2b66400 100755 --- a/runtest.sh +++ b/runtest.sh @@ -3,10 +3,10 @@ if [ -z "$1" ] then echo " " echo " " - echo "usage: ./runtest.sh " - echo "eg: ./runtest.sh test_question.rb" + echo "usage: ./runtest.sh " + echo "eg: ./runtest.sh test/test_question.rb" echo " " echo " " exit fi -ruby -Ilib:test test/$1 \ No newline at end of file +ruby -Ilib:test $1 \ No newline at end of file diff --git a/test/data/rescue-disks.txt b/test/data/hdd-disks.txt similarity index 100% rename from test/data/rescue-disks.txt rename to test/data/hdd-disks.txt diff --git a/test/data/largesector-disks.txt b/test/data/largesector-disks.txt new file mode 100755 index 0000000..7e5bcf1 --- /dev/null +++ b/test/data/largesector-disks.txt @@ -0,0 +1,237 @@ +16: None 00.0: 10600 Disk + [Created at block.245] + Unique ID: 7tlP.Fxp0d3BezAE + SysFS ID: /class/block/ram2 + Hardware Class: disk + Model: "Disk" + Device File: /dev/ram2 + Device Number: block 1:2 + Size: 131072 sectors a 512 bytes + Capacity: 0 GB (67108864 bytes) + Config Status: cfg=new, avail=yes, need=no, active=unknown + +17: None 00.0: 10600 Disk + [Created at block.245] + Unique ID: CWFH.Fxp0d3BezAE + SysFS ID: /class/block/ram0 + Hardware Class: disk + Model: "Disk" + Device File: /dev/ram0 + Device Number: block 1:0 + Size: 131072 sectors a 512 bytes + Capacity: 0 GB (67108864 bytes) + Config Status: cfg=new, avail=yes, need=no, active=unknown + +18: IDE 100.0: 10600 Disk + [Created at block.245] + Unique ID: WZeP.ltDB2H9Ht5E + Parent ID: w7Y8.9yUVNR9J1l9 + SysFS ID: /class/block/sdb + SysFS BusID: 1:0:0:0 + SysFS Device Link: /devices/pci0000:00/0000:00:1f.2/ata2/host1/target1:0:0/1:0:0:0 + Hardware Class: disk + Model: "ST2000NM0033-9ZM" + Device: "ST2000NM0033-9ZM" + Revision: "SN07" + Serial ID: "Z1X0TX8R" + Driver: "ahci", "sd" + Driver Modules: "ahci", "sd_mod" + Device File: /dev/sdb + Device Files: /dev/sdb, /dev/disk/by-id/ata-ST2000NM0033-9ZM175_Z1X0TX8R, /dev/disk/by-path/pci-0000:00:1f.2-ata-2, /dev/disk/by-id/wwn-0x5000c50064b2a291 + Device Number: block 8:16-8:31 + Geometry (Logical): CHS 243201/255/63 + Size: 488378646 sectors a 4096 bytes + Capacity: 1863 GB (2000398934016 bytes) + Config Status: cfg=new, avail=yes, need=no, active=unknown + Attached to: #3 (SATA controller) + +19: None 00.0: 10600 Disk + [Created at block.245] + Unique ID: XOSI.Fxp0d3BezAE + SysFS ID: /class/block/ram9 + Hardware Class: disk + Model: "Disk" + Device File: /dev/ram9 + Device Number: block 1:9 + Size: 131072 sectors a 512 bytes + Capacity: 0 GB (67108864 bytes) + Config Status: cfg=new, avail=yes, need=no, active=unknown + +20: None 00.0: 10600 Disk + [Created at block.245] + Unique ID: s19p.Fxp0d3BezAE + SysFS ID: /class/block/ram14 + Hardware Class: disk + Model: "Disk" + Device File: /dev/ram14 + Device Number: block 1:14 + Size: 131072 sectors a 512 bytes + Capacity: 0 GB (67108864 bytes) + Config Status: cfg=new, avail=yes, need=no, active=unknown + +21: None 00.0: 10600 Disk + [Created at block.245] + Unique ID: d1y9.Fxp0d3BezAE + SysFS ID: /class/block/ram7 + Hardware Class: disk + Model: "Disk" + Device File: /dev/ram7 + Device Number: block 1:7 + Size: 131072 sectors a 512 bytes + Capacity: 0 GB (67108864 bytes) + Config Status: cfg=new, avail=yes, need=no, active=unknown + +22: None 00.0: 10600 Disk + [Created at block.245] + Unique ID: ygeg.Fxp0d3BezAE + SysFS ID: /class/block/ram12 + Hardware Class: disk + Model: "Disk" + Device File: /dev/ram12 + Device Number: block 1:12 + Size: 131072 sectors a 512 bytes + Capacity: 0 GB (67108864 bytes) + Config Status: cfg=new, avail=yes, need=no, active=unknown + +23: None 00.0: 10600 Disk + [Created at block.245] + Unique ID: UPWc.Fxp0d3BezAE + SysFS ID: /class/block/ram5 + Hardware Class: disk + Model: "Disk" + Device File: /dev/ram5 + Device Number: block 1:5 + Size: 131072 sectors a 512 bytes + Capacity: 0 GB (67108864 bytes) + Config Status: cfg=new, avail=yes, need=no, active=unknown + +24: None 00.0: 10600 Disk + [Created at block.245] + Unique ID: 2K8Y.Fxp0d3BezAE + SysFS ID: /class/block/ram10 + Hardware Class: disk + Model: "Disk" + Device File: /dev/ram10 + Device Number: block 1:10 + Size: 131072 sectors a 512 bytes + Capacity: 0 GB (67108864 bytes) + Config Status: cfg=new, avail=yes, need=no, active=unknown + +25: None 00.0: 10600 Disk + [Created at block.245] + Unique ID: a20U.Fxp0d3BezAE + SysFS ID: /class/block/ram3 + Hardware Class: disk + Model: "Disk" + Device File: /dev/ram3 + Device Number: block 1:3 + Size: 131072 sectors a 512 bytes + Capacity: 0 GB (67108864 bytes) + Config Status: cfg=new, avail=yes, need=no, active=unknown + +26: None 00.0: 10600 Disk + [Created at block.245] + Unique ID: ghVL.Fxp0d3BezAE + SysFS ID: /class/block/ram1 + Hardware Class: disk + Model: "Disk" + Device File: /dev/ram1 + Device Number: block 1:1 + Size: 131072 sectors a 512 bytes + Capacity: 0 GB (67108864 bytes) + Config Status: cfg=new, avail=yes, need=no, active=unknown + +27: None 00.0: 10600 Disk + [Created at block.245] + Unique ID: JDPt.Fxp0d3BezAE + SysFS ID: /class/block/ram15 + Hardware Class: disk + Model: "Disk" + Device File: /dev/ram15 + Device Number: block 1:15 + Size: 131072 sectors a 512 bytes + Capacity: 0 GB (67108864 bytes) + Config Status: cfg=new, avail=yes, need=no, active=unknown + +28: IDE 00.0: 10600 Disk + [Created at block.245] + Unique ID: 3OOL.eZgOVl+pmnA + Parent ID: w7Y8.9yUVNR9J1l9 + SysFS ID: /class/block/sda + SysFS BusID: 0:0:0:0 + SysFS Device Link: /devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0 + Hardware Class: disk + Model: "ST2000NM0033-9ZM" + Device: "ST2000NM0033-9ZM" + Revision: "SN07" + Serial ID: "Z1X0TY02" + Driver: "ahci", "sd" + Driver Modules: "ahci", "sd_mod" + Device File: /dev/sda + Device Files: /dev/sda, /dev/disk/by-path/pci-0000:00:1f.2-ata-1, /dev/disk/by-id/wwn-0x5000c50064b2518e, /dev/disk/by-id/ata-ST2000NM0033-9ZM175_Z1X0TY02 + Device Number: block 8:0-8:15 + Geometry (Logical): CHS 243201/255/63 + Size: 488378646 sectors a 4096 bytes + Capacity: 1863 GB (2000398934016 bytes) + Config Status: cfg=new, avail=yes, need=no, active=unknown + Attached to: #3 (SATA controller) + +29: None 00.0: 10600 Disk + [Created at block.245] + Unique ID: 4DCE.Fxp0d3BezAE + SysFS ID: /class/block/ram8 + Hardware Class: disk + Model: "Disk" + Device File: /dev/ram8 + Device Number: block 1:8 + Size: 131072 sectors a 512 bytes + Capacity: 0 GB (67108864 bytes) + Config Status: cfg=new, avail=yes, need=no, active=unknown + +30: None 00.0: 10600 Disk + [Created at block.245] + Unique ID: Psuk.Fxp0d3BezAE + SysFS ID: /class/block/ram13 + Hardware Class: disk + Model: "Disk" + Device File: /dev/ram13 + Device Number: block 1:13 + Size: 131072 sectors a 512 bytes + Capacity: 0 GB (67108864 bytes) + Config Status: cfg=new, avail=yes, need=no, active=unknown + +31: None 00.0: 10600 Disk + [Created at block.245] + Unique ID: xamg.Fxp0d3BezAE + SysFS ID: /class/block/ram6 + Hardware Class: disk + Model: "Disk" + Device File: /dev/ram6 + Device Number: block 1:6 + Size: 131072 sectors a 512 bytes + Capacity: 0 GB (67108864 bytes) + Config Status: cfg=new, avail=yes, need=no, active=unknown + +32: None 00.0: 10600 Disk + [Created at block.245] + Unique ID: VVOc.Fxp0d3BezAE + SysFS ID: /class/block/ram11 + Hardware Class: disk + Model: "Disk" + Device File: /dev/ram11 + Device Number: block 1:11 + Size: 131072 sectors a 512 bytes + Capacity: 0 GB (67108864 bytes) + Config Status: cfg=new, avail=yes, need=no, active=unknown + +33: None 00.0: 10600 Disk + [Created at block.245] + Unique ID: 1EGY.Fxp0d3BezAE + SysFS ID: /class/block/ram4 + Hardware Class: disk + Model: "Disk" + Device File: /dev/ram4 + Device Number: block 1:4 + Size: 131072 sectors a 512 bytes + Capacity: 0 GB (67108864 bytes) + Config Status: cfg=new, avail=yes, need=no, active=unknown diff --git a/test/data/hpe-disks.txt b/test/data/mixed-disks.txt similarity index 100% rename from test/data/hpe-disks.txt rename to test/data/mixed-disks.txt diff --git a/test/data/root_installer/test_boot_type.test_efi_4k.txt b/test/data/root_installer/test_boot_type.test_efi_4k.txt new file mode 100644 index 0000000..0fac233 --- /dev/null +++ b/test/data/root_installer/test_boot_type.test_efi_4k.txt @@ -0,0 +1 @@ +["\\nThis machine only has 4Kn type disks, so it will be configured for UEFI boot.", 8, 50] \ No newline at end of file diff --git a/test/data/root_installer/test_disk_overview.test_dialog_with_hpe_disks.txt b/test/data/root_installer/test_disk_overview.test_dialog_with_hpe_disks.txt deleted file mode 100644 index ce453d2..0000000 --- a/test/data/root_installer/test_disk_overview.test_dialog_with_hpe_disks.txt +++ /dev/null @@ -1 +0,0 @@ -["\nThis installer creates a ZFS root installation using Mirror or RAIDZ VDEVs. Two pools are created, a boot pool and a root pool. VDEVs are created on disk partitions, and you can specify on which disks you would like to create the partitions, as well as the number of partitions in each VDEV and the number of VDEVs in each pool. The installer will also create swap on disk partitions if you wish to do so and can encrypt and/or mirror swap for security and availability. Encrypting the root partition with LUKS or ZFS native encryption is also supported.\n\nThe following is a list of the disks in your system. Please examine them and decide how you would like to configure the VDEVs for your pools and your swap partitions, before continuing to set up your disks. (if the list goes off the bottom of the screen, you can use the arrow keys and PGUP/PGDOWN to view the rest of the details. In this case a % number will be shown at the bottom right to indicate how far down the screen has scrolled...)\n\n 465 GB nvme SSD nvme-KINGSTON_SKC2500M8500G_50026B7683D3EF85 with 512 byte sectors as nvme0n1\n 465 GB nvme SSD nvme-KINGSTON_SKC2500M8500G_50026B7683D3F764 with 512 byte sectors as nvme3n1\n 465 GB nvme SSD nvme-KINGSTON_SKC2500M8500G_50026B7683D3EFCC with 512 byte sectors as nvme2n1\n 465 GB nvme SSD nvme-KINGSTON_SKC2500M8500G_50026B7683D3EF7C with 512 byte sectors as nvme5n1\n 465 GB nvme SSD nvme-KINGSTON_SKC2500M8500G_50026B7683D3F1B8 with 512 byte sectors as nvme4n1\n 1788 GB nvme SSD nvme-SAMSUNG_MZWLJ1T9HBJR-00007_S4YNNE0N700376 with 512 byte sectors as nvme1n1\n 7452 GB sata HDD ata-ST8000VN004-2M2101_WKD3276X with 512 byte sectors as sdb\n 7452 GB sata HDD ata-ST8000VN004-2M2101_WRD06Q04 with 512 byte sectors as sda", 35, 150] \ No newline at end of file diff --git a/test/data/root_installer/test_disk_overview.test_dialog_with_rescue_disks.txt b/test/data/root_installer/test_disk_overview.test_dialog_with_rescue_disks.txt deleted file mode 100644 index 9268c23..0000000 --- a/test/data/root_installer/test_disk_overview.test_dialog_with_rescue_disks.txt +++ /dev/null @@ -1 +0,0 @@ -["\nThis installer creates a ZFS root installation using Mirror or RAIDZ VDEVs. Two pools are created, a boot pool and a root pool. VDEVs are created on disk partitions, and you can specify on which disks you would like to create the partitions, as well as the number of partitions in each VDEV and the number of VDEVs in each pool. The installer will also create swap on disk partitions if you wish to do so and can encrypt and/or mirror swap for security and availability. Encrypting the root partition with LUKS or ZFS native encryption is also supported.\n\nThe following is a list of the disks in your system. Please examine them and decide how you would like to configure the VDEVs for your pools and your swap partitions, before continuing to set up your disks. (if the list goes off the bottom of the screen, you can use the arrow keys and PGUP/PGDOWN to view the rest of the details. In this case a % number will be shown at the bottom right to indicate how far down the screen has scrolled...)\n\n 1863 GB sata HDD ata-ST2000NM0033-9ZM175_Z1X0TX8R with 512 byte sectors as sdb\n 1863 GB sata HDD ata-ST2000NM0033-9ZM175_Z1X0TY02 with 512 byte sectors as sda", 35, 150] \ No newline at end of file diff --git a/test/data/root_installer/test_disk_overview.test_dialog_with_usb_disks.txt b/test/data/root_installer/test_disk_overview.test_dialog_with_usb_disks.txt deleted file mode 100644 index 2d41faa..0000000 --- a/test/data/root_installer/test_disk_overview.test_dialog_with_usb_disks.txt +++ /dev/null @@ -1 +0,0 @@ -["\nThis installer creates a ZFS root installation using Mirror or RAIDZ VDEVs. Two pools are created, a boot pool and a root pool. VDEVs are created on disk partitions, and you can specify on which disks you would like to create the partitions, as well as the number of partitions in each VDEV and the number of VDEVs in each pool. The installer will also create swap on disk partitions if you wish to do so and can encrypt and/or mirror swap for security and availability. Encrypting the root partition with LUKS or ZFS native encryption is also supported.\n\nThe following is a list of the disks in your system. Please examine them and decide how you would like to configure the VDEVs for your pools and your swap partitions, before continuing to set up your disks. (if the list goes off the bottom of the screen, you can use the arrow keys and PGUP/PGDOWN to view the rest of the details. In this case a % number will be shown at the bottom right to indicate how far down the screen has scrolled...)\n\n 55 GB sata SSD ata-INTEL_SSDSC2CW060A3_CVCV153409K0060AGN with 512 byte sectors as sda\n 476 GB sata SSD ata-Samsung_SSD_850_PRO_512GB_S250NXAG709909M with 512 byte sectors as sdb\n 3726 GB sata HDD ata-ST4000DM004-2CV104_ZFN2NBB7 with 512 byte sectors as sdf\n 3726 GB sata HDD ata-ST4000DM004-2CV104_ZFN2NCTY with 512 byte sectors as sdd\n 3726 GB sata HDD ata-ST4000DM004-2CV104_ZFN2MJF8 with 512 byte sectors as sde\n 3726 GB sata HDD ata-ST4000DM004-2CV104_ZFN2MEE9 with 512 byte sectors as sdc", 35, 150] \ No newline at end of file diff --git a/test/data/test_disk.test_string_list_with_hpe_disks.txt b/test/data/test_disk.test_string_list_with_hpe_disks.txt deleted file mode 100644 index b4e1ecb..0000000 --- a/test/data/test_disk.test_string_list_with_hpe_disks.txt +++ /dev/null @@ -1,8 +0,0 @@ - 465 GB nvme SSD nvme-KINGSTON_SKC2500M8500G_50026B7683D3EF85 with 512 byte sectors as nvme0n1 - 465 GB nvme SSD nvme-KINGSTON_SKC2500M8500G_50026B7683D3F764 with 512 byte sectors as nvme3n1 - 465 GB nvme SSD nvme-KINGSTON_SKC2500M8500G_50026B7683D3EFCC with 512 byte sectors as nvme2n1 - 465 GB nvme SSD nvme-KINGSTON_SKC2500M8500G_50026B7683D3EF7C with 512 byte sectors as nvme5n1 - 465 GB nvme SSD nvme-KINGSTON_SKC2500M8500G_50026B7683D3F1B8 with 512 byte sectors as nvme4n1 - 1788 GB nvme SSD nvme-SAMSUNG_MZWLJ1T9HBJR-00007_S4YNNE0N700376 with 512 byte sectors as nvme1n1 - 7452 GB sata HDD ata-ST8000VN004-2M2101_WKD3276X with 512 byte sectors as sdb - 7452 GB sata HDD ata-ST8000VN004-2M2101_WRD06Q04 with 512 byte sectors as sda \ No newline at end of file diff --git a/test/data/test_disk.test_string_list_with_rescue_disks.txt b/test/data/test_disk.test_string_list_with_rescue_disks.txt deleted file mode 100644 index a67f4b5..0000000 --- a/test/data/test_disk.test_string_list_with_rescue_disks.txt +++ /dev/null @@ -1,2 +0,0 @@ - 1863 GB sata HDD ata-ST2000NM0033-9ZM175_Z1X0TX8R with 512 byte sectors as sdb - 1863 GB sata HDD ata-ST2000NM0033-9ZM175_Z1X0TY02 with 512 byte sectors as sda \ No newline at end of file diff --git a/test/data/test_disk.test_string_list_with_usb_disks.txt b/test/data/test_disk.test_string_list_with_usb_disks.txt deleted file mode 100644 index 1ecc75e..0000000 --- a/test/data/test_disk.test_string_list_with_usb_disks.txt +++ /dev/null @@ -1,6 +0,0 @@ - 55 GB sata SSD ata-INTEL_SSDSC2CW060A3_CVCV153409K0060AGN with 512 byte sectors as sda - 476 GB sata SSD ata-Samsung_SSD_850_PRO_512GB_S250NXAG709909M with 512 byte sectors as sdb - 3726 GB sata HDD ata-ST4000DM004-2CV104_ZFN2NBB7 with 512 byte sectors as sdf - 3726 GB sata HDD ata-ST4000DM004-2CV104_ZFN2NCTY with 512 byte sectors as sdd - 3726 GB sata HDD ata-ST4000DM004-2CV104_ZFN2MJF8 with 512 byte sectors as sde - 3726 GB sata HDD ata-ST4000DM004-2CV104_ZFN2MEE9 with 512 byte sectors as sdc \ No newline at end of file diff --git a/test/root_installer/test_boot_type.rb b/test/root_installer/test_boot_type.rb new file mode 100755 index 0000000..4091b6b --- /dev/null +++ b/test/root_installer/test_boot_type.rb @@ -0,0 +1,53 @@ +require 'test' + + +class TestBootType < Test + + def test_efi_4k + largesector_disks do + result = nil + with_screen 40, 200 do + with_dialog :msgbox do + RootInstaller::Questions::BootType.stub(:efi_support?, true ) do + q = RootInstaller::Questions::BootType.new(nil) + q.ask + assert_instance_of Question::Dialog, q.efi_advisory_dialog + assert_equal "Boot Type", q.efi_advisory_dialog.title + assert_equal "YAROZI - Yet Another Root On ZFS installer", q.efi_advisory_dialog.backtitle + assert_equal nil, q.efi_advisory_dialog.ok_label + assert_equal fetch_or_save(result.to_s), result.to_s + end + end + end + end + end + + + + # def test_dialog + # with_disk_sets do |set| + # overview = RootInstaller::Questions::BootType.new(nil) + # result = nil + # with_screen 40, 200 do + # with_dialog :msgbox, Proc.new{|*args| result = args} do + # overview.ask + # end + # end + # assert_equal "Introduction and Disk Overview", overview.dialog.title + # assert_equal "YAROZI - Yet Another Root On ZFS installer", overview.dialog.backtitle + # assert_equal "continue\\ and\\ select\\ disks", overview.dialog.ok_label + # assert_equal fetch_or_save(result.to_s, set), result.to_s + # end + # end + + def test_ok + with_disk_sets do |set| + with_dialog :yesno, true do + assert_not_quit do + RootInstaller::Questions::BootType.new(nil).ask + end + end + end + end + +end \ No newline at end of file diff --git a/test/test.rb b/test/test.rb index c6f51a6..b46912f 100755 --- a/test/test.rb +++ b/test/test.rb @@ -13,7 +13,7 @@ class Test < Minitest::Test - DISK_SETS = %w(rescue hpe usb) + DISK_SETS = %w(hdd mixed usb largesector) # Disk mocking DISK_SETS.each do |set|