Debian Codegraph @

test/unit/bootloader/template/grub2_test.py

raw
1 from kiwi.bootloader.template.grub2 import BootLoaderTemplateGrub2
2
3
4 class TestBootLoaderTemplateGrub2:
5 def setup(self):
6 self.grub2 = BootLoaderTemplateGrub2()
7
8 def setup_method(self, cls):
9 self.setup()
10
11 def test_get_multiboot_install_template(self):
12 assert self.grub2.get_multiboot_install_template().substitute(
13 search_params='--fs-uuid --set=root 0815',
14 default_boot='0',
15 kernel_file='linux.vmx',
16 initrd_file='initrd.vmx',
17 boot_options='splash',
18 failsafe_boot_options='splash',
19 gfxmode='800x600',
20 theme='SLE',
21 boot_timeout='10',
22 boot_timeout_style='menu',
23 serial_line_setup='',
24 title='LimeJeOS-SLE12-Community [ VMX ]',
25 bootpath='/boot',
26 boot_directory_name='grub2',
27 hypervisor='xen.gz',
28 efi_image_name='bootx64.efi',
29 terminal_input='console',
30 terminal_output='console'
31 )
32
33 def test_get_multiboot_install_template_console(self):
34 assert self.grub2.get_multiboot_install_template(
35 has_graphics=False
36 ).substitute(
37 search_params='--fs-uuid --set=root 0815',
38 default_boot='0',
39 kernel_file='linux.vmx',
40 initrd_file='initrd.vmx',
41 boot_options='splash',
42 failsafe_boot_options='splash',
43 boot_timeout='10',
44 boot_timeout_style='menu',
45 serial_line_setup='',
46 title='LimeJeOS-SLE12-Community [ VMX ]',
47 bootpath='/boot',
48 hypervisor='xen.gz',
49 efi_image_name='bootx64.efi',
50 terminal_input='console',
51 terminal_output='console'
52 )
53
54 def test_get_multiboot_install_template_serial(self):
55 assert self.grub2.get_multiboot_install_template(
56 has_graphics=False, has_serial=True
57 ).substitute(
58 search_params='--fs-uuid --set=root 0815',
59 default_boot='0',
60 kernel_file='linux.vmx',
61 initrd_file='initrd.vmx',
62 boot_options='splash',
63 failsafe_boot_options='splash',
64 boot_timeout='10',
65 boot_timeout_style='menu',
66 serial_line_setup='serial --speed=38400',
67 title='LimeJeOS-SLE12-Community [ VMX ]',
68 bootpath='/boot',
69 hypervisor='xen.gz',
70 efi_image_name='bootx64.efi',
71 terminal_input='serial',
72 terminal_output='serial'
73 )
74
75 def test_get_multiboot_install_template_console_relative_btrfs(self):
76 assert self.grub2.get_multiboot_install_template(
77 has_graphics=False, has_btrfs_relative_path=True
78 ).substitute(
79 search_params='--fs-uuid --set=root 0815',
80 default_boot='0',
81 kernel_file='linux.vmx',
82 initrd_file='initrd.vmx',
83 boot_options='splash',
84 failsafe_boot_options='splash',
85 boot_timeout='10',
86 boot_timeout_style='menu',
87 serial_line_setup='',
88 title='LimeJeOS-SLE12-Community [ VMX ]',
89 bootpath='/boot',
90 hypervisor='xen.gz',
91 efi_image_name='bootx64.efi',
92 terminal_input='console',
93 terminal_output='console'
94 )
95
96 def test_get_install_template(self):
97 assert self.grub2.get_install_template(
98 has_serial=True
99 ).substitute(
100 search_params='--file --set=root /boot/0xd305fb7d',
101 default_boot='0',
102 kernel_file='boot/linux.vmx',
103 initrd_file='boot/initrd.vmx',
104 boot_options='cdinst=1 splash',
105 failsafe_boot_options='cdinst=1 splash',
106 gfxmode='800x600',
107 theme='SLE',
108 boot_timeout='10',
109 boot_timeout_style='menu',
110 serial_line_setup='',
111 title='LimeJeOS-SLE12-Community [ VMX ]',
112 bootpath='/boot',
113 boot_directory_name='grub2',
114 efi_image_name='bootx64.efi',
115 terminal_input='console',
116 terminal_output='console'
117 )
118
119 def test_get_install_template_relative_btrfs(self):
120 assert self.grub2.get_install_template(
121 has_serial=True, has_btrfs_relative_path=True
122 ).substitute(
123 search_params='--file --set=root /boot/0xd305fb7d',
124 default_boot='0',
125 kernel_file='boot/linux.vmx',
126 initrd_file='boot/initrd.vmx',
127 boot_options='cdinst=1 splash',
128 failsafe_boot_options='cdinst=1 splash',
129 gfxmode='800x600',
130 theme='SLE',
131 boot_timeout='10',
132 boot_timeout_style='menu',
133 serial_line_setup='',
134 title='LimeJeOS-SLE12-Community [ VMX ]',
135 bootpath='/boot',
136 boot_directory_name='grub2',
137 efi_image_name='bootx64.efi',
138 terminal_input='console',
139 terminal_output='console'
140 )
141
142 def test_get_iso_template(self):
143 assert self.grub2.get_iso_template(
144 has_serial=True
145 ).substitute(
146 search_params='--file --set=root /boot/0xd305fb7d',
147 default_boot='0',
148 kernel_file='boot/linux.vmx',
149 initrd_file='boot/initrd.vmx',
150 boot_options='splash',
151 failsafe_boot_options='splash',
152 gfxmode='800x600',
153 theme='SLE',
154 boot_timeout='10',
155 boot_timeout_style='menu',
156 serial_line_setup='',
157 title='LimeJeOS-SLE12-Community',
158 bootpath='/boot',
159 boot_directory_name='grub2',
160 efi_image_name='bootx64.efi',
161 terminal_input='console',
162 terminal_output='console'
163 )
164
165 def test_get_iso_template_checkiso(self):
166 assert self.grub2.get_iso_template(checkiso=True).substitute(
167 search_params='--file --set=root /boot/0xd305fb7d',
168 default_boot='0',
169 kernel_file='boot/linux.vmx',
170 initrd_file='boot/initrd.vmx',
171 boot_options='splash',
172 failsafe_boot_options='splash',
173 gfxmode='800x600',
174 theme='SLE',
175 boot_timeout='10',
176 boot_timeout_style='menu',
177 serial_line_setup='',
178 title='LimeJeOS-SLE12-Community',
179 bootpath='/boot',
180 boot_directory_name='grub2',
181 efi_image_name='bootx64.efi',
182 terminal_input='console',
183 terminal_output='console'
184 )
185
186 def test_get_iso_template_checkiso_relative_btrfs(self):
187 assert self.grub2.get_iso_template(
188 checkiso=True, has_btrfs_relative_path=True
189 ).substitute(
190 search_params='--file --set=root /boot/0xd305fb7d',
191 default_boot='0',
192 kernel_file='boot/linux.vmx',
193 initrd_file='boot/initrd.vmx',
194 boot_options='splash',
195 failsafe_boot_options='splash',
196 gfxmode='800x600',
197 theme='SLE',
198 boot_timeout='10',
199 boot_timeout_style='menu',
200 serial_line_setup='',
201 title='LimeJeOS-SLE12-Community',
202 bootpath='/boot',
203 boot_directory_name='grub2',
204 efi_image_name='bootx64.efi',
205 terminal_input='console',
206 terminal_output='console'
207 )
208
209 def test_get_multiboot_iso_template(self):
210 assert self.grub2.get_multiboot_iso_template().substitute(
211 search_params='--fs-uuid --set=root 0815',
212 default_boot='0',
213 kernel_file='linux.vmx',
214 initrd_file='initrd.vmx',
215 boot_options='splash',
216 failsafe_boot_options='splash',
217 gfxmode='800x600',
218 theme='SLE',
219 boot_timeout='10',
220 boot_timeout_style='menu',
221 serial_line_setup='',
222 title='LimeJeOS-SLE12-Community',
223 bootpath='/boot',
224 boot_directory_name='grub2',
225 hypervisor='xen.gz',
226 efi_image_name='bootx64.efi',
227 terminal_input='console',
228 terminal_output='console'
229 )
230
231 def test_get_multiboot_iso_template_console(self):
232 assert self.grub2.get_multiboot_iso_template(
233 has_graphics=False
234 ).substitute(
235 search_params='--fs-uuid --set=root 0815',
236 default_boot='0',
237 kernel_file='linux.vmx',
238 initrd_file='initrd.vmx',
239 boot_options='splash',
240 failsafe_boot_options='splash',
241 boot_timeout='10',
242 boot_timeout_style='menu',
243 serial_line_setup='',
244 title='LimeJeOS-SLE12-Community',
245 bootpath='/boot',
246 hypervisor='xen.gz',
247 efi_image_name='bootx64.efi',
248 terminal_input='console',
249 terminal_output='console'
250 )
251
252 def test_get_multiboot_iso_template_serial(self):
253 assert self.grub2.get_multiboot_iso_template(
254 has_graphics=False,
255 has_serial=True
256 ).substitute(
257 search_params='--fs-uuid --set=root 0815',
258 default_boot='0',
259 kernel_file='linux.vmx',
260 initrd_file='initrd.vmx',
261 boot_options='splash',
262 failsafe_boot_options='splash',
263 boot_timeout='10',
264 boot_timeout_style='menu',
265 serial_line_setup='',
266 title='LimeJeOS-SLE12-Community',
267 bootpath='/boot',
268 hypervisor='xen.gz',
269 efi_image_name='bootx64.efi',
270 terminal_input='serial',
271 terminal_output='serial'
272 )
273
274 def test_get_multiboot_iso_template_checkiso(self):
275 assert self.grub2.get_multiboot_iso_template(checkiso=True).substitute(
276 search_params='--fs-uuid --set=root 0815',
277 default_boot='0',
278 kernel_file='linux.vmx',
279 initrd_file='initrd.vmx',
280 boot_options='splash',
281 failsafe_boot_options='splash',
282 gfxmode='800x600',
283 theme='SLE',
284 boot_timeout='10',
285 boot_timeout_style='menu',
286 serial_line_setup='',
287 title='LimeJeOS-SLE12-Community',
288 bootpath='/boot',
289 boot_directory_name='grub2',
290 hypervisor='xen.gz',
291 efi_image_name='bootx64.efi',
292 terminal_input='console',
293 terminal_output='console'
294 )
295
296 def test_get_multiboot_iso_template_checkiso_relative_btrfs(self):
297 assert self.grub2.get_multiboot_iso_template(
298 checkiso=True, has_btrfs_relative_path=True
299 ).substitute(
300 search_params='--fs-uuid --set=root 0815',
301 default_boot='0',
302 kernel_file='linux.vmx',
303 initrd_file='initrd.vmx',
304 boot_options='splash',
305 failsafe_boot_options='splash',
306 gfxmode='800x600',
307 theme='SLE',
308 boot_timeout='10',
309 boot_timeout_style='menu',
310 serial_line_setup='',
311 title='LimeJeOS-SLE12-Community',
312 bootpath='/boot',
313 boot_directory_name='grub2',
314 hypervisor='xen.gz',
315 efi_image_name='bootx64.efi',
316 terminal_input='console',
317 terminal_output='console'
318 )