def test_basic_parse(self):
     ini_format = '[hwpack]\nformat=2.0\nsupport=supported'
     output_format = "format: '3.0'\nsupport: supported\n"
     input_file = self.useFixture(
         CreateTempFileFixture(ini_format)).get_file_name()
     output_file = self.useFixture(CreateTempFileFixture()).get_file_name()
     converter = HwpackConverter(input_file, output_file)
     converter._parse()
     self.assertEqual(output_format, str(converter))
Esempio n. 2
0
 def test_basic_parse(self):
     ini_format = '[hwpack]\nformat=2.0\nsupport=supported'
     output_format = "format: '3.0'\nsupport: supported\n"
     input_file = self.useFixture(
         CreateTempFileFixture(ini_format)).get_file_name()
     output_file = self.useFixture(CreateTempFileFixture()).get_file_name()
     converter = HwpackConverter(input_file, output_file)
     converter._parse()
     self.assertEqual(output_format, str(converter))
 def test_include_debs(self):
     """Tests the correct creation of the extra_serial_options part."""
     ini_format = ("[hwpack]\nformat=2.0\ninclude-debs=yes")
     out_format = ("format: '3.0'\ninclude_debs: true\n")
     input_file = self.useFixture(
         CreateTempFileFixture(ini_format)).get_file_name()
     output_file = self.useFixture(CreateTempFileFixture()).get_file_name()
     converter = HwpackConverter(input_file, output_file)
     converter._parse()
     self.assertEqual(out_format, str(converter))
Esempio n. 4
0
 def test_include_debs(self):
     """Tests the correct creation of the extra_serial_options part."""
     ini_format = ("[hwpack]\nformat=2.0\ninclude-debs=yes")
     out_format = ("format: '3.0'\ninclude_debs: true\n")
     input_file = self.useFixture(
         CreateTempFileFixture(ini_format)).get_file_name()
     output_file = self.useFixture(CreateTempFileFixture()).get_file_name()
     converter = HwpackConverter(input_file, output_file)
     converter._parse()
     self.assertEqual(out_format, str(converter))
 def test_dtb_file(self):
     """Test the dtb_file conversion."""
     ini_format = ("[hwpack]\nformat=2.0\ndtb_file=boot/a-*-path/file.dtb")
     out_format = ("format: '3.0'\ndtb_files:\n- board.dtb: "
                   "boot/a-*-path/file.dtb\n")
     input_file = self.useFixture(
         CreateTempFileFixture(ini_format)).get_file_name()
     output_file = self.useFixture(CreateTempFileFixture()).get_file_name()
     converter = HwpackConverter(input_file, output_file)
     converter._parse()
     self.assertEqual(out_format, str(converter))
Esempio n. 6
0
 def test_dtb_file(self):
     """Test the dtb_file conversion."""
     ini_format = ("[hwpack]\nformat=2.0\ndtb_file=boot/a-*-path/file.dtb")
     out_format = ("format: '3.0'\ndtb_files:\n- board.dtb: "
                   "boot/a-*-path/file.dtb\n")
     input_file = self.useFixture(
         CreateTempFileFixture(ini_format)).get_file_name()
     output_file = self.useFixture(CreateTempFileFixture()).get_file_name()
     converter = HwpackConverter(input_file, output_file)
     converter._parse()
     self.assertEqual(out_format, str(converter))
 def test_architectures_section_creation(self):
     """Tests that we create the correct architectures list in the
     converted file.
     """
     ini_format = '[hwpack]\nformat=2.0\narchitectures=armhf armel'
     output_format = "format: '3.0'\narchitectures:\n- armhf\n- armel\n"
     input_file = self.useFixture(
         CreateTempFileFixture(ini_format)).get_file_name()
     output_file = self.useFixture(CreateTempFileFixture()).get_file_name()
     converter = HwpackConverter(input_file, output_file)
     converter._parse()
     self.assertEqual(output_format, str(converter))
 def test_assume_installed(self):
     """Tests the correct creation of the extra_serial_options part."""
     ini_format = ("[hwpack]\nformat=2.0\nassume-installed=install1 "
                   "install2")
     out_format = ("format: '3.0'\nassume_installed:\n- install1\n- "
                   "install2\n")
     input_file = self.useFixture(
         CreateTempFileFixture(ini_format)).get_file_name()
     output_file = self.useFixture(CreateTempFileFixture()).get_file_name()
     converter = HwpackConverter(input_file, output_file)
     converter._parse()
     self.assertEqual(out_format, str(converter))
Esempio n. 9
0
 def test_architectures_section_creation(self):
     """Tests that we create the correct architectures list in the
     converted file.
     """
     ini_format = '[hwpack]\nformat=2.0\narchitectures=armhf armel'
     output_format = "format: '3.0'\narchitectures:\n- armhf\n- armel\n"
     input_file = self.useFixture(
         CreateTempFileFixture(ini_format)).get_file_name()
     output_file = self.useFixture(CreateTempFileFixture()).get_file_name()
     converter = HwpackConverter(input_file, output_file)
     converter._parse()
     self.assertEqual(output_format, str(converter))
Esempio n. 10
0
 def test_assume_installed(self):
     """Tests the correct creation of the extra_serial_options part."""
     ini_format = ("[hwpack]\nformat=2.0\nassume-installed=install1 "
                   "install2")
     out_format = ("format: '3.0'\nassume_installed:\n- install1\n- "
                   "install2\n")
     input_file = self.useFixture(
         CreateTempFileFixture(ini_format)).get_file_name()
     output_file = self.useFixture(CreateTempFileFixture()).get_file_name()
     converter = HwpackConverter(input_file, output_file)
     converter._parse()
     self.assertEqual(out_format, str(converter))
 def test_extra_boot_options(self):
     """Tests the correct creation of the extra_boot_options part."""
     ini_format = ("[hwpack]\nformat=2.0\nu_boot_package=a_package\n"
                   "extra_boot_options=opt1 opt2")
     out_format = ("format: '3.0'\nbootloaders:\n  u_boot:\n "
                   "   extra_boot_options:\n    - opt1\n    "
                   "- opt2\n    package: a_package\n")
     input_file = self.useFixture(
         CreateTempFileFixture(ini_format)).get_file_name()
     output_file = self.useFixture(CreateTempFileFixture()).get_file_name()
     converter = HwpackConverter(input_file, output_file)
     converter._parse()
     self.assertEqual(out_format, str(converter))
Esempio n. 12
0
 def test_extra_boot_options(self):
     """Tests the correct creation of the extra_boot_options part."""
     ini_format = ("[hwpack]\nformat=2.0\nu_boot_package=a_package\n"
                   "extra_boot_options=opt1 opt2")
     out_format = ("format: '3.0'\nbootloaders:\n  u_boot:\n "
                   "   extra_boot_options:\n    - opt1\n    "
                   "- opt2\n    package: a_package\n")
     input_file = self.useFixture(
         CreateTempFileFixture(ini_format)).get_file_name()
     output_file = self.useFixture(CreateTempFileFixture()).get_file_name()
     converter = HwpackConverter(input_file, output_file)
     converter._parse()
     self.assertEqual(out_format, str(converter))
 def test_bootloaders(self):
     """Tests the correct creation of the bootloaders part."""
     ini_format = ("[hwpack]\nformat=2.0\nu_boot_package=a_package\n"
                   "u_boot_file=a_file\nu_boot_in_boot_part=Yes\n"
                   "u_boot_dd=33")
     out_format = ("format: '3.0'\nbootloaders:\n  u_boot:\n    dd: '33'"
                   "\n    file: a_file\n    in_boot_part: true\n"
                   "    package: a_package\n")
     input_file = self.useFixture(
         CreateTempFileFixture(ini_format)).get_file_name()
     output_file = self.useFixture(CreateTempFileFixture()).get_file_name()
     converter = HwpackConverter(input_file, output_file)
     converter._parse()
     self.assertEqual(out_format, str(converter))
    def test_mmc_id(self):
        """Test correct handling of mmc_id field.

        The mmc_id field has to be quoted coming out from the converter
        otherwise when reading the yaml file the value is read as a number,
        not a string."""
        ini_format = ("[hwpack]\nformat=2.0\nmmc_id=1:1")
        out_format = ("format: '3.0'\nmmc_id: '1:1'\n")
        input_file = self.useFixture(
            CreateTempFileFixture(ini_format)).get_file_name()
        output_file = self.useFixture(CreateTempFileFixture()).get_file_name()
        converter = HwpackConverter(input_file, output_file)
        converter._parse()
        self.assertEqual(out_format, str(converter))
Esempio n. 15
0
 def test_bootloaders(self):
     """Tests the correct creation of the bootloaders part."""
     ini_format = ("[hwpack]\nformat=2.0\nu_boot_package=a_package\n"
                   "u_boot_file=a_file\nu_boot_in_boot_part=Yes\n"
                   "u_boot_dd=33")
     out_format = ("format: '3.0'\nbootloaders:\n  u_boot:\n    dd: '33'"
                   "\n    file: a_file\n    in_boot_part: true\n"
                   "    package: a_package\n")
     input_file = self.useFixture(
         CreateTempFileFixture(ini_format)).get_file_name()
     output_file = self.useFixture(CreateTempFileFixture()).get_file_name()
     converter = HwpackConverter(input_file, output_file)
     converter._parse()
     self.assertEqual(out_format, str(converter))
Esempio n. 16
0
    def test_mmc_id(self):
        """Test correct handling of mmc_id field.

        The mmc_id field has to be quoted coming out from the converter
        otherwise when reading the yaml file the value is read as a number,
        not a string."""
        ini_format = ("[hwpack]\nformat=2.0\nmmc_id=1:1")
        out_format = ("format: '3.0'\nmmc_id: '1:1'\n")
        input_file = self.useFixture(
            CreateTempFileFixture(ini_format)).get_file_name()
        output_file = self.useFixture(CreateTempFileFixture()).get_file_name()
        converter = HwpackConverter(input_file, output_file)
        converter._parse()
        self.assertEqual(out_format, str(converter))