@@ -202,21 +202,19 @@ def create_file_primary_proofobligations(
202202 """Call analyzer to create primary proof obligations for a single file."""
203203
204204 chklogger .logger .info (
205- "Create primiary proof obligations for %s" , cfilename )
205+ "Create primiary proof obligations for file %s with path %s" ,
206+ cfilename , ("none" if cfilepath is None else cfilepath ))
206207 try :
207208 cmd = self ._create_file_primary_proofobligations_cmd_partial ()
208209 cmd .append (cfilename )
209210 if cfilepath is not None :
210211 cmd .extend (["-cfilepath" , cfilepath ])
211- chklogger .logger .info (
212- "Primary proof obligations are created for %s" , cfilename )
213212 chklogger .logger .info (
214213 "Ocaml analyzer is called with %s" , str (cmd ))
215214 if self .verbose :
216215 result = subprocess .call (
217216 cmd , cwd = self .targetpath , stderr = subprocess .STDOUT )
218217 print ("\n Result: " + str (result ))
219- # self.capp.get_file(cfilename).predicatedictionary.initialize()
220218 else :
221219 result = subprocess .call (
222220 cmd ,
@@ -227,7 +225,10 @@ def create_file_primary_proofobligations(
227225 if result != 0 :
228226 print ("Error in creating primary proof obligations" )
229227 exit (1 )
230- cfile = self .capp .get_file (cfilename )
228+ pcfilename = (
229+ cfilename if cfilepath is None
230+ else os .path .join (cfilepath , cfilename ))
231+ cfile = self .capp .get_file (pcfilename )
231232 cfile .reinitialize_tables ()
232233 cfile .reload_ppos ()
233234 cfile .reload_spos ()
@@ -237,24 +238,28 @@ def create_file_primary_proofobligations(
237238 exit (1 )
238239
239240 def create_app_primary_proofobligations (self , processes : int = 1 ) -> None :
240- """Call analyzer to create primary proof obligations for all application files."""
241+ """Call analyzer to create ppo's for all application files."""
241242
242243 if processes > 1 :
243244
244245 def f (cfile : "CFile" ) -> None :
245246 cmd = self ._create_file_primary_proofobligations_cmd_partial ()
246- cmd .append (cfile .name )
247+ if cfile .cfilepath is not None :
248+ cmd .extend (["-filepath" , cfile .cfilepath ])
249+ cmd .append (cfile .cfilename )
247250 self ._execute_cmd (cmd )
248251
249252 self .capp .iter_files_parallel (f , processes )
250253 else :
251254
252255 def f (cfile : "CFile" ) -> None :
253- self .create_file_primary_proofobligations (cfile .name )
256+ self .create_file_primary_proofobligations (
257+ cfile .cfilename , cfile .cfilepath )
254258
255259 self .capp .iter_files (f )
256260
257- def _generate_and_check_file_cmd_partial (self , domains : str ) -> List [str ]:
261+ def _generate_and_check_file_cmd_partial (
262+ self , cfilepath : Optional [str ], domains : str ) -> List [str ]:
258263 cmd : List [str ] = [
259264 self .canalyzer ,
260265 "-summaries" ,
@@ -279,14 +284,20 @@ def _generate_and_check_file_cmd_partial(self, domains: str) -> List[str]:
279284 if self .verbose :
280285 cmd .append ("-verbose" )
281286 cmd .append (self .targetpath )
287+ if cfilepath is not None :
288+ cmd .extend (["-cfilepath" , cfilepath ])
282289 cmd .append ("-cfilename" )
283290 return cmd
284291
285- def generate_and_check_file (self , cfilename : str , domains : str ) -> None :
292+ def generate_and_check_file (
293+ self ,
294+ cfilename : str ,
295+ cfilepath : Optional [str ],
296+ domains : str ) -> None :
286297 """Generate invariants and check proof obligations for a single file."""
287298
288299 try :
289- cmd = self ._generate_and_check_file_cmd_partial (domains )
300+ cmd = self ._generate_and_check_file_cmd_partial (cfilepath , domains )
290301 cmd .append (cfilename )
291302 chklogger .logger .info (
292303 "Calling AI to generate invariants: %s" ,
@@ -303,7 +314,8 @@ def generate_and_check_file(self, cfilename: str, domains: str) -> None:
303314 stderr = subprocess .STDOUT ,
304315 )
305316 if result != 0 :
306- print ("Error in generating invariants or checking proof obligations" )
317+ chklogger .logger .error (
318+ "Error in generating invariants for %s" , cfilename )
307319 exit (1 )
308320 except subprocess .CalledProcessError as args :
309321 print (args .output )
@@ -316,15 +328,17 @@ def generate_and_check_app(self, domains: str, processes: int = 1) -> None:
316328 if processes > 1 :
317329
318330 def f (cfile : "CFile" ) -> None :
319- cmd = self ._generate_and_check_file_cmd_partial (domains )
320- cmd .append (cfile .name )
331+ cmd = self ._generate_and_check_file_cmd_partial (
332+ cfile .cfilepath , domains )
333+ cmd .append (cfile .cfilename )
321334 self ._execute_cmd (cmd )
322335
323336 self .capp .iter_files_parallel (f , processes )
324337 else :
325338
326339 def f (cfile : "CFile" ) -> None :
327- self .generate_and_check_file (cfile .name , domains )
340+ self .generate_and_check_file (
341+ cfile .cfilename , cfile .cfilepath , domains )
328342
329343 self .capp .iter_files (f )
330344 self .capp .iter_files (self .reset_tables )
0 commit comments