@@ -392,17 +392,19 @@ def test_platform_lookup_path(tmpdir):
392392 env ['PATH' ] = path
393393 exitcode , stdout , stderr , _ = cppcheck_ex (args = ['--debug-lookup=platform' , '--platform=avr8.xml' , test_file ], cppcheck_exe = cppcheck , cwd = str (tmpdir ), env = env )
394394 assert exitcode == 0 , stdout if stdout else stderr
395- lookup1 = os .path .join (tmpdir , 'avr8.xml' )
396- lookup2 = os .path .join (tmpdir , 'platforms' , 'avr8.xml' )
397- lookup3 = os .path .join (path , 'avr8.xml' )
398- lookup4 = os .path .join (path , 'platforms' , 'avr8.xml' )
399- lines = stdout .splitlines ()
395+ def try_fail (f ):
396+ f = f .replace ('\\ ' , '/' ).replace ('"' , '\' ' )
397+ return "try to load platform file '{}' ... Error=XML_ERROR_FILE_NOT_FOUND ErrorID=3 (0x3) Line number=0: filename={}" .format (f , f )
398+ def try_success (f ):
399+ f = f .replace ('\\ ' , '/' ).replace ('"' , '\' ' )
400+ return "try to load platform file '{}' ... Success" .format (f )
401+ lines = stdout .replace ('\\ ' , '/' ).replace ('"' , '\' ' ).splitlines ()
400402 assert lines == [
401403 "looking for platform 'avr8.xml'" ,
402- "try to load platform file '{}' ... Error=XML_ERROR_FILE_NOT_FOUND ErrorID=3 (0x3) Line number=0: filename={}" . format ( lookup1 , lookup1 ),
403- "try to load platform file '{}' ... Error=XML_ERROR_FILE_NOT_FOUND ErrorID=3 (0x3) Line number=0: filename={}" . format ( lookup2 , lookup2 ),
404- "try to load platform file '{}' ... Error=XML_ERROR_FILE_NOT_FOUND ErrorID=3 (0x3) Line number=0: filename={}" . format ( lookup3 , lookup3 ),
405- "try to load platform file '{}' ... Success" . format ( lookup4 ),
404+ try_fail ( os . path . join ( tmpdir , 'avr8.xml' ) ),
405+ try_fail ( os . path . join ( tmpdir , 'platforms' , 'avr8.xml' ) ),
406+ try_fail ( os . path . join ( path , 'avr8.xml' ) ),
407+ try_success ( os . path . join ( path , 'platforms' , 'avr8.xml' ) ),
406408 'Checking {} ...' .format (test_file )
407409 ]
408410
0 commit comments