[grubcfg] expand config-testing for the new features

- create directories for new tests ahead of the tests themselves;
  this **can** still cause problems if a test is run standalone.
- if creating the grub-dir at runtime is necessary, be informative
  if it fails.
main
Adriaan de Groot 5 years ago
parent 8bf95b6881
commit 473daecdbf

@ -55,7 +55,11 @@ def get_grub_config_path(root_mount_point):
default_config_file = "00calamares"
if not os.path.exists(default_dir):
os.mkdir(default_dir)
try:
os.mkdir(default_dir)
except:
libcalamares.utils.debug("Failed to create '%r'" % default_dir)
raise
return os.path.join(default_dir, default_config_file)

@ -2,7 +2,7 @@
bogus: true
firmwareType: bios
bootLoader: grub
rootMountPoint: /tmp/calamares
rootMountPoint: /tmp/calamares/grubcfg-test-2
branding:
bootloaderEntryName: generic

@ -0,0 +1,10 @@
---
bogus: true
firmwareType: bios
bootLoader: grub
rootMountPoint: /tmp/calamares/grubcfg-test-3
branding:
bootloaderEntryName: generic
partitions: []

@ -0,0 +1,10 @@
---
overwrite: true
prefer_grub_d: true # But it doesn't exist
keepDistributor: false
defaults:
GRUB_TIMEOUT: 5
GRUB_DEFAULT: "saved"
GRUB_DISABLE_SUBMENU: true
GRUB_TERMINAL_OUTPUT: "console"
GRUB_DISABLE_RECOVERY: true

@ -0,0 +1,10 @@
---
bogus: true
firmwareType: bios
bootLoader: grub
rootMountPoint: /tmp/calamares/grubcfg-test-4
branding:
bootloaderEntryName: generic
partitions: []

@ -0,0 +1,10 @@
---
overwrite: true
prefer_grub_d: true
keepDistributor: false
defaults:
GRUB_TIMEOUT: 5
GRUB_DEFAULT: "saved"
GRUB_DISABLE_SUBMENU: true
GRUB_TERMINAL_OUTPUT: "console"
GRUB_DISABLE_RECOVERY: true

@ -2,11 +2,15 @@
# - 2.global specifies /tmp/calamares as the rootMountPath,
# so we end up editing files there. Create the directory
# beforehand, so the test doesn't blow up.
set(_grub_root /tmp/calamares/etc/default)
set(_grub_file ${_grub_root}/bogus)
add_test(
NAME make-grubcfg-dirs
COMMAND ${CMAKE_COMMAND} -E make_directory ${_grub_root}
COMMAND ${CMAKE_COMMAND} -E make_directory
/tmp/calamares/grubcfg-test-2/etc/default
/tmp/calamares/grubcfg-test-3/etc/default
/tmp/calamares/grubcfg-test-4/etc/default/grub.d
)
set_tests_properties(load-grubcfg-2 PROPERTIES DEPENDS make-grubcfg-dirs)
set_tests_properties(load-grubcfg-3 PROPERTIES DEPENDS make-grubcfg-dirs)
set_tests_properties(load-grubcfg-4 PROPERTIES DEPENDS make-grubcfg-dirs)

Loading…
Cancel
Save