@@ -39,6 +39,7 @@ def setup(self, mock_FirmWare):
3939 self .bootloader .custom_args ['initrd' ] = None
4040 self .bootloader .custom_args ['boot_options' ] = {}
4141 self .bootloader .custom_args ['targetbase' ] = '/dev/disk'
42+ self .bootloader .custom_args ['target_dir' ] = 'target_dir'
4243 self .bootloader .sys_mount = Mock (
4344 mountpoint = 'sys_mount'
4445 )
@@ -63,6 +64,7 @@ def test_setup_loader_raises_invalid_target(self, mock_os_unlink):
6364 with raises (KiwiBootLoaderTargetError ):
6465 self .bootloader .setup_loader ('iso' )
6566
67+ @patch ('shutil.move' )
6668 @patch ('os.unlink' )
6769 @patch ('os.path.exists' )
6870 @patch ('kiwi.bootloader.config.zipl.BootImageBase.get_boot_names' )
@@ -79,7 +81,7 @@ def test_setup_loader(
7981 mock_write_config_file , mock_Temporary_new_file ,
8082 mock_BootLoaderTemplateZipl , mock_Command_run ,
8183 mock_Path_create , mock_Path_wipe , mock_BootImageBase_get_boot_names ,
82- mock_os_path_exists , mock_os_unlink
84+ mock_os_path_exists , mock_os_unlink , mock_shutil_move
8385 ):
8486 temporary = Mock ()
8587 temporary .name = 'system_root_mount/kiwi_zipl.conf_'
@@ -146,6 +148,22 @@ def test_setup_loader(
146148 '--crl' , '/path/to/revocation-list.crl' ,
147149 ]
148150 ),
151+ call (
152+ [
153+ 'chroot' , 'system_root_mount' , 'pvextract-hdr' ,
154+ '-o' , 'secure_execution_header.bin' ,
155+ 'bootpath/kernel-filename.cc'
156+ ]
157+ ),
158+ call (
159+ [
160+ 'chroot' , 'system_root_mount' , 'pvattest' , 'create' ,
161+ '--no-verify' , '--verbose' ,
162+ '-o' , 'attestation_request.bin' ,
163+ '--arpk' , 'attestation_response.key' ,
164+ '-k' , '/path/to/host.crt'
165+ ]
166+ ),
149167 call (
150168 [
151169 'chroot' , 'system_root_mount' , 'zipl' ,
@@ -156,6 +174,23 @@ def test_setup_loader(
156174 ]
157175 )
158176 ]
177+ assert mock_shutil_move .call_args_list == [
178+ call (
179+ 'system_root_mount/secure_execution_header.bin' ,
180+ 'target_dir/image-name.x86_64-image-version.'
181+ 'secure_execution_header.bin'
182+ ),
183+ call (
184+ 'system_root_mount/attestation_request.bin' ,
185+ 'target_dir/image-name.x86_64-image-version.'
186+ 'attestation_request.bin'
187+ ),
188+ call (
189+ 'system_root_mount/attestation_response.key' ,
190+ 'target_dir/image-name.x86_64-image-version.'
191+ 'attestation_response.key'
192+ )
193+ ]
159194 assert mock_os_unlink .call_args_list == [
160195 call ('system_root_mount/bootpath/kernel-filename.cc' ),
161196 call ('system_root_mount/bootpath/kernel-filename' ),
0 commit comments