File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change
1
+ set default =0
2
+ menuentry ' linux' {
3
+ linux /boot/vmlinuz-1 ro
4
+ initrd /boot/initrd.img-1
5
+ }
Original file line number Diff line number Diff line change 1
1
import unittest
2
2
import os
3
+ import shutil
3
4
import subprocess
4
- from tempfile import NamedTemporaryFile
5
+ from tempfile import NamedTemporaryFile , mkdtemp
5
6
6
7
from xcp .bootloader import Bootloader
7
8
@@ -21,6 +22,25 @@ def test_grub2(self):
21
22
proc .stdout .close ()
22
23
proc .wait ()
23
24
25
+ class TestLinuxBootloader (unittest .TestCase ):
26
+ def setUp (self ):
27
+ self .tmpdir = mkdtemp (prefix = "testbl" )
28
+ bootdir = os .path .join (self .tmpdir , "boot" )
29
+ grubdir = os .path .join (bootdir , "grub" )
30
+ os .makedirs (grubdir )
31
+ shutil .copyfile ("tests/data/grub-linux.cfg" , os .path .join (grubdir , "grub.cfg" ))
32
+ with open (os .path .join (bootdir , "vmlinuz-1" ), "w" ):
33
+ pass
34
+ with open (os .path .join (bootdir , "vmlinuz-2" ), "w" ):
35
+ pass
36
+ with open (os .path .join (bootdir , "initrd.img-1" ), "w" ):
37
+ pass
38
+ with open (os .path .join (bootdir , "initrd.img-2" ), "w" ):
39
+ pass
40
+ def tearDown (self ):
41
+ shutil .rmtree (self .tmpdir )
42
+ def test_grub2_newdefault (self ):
43
+ Bootloader .newDefault ("/boot/vmlinuz-2" , "/boot/initrd.img-2" , root = self .tmpdir )
24
44
25
45
class TestBootloaderAdHoc (unittest .TestCase ):
26
46
def setUp (self ):
You can’t perform that action at this time.
0 commit comments