@@ -18,8 +18,10 @@ class RefkitSwupdUpdateBase(HTTPUpdate):
1818 IMAGE_BBAPPEND = IMAGE_PN + '.bbappend'
1919 IMAGE_BBAPPEND_UPDATE = IMAGE_BBAPPEND
2020
21- SWUPD_DIR = os .path .join (HTTPUpdate .BB_VARS ['DEPLOY_DIR' ], 'swupd' , HTTPUpdate .BB_VARS ['MACHINE' ], IMAGE_PN )
22- REPO_DIR = os .path .join (SWUPD_DIR , 'www' )
21+ def setUp (self ):
22+ self .SWUPD_DIR = os .path .join (HTTPUpdate .BB_VARS ['DEPLOY_DIR' ], 'swupd' , HTTPUpdate .BB_VARS ['MACHINE' ], self .IMAGE_PN )
23+ self .REPO_DIR = os .path .join (self .SWUPD_DIR , 'www' )
24+ super ().setUp ()
2325
2426 IMAGE_MODIFY = copy .copy (HTTPUpdate .IMAGE_MODIFY )
2527
@@ -138,13 +140,15 @@ def update_image_via_http(self, qemu):
138140
139141 def update_image (self , qemu ):
140142 # Dump some information about changes in version 20.
141- print ('Changes in 20/Manifest.full:' )
143+ lines = []
144+ lines .append ('Changes in 20/Manifest.full:\n ' )
142145 entry_re = re .compile ('^(?P<type>\S+)\s+(?P<hash>[0-9a-f]+)\s+(?P<version>\d+)\s+(?P<path>.*)$' )
143146 with open (os .path .join (self .REPO_DIR , '20' , 'Manifest.full' )) as f :
144147 for line in f :
145148 m = entry_re .match (line )
146149 if m and m .group ('version' ) == '20' :
147- print (line , end = '' )
150+ lines .append (line )
151+ self .logger .info ('' .join (lines ))
148152 super ().update_image (qemu )
149153
150154class RefkitSwupdUpdateTestAll (RefkitSwupdUpdateBase ):
@@ -171,9 +175,8 @@ def test_update_all(self):
171175 if any (map (lambda x : x in line , hashes )):
172176 file_names .append (line )
173177 self .fail ('should have %d files, got %d:\n %s\n \n Manifest.full:\n %s' % (expected , len (files ), '\n ' .join (files ), ' ' .join (file_names )))
174- # In two cases, a delta made sense.
175178 deltas = [x for x in repo_items if x .startswith ('20/delta/' )]
176- self .assertEqual (len (deltas ), 2 , msg = 'should have 1 delta, got: %s' % deltas )
179+ self .assertEqual (len (deltas ), 1 , msg = 'should have 1 delta for modify_files_large , got: %s' % deltas )
177180
178181class RefkitSwupdUpdateTestIncremental (RefkitSwupdUpdateBase ):
179182
@@ -201,6 +204,7 @@ def modify_image_build(self, testname, updates, is_update):
201204 def setUp (self ):
202205 self .wwwdir = os .path .abspath ('test-swupd-www' )
203206 # self.track_for_cleanup(self.wwwdir)
207+ super ().setUp ()
204208
205209 def test_update_incremental (self ):
206210 """
@@ -256,6 +260,8 @@ def modify_image_build(self, testname, updates, is_update):
256260 bbappend .append ('REFKIT_EXTRA_PARTITION = "part ${REFKIT_IMAGE_SIZE} --fstype=ext4 --label inactive --align 1024 --uuid %s"' % self .PARTUUID )
257261 # Needed for installing from scratch.
258262 bbappend .append ('SWUPD_GENERATE_OS_CORE_ZERO_PACK = "true"' )
263+ # Needed for formatting the partition.
264+ bbappend .append ('REFKIT_IMAGE_EXTRA_INSTALL_append = " e2fsprogs"' )
259265 return '\n ' .join (bbappend )
260266
261267 def normalize_partition_output (self , output , zero_missing = False ):
@@ -287,10 +293,10 @@ def update_partition(self, qemu, cmd, expected, version, **kwargs):
287293 Run a single swupd-update-partition command and check the result, including the HTTP log.
288294 """
289295 self .http_log .clear ()
290- print (cmd )
296+ self . logger . info (cmd )
291297 status , output = qemu .run_serial (cmd , timeout = 600 )
292298 self .assertEqual (1 , status , 'Failed to run command "%s":\n %s' % (cmd , output ))
293- print (output )
299+ self . logger . info (output )
294300 output = self .normalize_partition_output (output , ** kwargs )
295301 # Normalize the HTTP log by replacing /10/files/57de850a026aee38bb06a2a8d6c014a773c2dc3268032b44c0b5b3e7e4ec53f2.tar
296302 # with
0 commit comments