]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blob - support/testing/tests/fs/test_iso9660.py
support/testing: use more recent toolchains
[coffee/buildroot.git] / support / testing / tests / fs / test_iso9660.py
1 import os
2
3 import infra.basetest
4
5 BASIC_CONFIG = \
6     """
7     BR2_x86_pentium4=y
8     BR2_TOOLCHAIN_EXTERNAL=y
9     BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
10     BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y
11     BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/br-i386-pentium4-full-2017.05-1078-g95b1dae.tar.bz2"
12     BR2_TOOLCHAIN_EXTERNAL_GCC_6=y
13     BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_2=y
14     BR2_TOOLCHAIN_EXTERNAL_LOCALE=y
15     # BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS_DEBUG is not set
16     BR2_TOOLCHAIN_EXTERNAL_CXX=y
17     BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
18     BR2_TARGET_GENERIC_GETTY_BAUDRATE_115200=y
19     BR2_LINUX_KERNEL=y
20     BR2_LINUX_KERNEL_CUSTOM_VERSION=y
21     BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.0"
22     BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
23     BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="{}"
24     # BR2_TARGET_ROOTFS_TAR is not set
25     """.format(infra.filepath("conf/minimal-x86-qemu-kernel.config"))
26
27
28 def test_mount_internal_external(emulator, builddir, internal=True):
29     img = os.path.join(builddir, "images", "rootfs.iso9660")
30     emulator.boot(arch="i386", options=["-cdrom", img])
31     emulator.login()
32
33     if internal:
34         cmd = "mount | grep 'rootfs on / type rootfs'"
35     else:
36         cmd = "mount | grep '/dev/root on / type iso9660'"
37
38     _, exit_code = emulator.run(cmd)
39     return exit_code
40
41
42 def test_touch_file(emulator):
43     _, exit_code = emulator.run("touch test")
44     return exit_code
45
46 #
47 # Grub 2
48
49
50 class TestIso9660Grub2External(infra.basetest.BRTest):
51     config = BASIC_CONFIG + \
52         """
53         BR2_TARGET_ROOTFS_ISO9660=y
54         # BR2_TARGET_ROOTFS_ISO9660_INITRD is not set
55         BR2_TARGET_GRUB2=y
56         BR2_TARGET_GRUB2_BOOT_PARTITION="cd"
57         BR2_TARGET_GRUB2_BUILTIN_MODULES="boot linux ext2 fat part_msdos part_gpt normal biosdisk iso9660"
58         BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU="{}"
59         """.format(infra.filepath("conf/grub2.cfg"))
60
61     def test_run(self):
62         exit_code = test_mount_internal_external(self.emulator,
63                                                  self.builddir, internal=False)
64         self.assertEqual(exit_code, 0)
65
66         exit_code = test_touch_file(self.emulator)
67         self.assertEqual(exit_code, 1)
68
69
70 class TestIso9660Grub2Internal(infra.basetest.BRTest):
71     config = BASIC_CONFIG + \
72         """
73         BR2_TARGET_ROOTFS_ISO9660=y
74         BR2_TARGET_ROOTFS_ISO9660_INITRD=y
75         BR2_TARGET_GRUB2=y
76         BR2_TARGET_GRUB2_BOOT_PARTITION="cd"
77         BR2_TARGET_GRUB2_BUILTIN_MODULES="boot linux ext2 fat part_msdos part_gpt normal biosdisk iso9660"
78         BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU="{}"
79         """.format(infra.filepath("conf/grub2.cfg"))
80
81     def test_run(self):
82         exit_code = test_mount_internal_external(self.emulator,
83                                                  self.builddir, internal=True)
84         self.assertEqual(exit_code, 0)
85
86         exit_code = test_touch_file(self.emulator)
87         self.assertEqual(exit_code, 0)
88
89 #
90 # Syslinux
91
92
93 class TestIso9660SyslinuxExternal(infra.basetest.BRTest):
94     config = BASIC_CONFIG + \
95         """
96         BR2_TARGET_ROOTFS_ISO9660=y
97         # BR2_TARGET_ROOTFS_ISO9660_INITRD is not set
98         BR2_TARGET_ROOTFS_ISO9660_HYBRID=y
99         BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU="{}"
100         BR2_TARGET_SYSLINUX=y
101         """.format(infra.filepath("conf/isolinux.cfg"))
102
103     def test_run(self):
104         exit_code = test_mount_internal_external(self.emulator,
105                                                  self.builddir, internal=False)
106         self.assertEqual(exit_code, 0)
107
108         exit_code = test_touch_file(self.emulator)
109         self.assertEqual(exit_code, 1)
110
111
112 class TestIso9660SyslinuxInternal(infra.basetest.BRTest):
113     config = BASIC_CONFIG + \
114         """
115         BR2_TARGET_ROOTFS_ISO9660=y
116         BR2_TARGET_ROOTFS_ISO9660_INITRD=y
117         BR2_TARGET_ROOTFS_ISO9660_HYBRID=y
118         BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU="{}"
119         BR2_TARGET_SYSLINUX=y
120         """.format(infra.filepath("conf/isolinux.cfg"))
121
122     def test_run(self):
123         exit_code = test_mount_internal_external(self.emulator,
124                                                  self.builddir, internal=True)
125         self.assertEqual(exit_code, 0)
126
127         exit_code = test_touch_file(self.emulator)
128         self.assertEqual(exit_code, 0)