~deeptik/linaro-image-tools/fix_bug_Bug816767

« back to all changes in this revision

Viewing changes to linaro_image_tools/media_create/tests/test_media_create.py

  • Committer: Mattias Backman
  • Date: 2011-08-30 08:40:19 UTC
  • mfrom: (397.4.12 hwpacks-v2-snowball)
  • Revision ID: mattias.backman@linaro.org-20110830084019-t2nto3281mbqsk49
Add hwpacks V2 support for Snowball.

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
from linaro_image_tools.media_create.boards import (
47
47
    SAMSUNG_V310_BL1_START,
48
48
    SAMSUNG_V310_BL2_START,
 
49
    SAMSUNG_V310_BL2_LEN,
49
50
    SECTOR_SIZE,
50
51
    align_up,
51
52
    align_partition,
685
686
                    ('UBOOT_ENV', 'u-boot-env.bin', 0, 0x00C1F000, '10')]
686
687
        # Create a config file
687
688
        cfg_file = os.path.join(self.temp_bootdir_path,
688
 
        boards.SnowballEmmcConfig.SNOWBALL_STARTUP_FILES_CONFIG)
 
689
        boards.SnowballEmmcConfig.snowball_startup_files_config)
689
690
        with open(cfg_file, 'w') as f:
690
691
            for line in src_data:
691
692
                # Write comments, so we test that the parser can read them
719
720
    def test_get_file_info_relative_path(self):
720
721
        # Create a config file
721
722
        cfg_file = os.path.join(self.temp_bootdir_path,
722
 
                      boards.SnowballEmmcConfig.SNOWBALL_STARTUP_FILES_CONFIG)
 
723
                      boards.SnowballEmmcConfig.snowball_startup_files_config)
723
724
        uboot_file = 'u-boot.bin'
724
725
        with open(cfg_file, 'w') as f:
725
726
                f.write('%s %s %i %#x %s\n' % ('NORMAL', uboot_file, 0,
733
734
    def test_get_file_info_abs_path(self):
734
735
        # Create a config file
735
736
        cfg_file = os.path.join(self.temp_bootdir_path,
736
 
                      boards.SnowballEmmcConfig.SNOWBALL_STARTUP_FILES_CONFIG)
 
737
                      boards.SnowballEmmcConfig.snowball_startup_files_config)
737
738
        uboot_dir = tempfile.mkdtemp(dir=self.tempdir)
738
739
        uboot_file = os.path.join(uboot_dir, 'u-boot.bin')
739
740
        uboot_relative_file = uboot_file.replace(self.tempdir, '')
748
749
    def test_get_file_info_raises(self):
749
750
        # Create a config file
750
751
        cfg_file = os.path.join(self.temp_bootdir_path,
751
 
                      boards.SnowballEmmcConfig.SNOWBALL_STARTUP_FILES_CONFIG)
 
752
                      boards.SnowballEmmcConfig.snowball_startup_files_config)
752
753
        with open(cfg_file, 'w') as f:
753
754
                f.write('%s %s %i %#x %s\n' % ('NORMAL', 'u-boot.bin', 0,
754
755
                                               0xBA0000, '9'))
1142
1143
                '794624,-,E\n794624,524288,L\n1318912,1048576,L\n2367488,,,-', 
1143
1144
                android_boards.AndroidSnowballEmmcConfig.get_sfdisk_cmd())
1144
1145
 
 
1146
class TestGetSfdiskCmdV2(TestCase):
 
1147
 
 
1148
    def test_mx5(self):
 
1149
        class config(boards.Mx5Config):
 
1150
            partition_layout = 'reserved_bootfs_rootfs'
 
1151
        self.assertEqual(
 
1152
            '1,8191,0xDA\n8192,106496,0x0C,*\n114688,,,-',
 
1153
            config.get_sfdisk_cmd())
 
1154
 
 
1155
    def test_snowball_sd(self):
 
1156
        class config(boards.SnowballSdConfig):
 
1157
            partition_layout = 'bootfs_rootfs'
 
1158
        self.assertEqual(
 
1159
            '63,106432,0x0C,*\n106496,,,-',
 
1160
            config.get_sfdisk_cmd())
 
1161
 
 
1162
    def test_snowball_emmc(self):
 
1163
        class config(boards.SnowballEmmcConfig):
 
1164
            partition_layout = 'reserved_bootfs_rootfs'
 
1165
            LOADER_START_S = (128 * 1024) / SECTOR_SIZE
 
1166
        self.assertEqual(
 
1167
            '256,7936,0xDA\n8192,106496,0x0C,*\n114688,,,-',
 
1168
            config.get_sfdisk_cmd())
 
1169
 
 
1170
    def test_smdkv310(self):
 
1171
        class config(board_configs['smdkv310']):
 
1172
            partition_layout = 'reserved_bootfs_rootfs'
 
1173
            LOADER_MIN_SIZE_S = (SAMSUNG_V310_BL2_START +
 
1174
                                 SAMSUNG_V310_BL2_LEN -
 
1175
                                 SAMSUNG_V310_BL1_START)
 
1176
        self.assertEquals(
 
1177
            '1,8191,0xDA\n8192,106496,0x0C,*\n114688,,,-',
 
1178
            config.get_sfdisk_cmd())
 
1179
 
 
1180
    def test_origen(self):
 
1181
        class config(board_configs['origen']):
 
1182
            partition_layout = 'reserved_bootfs_rootfs'
 
1183
            LOADER_MIN_SIZE_S = (SAMSUNG_V310_BL2_START +
 
1184
                                 SAMSUNG_V310_BL2_LEN -
 
1185
                                 SAMSUNG_V310_BL1_START)
 
1186
        self.assertEquals(
 
1187
            '1,8191,0xDA\n8192,106496,0x0C,*\n114688,,,-',
 
1188
            config.get_sfdisk_cmd())
 
1189
 
1145
1190
 
1146
1191
class TestGetBootCmd(TestCase):
1147
1192