def test_str_with_kernel_file(self):
     metadata = Metadata("ahwpack", "4", "armel", format=HardwarePackFormatV2())
     metadata.add_v2_config(vmlinuz="boot/vmlinuz-3.0.0-1002-linaro-omap")
     expected_out = (
         "NAME=ahwpack\nVERSION=4\nARCHITECTURE=armel\n" "KERNEL_FILE=boot/vmlinuz-3.0.0-1002-linaro-omap\n"
     )
     self.assertEqual(expected_out, str(metadata))
 def test_format(self):
     metadata = Metadata("ahwpack", "4", "armel", format=HardwarePackFormatV3())
     # Need to call also this one!
     metadata.add_v2_config()
     metadata.add_v3_config(bootloaders=None)
     expected_out = "format: '3.0'\nname: ahwpack\nversion: '4'\n" "architecture: armel\n"
     self.assertEqual(expected_out, str(metadata))
 def test_str_with_initrd_file(self):
     metadata = Metadata("ahwpack", "4", "armel", format=HardwarePackFormatV2())
     metadata.add_v2_config(initrd="boot/initrd.img-3.0.0-1002-linaro-omap")
     expected_out = (
         "NAME=ahwpack\nVERSION=4\nARCHITECTURE=armel\n" "INITRD_FILE=boot/initrd.img-3.0.0-1002-linaro-omap\n"
     )
     self.assertEqual(expected_out, str(metadata))
 def test_str_with_initrd_file(self):
     metadata = Metadata("ahwpack",
                         "4",
                         "armel",
                         format=HardwarePackFormatV2())
     metadata.add_v2_config(initrd='boot/initrd.img-3.0.0-1002-linaro-omap')
     expected_out = ("NAME=ahwpack\nVERSION=4\nARCHITECTURE=armel\n"
                     "INITRD_FILE=boot/initrd.img-3.0.0-1002-linaro-omap\n")
     self.assertEqual(expected_out, str(metadata))
 def test_str_with_kernel_file(self):
     metadata = Metadata("ahwpack",
                         "4",
                         "armel",
                         format=HardwarePackFormatV2())
     metadata.add_v2_config(vmlinuz='boot/vmlinuz-3.0.0-1002-linaro-omap')
     expected_out = ("NAME=ahwpack\nVERSION=4\nARCHITECTURE=armel\n"
                     "KERNEL_FILE=boot/vmlinuz-3.0.0-1002-linaro-omap\n")
     self.assertEqual(expected_out, str(metadata))
 def test_str_with_loader_min_size(self):
     metadata = Metadata("ahwpack",
                         "4",
                         "armel",
                         format=HardwarePackFormatV2())
     metadata.add_v2_config(loader_min_size='1')
     expected_out = ("NAME=ahwpack\nVERSION=4\nARCHITECTURE=armel\n"
                     "LOADER_MIN_SIZE=1\n")
     self.assertEqual(expected_out, str(metadata))
 def test_str_with_mmc_id(self):
     metadata = Metadata("ahwpack",
                         "4",
                         "armel",
                         format=HardwarePackFormatV2())
     metadata.add_v2_config(mmc_id='1')
     expected_out = ("NAME=ahwpack\nVERSION=4\nARCHITECTURE=armel\n"
                     "MMC_ID=1\n")
     self.assertEqual(expected_out, str(metadata))
 def test_str_with_partition_layout(self):
     metadata = Metadata("ahwpack",
                         "4",
                         "armel",
                         format=HardwarePackFormatV2())
     metadata.add_v2_config(partition_layout='bootfs_rootfs')
     expected_out = ("NAME=ahwpack\nVERSION=4\nARCHITECTURE=armel\n"
                     "PARTITION_LAYOUT=bootfs_rootfs\n")
     self.assertEqual(expected_out, str(metadata))
 def test_str_with_wireless_interfaces(self):
     metadata = Metadata("ahwpack",
                         "4",
                         "armel",
                         format=HardwarePackFormatV2())
     metadata.add_v2_config(wireless_interfaces=['wlan0', 'wl0'])
     expected_out = ("NAME=ahwpack\nVERSION=4\nARCHITECTURE=armel\n"
                     "WIRELESS_INTERFACES=wlan0 wl0\n")
     self.assertEqual(expected_out, str(metadata))
 def test_str_with_boot_script(self):
     metadata = Metadata("ahwpack",
                         "4",
                         "armel",
                         format=HardwarePackFormatV2())
     metadata.add_v2_config(boot_script='boot.scr')
     expected_out = ("NAME=ahwpack\nVERSION=4\nARCHITECTURE=armel\n"
                     "BOOT_SCRIPT=boot.scr\n")
     self.assertEqual(expected_out, str(metadata))
 def test_str_with_dtb_file(self):
     metadata = Metadata("ahwpack", "4", "armel", format=HardwarePackFormatV2())
     metadata.add_v2_config(dtb_file="boot/dt-3.0.0-1002-linaro-omap/omap4-panda.dtb")
     expected_out = (
         "NAME=ahwpack\nVERSION=4\n"
         "ARCHITECTURE=armel\nDTB_FILE="
         "boot/dt-3.0.0-1002-linaro-omap/omap4-panda.dtb\n"
     )
     self.assertEqual(expected_out, str(metadata))
 def test_str_with_serial_tty(self):
     metadata = Metadata("ahwpack",
                         "4",
                         "armel",
                         format=HardwarePackFormatV2())
     metadata.add_v2_config(serial_tty='ttyO2')
     expected_out = ("NAME=ahwpack\nVERSION=4\nARCHITECTURE=armel\n"
                     "SERIAL_TTY=ttyO2\n")
     self.assertEqual(expected_out, str(metadata))
 def test_str_with_extra_serial_options(self):
     metadata = Metadata("ahwpack", "4", "armel", format=HardwarePackFormatV2())
     metadata.add_v2_config(extra_serial_options="console=tty0 console=ttyO2,115200n8")
     expected_out = (
         "NAME=ahwpack\nVERSION=4\n"
         "ARCHITECTURE=armel\nEXTRA_SERIAL_OPTIONS="
         "console=tty0 console=ttyO2,115200n8\n"
     )
     self.assertEqual(expected_out, str(metadata))
 def test_str_with_dtb_addr(self):
     metadata = Metadata("ahwpack",
                         "4",
                         "armel",
                         format=HardwarePackFormatV2())
     metadata.add_v2_config(dtb_addr='0x80000000')
     expected_out = ("NAME=ahwpack\nVERSION=4\nARCHITECTURE=armel\n"
                     "DTB_ADDR=0x80000000\n")
     self.assertEqual(expected_out, str(metadata))
 def test_section_wired(self):
     metadata = Metadata("ahwpack", "4", "armel", format=HardwarePackFormatV3())
     wired_list = ["eth0", "usb0"]
     # Need to call also this one!
     metadata.add_v2_config(wired_interfaces=wired_list)
     metadata.add_v3_config(bootloaders=None)
     expected_out = (
         "format: '3.0'\nname: ahwpack\nversion: '4'\n" "architecture: armel\nwired_interfaces: eth0 usb0\n"
     )
     self.assertEqual(expected_out, str(metadata))
 def test_str_with_dtb_file(self):
     metadata = Metadata("ahwpack",
                         "4",
                         "armel",
                         format=HardwarePackFormatV2())
     metadata.add_v2_config(
         dtb_file='boot/dt-3.0.0-1002-linaro-omap/omap4-panda.dtb')
     expected_out = ("NAME=ahwpack\nVERSION=4\n"
                     "ARCHITECTURE=armel\nDTB_FILE="
                     "boot/dt-3.0.0-1002-linaro-omap/omap4-panda.dtb\n")
     self.assertEqual(expected_out, str(metadata))
 def test_format(self):
     metadata = Metadata("ahwpack",
                         "4",
                         "armel",
                         format=HardwarePackFormatV3())
     # Need to call also this one!
     metadata.add_v2_config()
     metadata.add_v3_config(bootloaders=None)
     expected_out = ("format: '3.0'\nname: ahwpack\nversion: '4'\n"
                     "architecture: armel\n")
     self.assertEqual(expected_out, str(metadata))
 def test_str_with_extra_serial_options(self):
     metadata = Metadata("ahwpack",
                         "4",
                         "armel",
                         format=HardwarePackFormatV2())
     metadata.add_v2_config(
         extra_serial_options='console=tty0 console=ttyO2,115200n8')
     expected_out = ("NAME=ahwpack\nVERSION=4\n"
                     "ARCHITECTURE=armel\nEXTRA_SERIAL_OPTIONS="
                     "console=tty0 console=ttyO2,115200n8\n")
     self.assertEqual(expected_out, str(metadata))
 def test_section_wired(self):
     metadata = Metadata("ahwpack",
                         "4",
                         "armel",
                         format=HardwarePackFormatV3())
     wired_list = ['eth0', 'usb0']
     # Need to call also this one!
     metadata.add_v2_config(wired_interfaces=wired_list)
     metadata.add_v3_config(bootloaders=None)
     expected_out = ("format: '3.0'\nname: ahwpack\nversion: '4'\n"
                     "architecture: armel\nwired_interfaces: eth0 usb0\n")
     self.assertEqual(expected_out, str(metadata))
 def test_section_extra_serial_options(self):
     metadata = Metadata("ahwpack", "4", "armel", format=HardwarePackFormatV3())
     options = ["option1", "option2,option3"]
     # Need to call also this one!
     metadata.add_v2_config(extra_serial_options=options)
     metadata.add_v3_config(bootloaders=None)
     expected_out = (
         "format: '3.0'\nname: ahwpack\nversion: '4'\n"
         "architecture: armel\nextra_serial_options: option1 "
         "option2,option3\n"
     )
     self.assertEqual(expected_out, str(metadata))
 def test_section_bootloaders(self):
     bootloaders = {"u_boot": {"file": "a_file"}}
     metadata = Metadata("ahwpack", "4", "armel", format=HardwarePackFormatV3())
     # Need to call also this one!
     metadata.add_v2_config()
     metadata.add_v3_config(bootloaders=bootloaders)
     expected_out = (
         "format: '3.0'\nname: ahwpack\nversion: '4'\n"
         "architecture: armel\nbootloaders:\n  u_boot:\n"
         "    file: a_file\n"
     )
     self.assertEqual(expected_out, str(metadata))
 def test_str_with_extra_boot_options(self):
     metadata = Metadata("ahwpack",
                         "4",
                         "armel",
                         format=HardwarePackFormatV2())
     metadata.add_v2_config(extra_boot_options=(
         'earlyprintk fixrtc nocompcache vram=48M omapfb.vram=0:24M '
         'mem=456M@0x80000000 mem=512M@0xA0000000'))
     expected_out = ("NAME=ahwpack\nVERSION=4\nARCHITECTURE=armel\n"
                     "EXTRA_BOOT_OPTIONS=earlyprintk fixrtc nocompcache "
                     "vram=48M omapfb.vram=0:24M "
                     "mem=456M@0x80000000 mem=512M@0xA0000000\n")
     self.assertEqual(expected_out, str(metadata))
 def test_section_extra_serial_options(self):
     metadata = Metadata("ahwpack",
                         "4",
                         "armel",
                         format=HardwarePackFormatV3())
     options = ['option1', 'option2,option3']
     # Need to call also this one!
     metadata.add_v2_config(extra_serial_options=options)
     metadata.add_v3_config(bootloaders=None)
     expected_out = ("format: '3.0'\nname: ahwpack\nversion: '4'\n"
                     "architecture: armel\nextra_serial_options: option1 "
                     "option2,option3\n")
     self.assertEqual(expected_out, str(metadata))
 def test_section_bootloaders(self):
     bootloaders = {'u_boot': {'file': 'a_file'}}
     metadata = Metadata("ahwpack",
                         "4",
                         "armel",
                         format=HardwarePackFormatV3())
     # Need to call also this one!
     metadata.add_v2_config()
     metadata.add_v3_config(bootloaders=bootloaders)
     expected_out = ("format: '3.0'\nname: ahwpack\nversion: '4'\n"
                     "architecture: armel\nbootloaders:\n  u_boot:\n"
                     "    file: a_file\n")
     self.assertEqual(expected_out, str(metadata))
 def test_str_with_extra_boot_options(self):
     metadata = Metadata("ahwpack", "4", "armel", format=HardwarePackFormatV2())
     metadata.add_v2_config(
         extra_boot_options=(
             "earlyprintk fixrtc nocompcache vram=48M omapfb.vram=0:24M " "mem=456M@0x80000000 mem=512M@0xA0000000"
         )
     )
     expected_out = (
         "NAME=ahwpack\nVERSION=4\nARCHITECTURE=armel\n"
         "EXTRA_BOOT_OPTIONS=earlyprintk fixrtc nocompcache "
         "vram=48M omapfb.vram=0:24M "
         "mem=456M@0x80000000 mem=512M@0xA0000000\n"
     )
     self.assertEqual(expected_out, str(metadata))
 def test_str_with_serial_tty(self):
     metadata = Metadata("ahwpack", "4", "armel", format=HardwarePackFormatV2())
     metadata.add_v2_config(serial_tty="ttyO2")
     expected_out = "NAME=ahwpack\nVERSION=4\nARCHITECTURE=armel\n" "SERIAL_TTY=ttyO2\n"
     self.assertEqual(expected_out, str(metadata))
 def test_str_with_boot_script(self):
     metadata = Metadata("ahwpack", "4", "armel", format=HardwarePackFormatV2())
     metadata.add_v2_config(boot_script="boot.scr")
     expected_out = "NAME=ahwpack\nVERSION=4\nARCHITECTURE=armel\n" "BOOT_SCRIPT=boot.scr\n"
     self.assertEqual(expected_out, str(metadata))
 def test_str_with_dtb_addr(self):
     metadata = Metadata("ahwpack", "4", "armel", format=HardwarePackFormatV2())
     metadata.add_v2_config(dtb_addr="0x80000000")
     expected_out = "NAME=ahwpack\nVERSION=4\nARCHITECTURE=armel\n" "DTB_ADDR=0x80000000\n"
     self.assertEqual(expected_out, str(metadata))
 def test_str_with_wireless_interfaces(self):
     metadata = Metadata("ahwpack", "4", "armel", format=HardwarePackFormatV2())
     metadata.add_v2_config(wireless_interfaces=["wlan0", "wl0"])
     expected_out = "NAME=ahwpack\nVERSION=4\nARCHITECTURE=armel\n" "WIRELESS_INTERFACES=wlan0 wl0\n"
     self.assertEqual(expected_out, str(metadata))
 def test_str_with_partition_layout(self):
     metadata = Metadata("ahwpack", "4", "armel", format=HardwarePackFormatV2())
     metadata.add_v2_config(partition_layout="bootfs_rootfs")
     expected_out = "NAME=ahwpack\nVERSION=4\nARCHITECTURE=armel\n" "PARTITION_LAYOUT=bootfs_rootfs\n"
     self.assertEqual(expected_out, str(metadata))
 def test_str_with_loader_min_size(self):
     metadata = Metadata("ahwpack", "4", "armel", format=HardwarePackFormatV2())
     metadata.add_v2_config(loader_min_size="1")
     expected_out = "NAME=ahwpack\nVERSION=4\nARCHITECTURE=armel\n" "LOADER_MIN_SIZE=1\n"
     self.assertEqual(expected_out, str(metadata))
 def test_str_with_mmc_id(self):
     metadata = Metadata("ahwpack", "4", "armel", format=HardwarePackFormatV2())
     metadata.add_v2_config(mmc_id="1")
     expected_out = "NAME=ahwpack\nVERSION=4\nARCHITECTURE=armel\n" "MMC_ID=1\n"
     self.assertEqual(expected_out, str(metadata))