@@ -381,6 +381,27 @@ def test_platform_lookup_ext(tmpdir):
381381 ]
382382
383383
384+ def test_platform_lookup_path (tmpdir ):
385+ test_file = os .path .join (tmpdir , 'test.c' )
386+ with open (test_file , 'wt' ):
387+ pass
388+
389+ c = 'cppcheck.exe' if sys .platform == 'win32' else 'cppcheck'
390+ path = os .path .dirname (__lookup_cppcheck_exe ())
391+ env = os .environ .copy ()
392+ env ['PATH' ] = path
393+ exitcode , stdout , stderr , exe = cppcheck_ex (args = ['--debug-lookup=platform' , '--platform=avr8.xml' , test_file ], cppcheck_exe = c , cwd = str (tmpdir ), env = env )
394+ assert exitcode == 0 , stdout if stdout else stderr
395+ lines = stdout .splitlines ()
396+ assert lines == [
397+ "looking for platform 'avr8.xml'" ,
398+ "try to load platform file '{}/avr8.xml' ... Error=XML_ERROR_FILE_NOT_FOUND ErrorID=3 (0x3) Line number=0: filename={}/avr8.xml" .format (tmpdir , tmpdir ),
399+ "try to load platform file '{}/platforms/avr8.xml' ... Error=XML_ERROR_FILE_NOT_FOUND ErrorID=3 (0x3) Line number=0: filename={}/platforms/avr8.xml" .format (tmpdir , tmpdir ),
400+ "try to load platform file '{}/avr8.xml' ... Error=XML_ERROR_FILE_NOT_FOUND ErrorID=3 (0x3) Line number=0: filename={}/avr8.xml" .format (path , path ),
401+ "try to load platform file '{}/platforms/avr8.xml' ... Success" .format (path ),
402+ 'Checking {} ...' .format (test_file )
403+ ]
404+
384405def test_platform_lookup_notfound (tmpdir ):
385406 test_file = os .path .join (tmpdir , 'test.c' )
386407 with open (test_file , 'wt' ):
0 commit comments