mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-10-03 18:10:42 +09:00
test/py: gpt: copy persistent file
copy the persistent gpt binary file as it can be modified during the test that avoid issue if the test fail: the test always restart with clean file Acked-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
This commit is contained in:
parent
6087be2ba6
commit
da4c4bbd61
@ -28,24 +28,29 @@ class GptTestDiskImage(object):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
filename = 'test_gpt_disk_image.bin'
|
filename = 'test_gpt_disk_image.bin'
|
||||||
self.path = u_boot_console.config.persistent_data_dir + '/' + filename
|
|
||||||
|
|
||||||
if os.path.exists(self.path):
|
persistent = u_boot_console.config.persistent_data_dir + '/' + filename
|
||||||
u_boot_console.log.action('Disk image file ' + self.path +
|
self.path = u_boot_console.config.result_dir + '/' + filename
|
||||||
|
|
||||||
|
if os.path.exists(persistent):
|
||||||
|
u_boot_console.log.action('Disk image file ' + persistent +
|
||||||
' already exists')
|
' already exists')
|
||||||
else:
|
else:
|
||||||
u_boot_console.log.action('Generating ' + self.path)
|
u_boot_console.log.action('Generating ' + persistent)
|
||||||
fd = os.open(self.path, os.O_RDWR | os.O_CREAT)
|
fd = os.open(persistent, os.O_RDWR | os.O_CREAT)
|
||||||
os.ftruncate(fd, 4194304)
|
os.ftruncate(fd, 4194304)
|
||||||
os.close(fd)
|
os.close(fd)
|
||||||
cmd = ('sgdisk', '-U', '375a56f7-d6c9-4e81-b5f0-09d41ca89efe',
|
cmd = ('sgdisk', '-U', '375a56f7-d6c9-4e81-b5f0-09d41ca89efe',
|
||||||
self.path)
|
persistent)
|
||||||
u_boot_utils.run_and_log(u_boot_console, cmd)
|
u_boot_utils.run_and_log(u_boot_console, cmd)
|
||||||
cmd = ('sgdisk', '--new=1:2048:2560', self.path)
|
cmd = ('sgdisk', '--new=1:2048:2560', persistent)
|
||||||
u_boot_utils.run_and_log(u_boot_console, cmd)
|
u_boot_utils.run_and_log(u_boot_console, cmd)
|
||||||
cmd = ('sgdisk', '--new=2:4096:4608', self.path)
|
cmd = ('sgdisk', '--new=2:4096:4608', persistent)
|
||||||
u_boot_utils.run_and_log(u_boot_console, cmd)
|
u_boot_utils.run_and_log(u_boot_console, cmd)
|
||||||
cmd = ('sgdisk', '-l', self.path)
|
cmd = ('sgdisk', '-l', persistent)
|
||||||
|
u_boot_utils.run_and_log(u_boot_console, cmd)
|
||||||
|
|
||||||
|
cmd = ('cp', persistent, self.path)
|
||||||
u_boot_utils.run_and_log(u_boot_console, cmd)
|
u_boot_utils.run_and_log(u_boot_console, cmd)
|
||||||
|
|
||||||
gtdi = None
|
gtdi = None
|
||||||
|
Loading…
Reference in New Issue
Block a user