719
def test_get_file_info_relative_path(self):
720
# Create a config file
721
cfg_file = os.path.join(self.temp_bootdir_path,
722
boards.SnowballEmmcConfig.SNOWBALL_STARTUP_FILES_CONFIG)
723
uboot_file = 'u-boot.bin'
724
with open(cfg_file, 'w') as f:
725
f.write('%s %s %i %#x %s\n' % ('NORMAL', uboot_file, 0,
727
with open(os.path.join(self.temp_bootdir_path, uboot_file), 'w') as f:
728
file_info = boards.SnowballEmmcConfig.get_file_info(
730
self.assertEquals(file_info[0]['filename'],
731
os.path.join(self.temp_bootdir_path, uboot_file))
733
def test_get_file_info_abs_path(self):
734
# Create a config file
735
cfg_file = os.path.join(self.temp_bootdir_path,
736
boards.SnowballEmmcConfig.SNOWBALL_STARTUP_FILES_CONFIG)
737
uboot_dir = tempfile.mkdtemp(dir=self.tempdir)
738
uboot_file = os.path.join(uboot_dir, 'u-boot.bin')
739
uboot_relative_file = uboot_file.replace(self.tempdir, '')
740
with open(cfg_file, 'w') as f:
741
f.write('%s %s %i %#x %s\n' % ('NORMAL', uboot_relative_file, 0,
743
with open(uboot_file, 'w') as f:
744
file_info = boards.SnowballEmmcConfig.get_file_info(
746
self.assertEquals(file_info[0]['filename'], uboot_file)
748
def test_get_file_info_raises(self):
749
# Create a config file
750
cfg_file = os.path.join(self.temp_bootdir_path,
751
boards.SnowballEmmcConfig.SNOWBALL_STARTUP_FILES_CONFIG)
752
with open(cfg_file, 'w') as f:
753
f.write('%s %s %i %#x %s\n' % ('NORMAL', 'u-boot.bin', 0,
755
self.assertRaises(AssertionError, boards.SnowballEmmcConfig.get_file_info,
719
758
def test_file_name_size(self):
720
759
''' Test using a to large toc file '''
721
760
_, toc_filename = tempfile.mkstemp()