@@ -1332,31 +1332,47 @@ def postprocess(test, params, env):
13321332 test_name = params .get ("shortname" , getattr (test , "name" , "unknown_test" ))
13331333 if hasattr (test_name , "uid" ):
13341334 test_name = str (test_name .uid )
1335+ # Save to test-results/gcov_libvirt/ to avoid long path issues
1336+ # test.debugdir is typically: .../test-results/{test-dir}/
1337+ # Navigate up to test-results/ and create gcov_qemu/ there
1338+ test_results_dir = os .path .dirname (test .debugdir )
1339+ gcov_qemu_dir = os .path .join (test_results_dir , "gcov_qemu" )
1340+ os .makedirs (gcov_qemu_dir , exist_ok = True )
13351341
13361342 if gcov_format == "lcov" :
13371343 try :
13381344 path .find_command ("lcov" )
13391345 except path .CmdNotFoundError :
13401346 LOG .warning ("lcov package not installed, cannot collect QEMU coverage" )
13411347 else :
1342- gcov_qemu_dir = utils_misc .get_path (test .debugdir , "gcov_qemu" )
1343- collect_lcov_coverage (qemu_builddir , gcov_qemu_dir , test_name , "qemu" )
1348+ lcov_extra_opts = params .get (
1349+ "gcov_qemu_lcov_opts" ,
1350+ "--rc lcov_function_coverage=0 --no-external --ignore-errors gcov" ,
1351+ )
1352+ collect_lcov_coverage (
1353+ qemu_builddir ,
1354+ gcov_qemu_dir ,
1355+ test_name ,
1356+ "qemu" ,
1357+ extra_opts = lcov_extra_opts ,
1358+ )
13441359
13451360 if params .get ("gcov_qemu_compress" , "no" ) == "yes" :
1346- os .chdir (test .debugdir )
1347- archive .compress ("gcov_qemu.tar.gz" , gcov_qemu_dir )
1361+ os .chdir (test_results_dir )
1362+ archive .compress ("lcov_qemu.tar.gz" , gcov_qemu_dir )
1363+ shutil .copy2 ("lcov_qemu.tar.gz" , test .debugdir )
13481364 shutil .rmtree (gcov_qemu_dir , ignore_errors = True )
13491365 else :
13501366 if utils_package .package_install ("gcovr" ):
1351- gcov_qemu_dir = utils_misc .get_path (test .debugdir , "gcov_qemu" )
13521367 collect_cmd_opts = params .get ("gcov_qemu_collect_cmd_opts" , "--html" )
13531368 collect_gcovr_coverage (
13541369 qemu_builddir , gcov_qemu_dir , "qemu" , collect_cmd_opts
13551370 )
13561371
13571372 if params .get ("gcov_qemu_compress" , "no" ) == "yes" :
1358- os .chdir (test . debugdir )
1373+ os .chdir (test_results_dir )
13591374 archive .compress ("gcov_qemu.tar.gz" , gcov_qemu_dir )
1375+ shutil .copy2 ("gcov_qemu.tar.gz" , test .debugdir )
13601376 shutil .rmtree (gcov_qemu_dir , ignore_errors = True )
13611377 else :
13621378 LOG .warning ("gcovr package not installed, cannot collect QEMU coverage" )
@@ -1369,6 +1385,13 @@ def postprocess(test, params, env):
13691385 if hasattr (test_name , "uid" ):
13701386 test_name = str (test_name .uid )
13711387
1388+ # Save to test-results/gcov_libvirt/ to avoid long path issues
1389+ # test.debugdir is typically: .../test-results/{test-dir}/
1390+ # Navigate up to test-results/ and create gcov_libvirt/ there
1391+ test_results_dir = os .path .dirname (test .debugdir )
1392+ gcov_libvirt_dir = os .path .join (test_results_dir , "gcov_libvirt" )
1393+ os .makedirs (gcov_libvirt_dir , exist_ok = True )
1394+
13721395 if gcov_format == "lcov" :
13731396 try :
13741397 path .find_command ("lcov" )
@@ -1377,26 +1400,34 @@ def postprocess(test, params, env):
13771400 "lcov package not installed, cannot collect libvirt coverage"
13781401 )
13791402 else :
1380- gcov_libvirt_dir = utils_misc .get_path (test .debugdir , "gcov_libvirt" )
1403+ lcov_extra_opts = params .get (
1404+ "gcov_libvirt_lcov_opts" ,
1405+ "--rc lcov_function_coverage=0 --no-external --ignore-errors gcov" ,
1406+ )
13811407 collect_lcov_coverage (
1382- libvirt_builddir , gcov_libvirt_dir , test_name , "libvirt"
1408+ libvirt_builddir ,
1409+ gcov_libvirt_dir ,
1410+ test_name ,
1411+ "libvirt" ,
1412+ extra_opts = lcov_extra_opts ,
13831413 )
13841414
13851415 if params .get ("gcov_libvirt_compress" , "no" ) == "yes" :
1386- os .chdir (test .debugdir )
1387- archive .compress ("gcov_libvirt.tar.gz" , gcov_libvirt_dir )
1416+ os .chdir (test_results_dir )
1417+ archive .compress ("lcov_libvirt.tar.gz" , gcov_libvirt_dir )
1418+ shutil .copy2 ("lcov_libvirt.tar.gz" , test .debugdir )
13881419 shutil .rmtree (gcov_libvirt_dir , ignore_errors = True )
13891420 else :
13901421 if utils_package .package_install ("gcovr" ):
1391- gcov_libvirt_dir = utils_misc .get_path (test .debugdir , "gcov_libvirt" )
13921422 collect_cmd_opts = params .get ("gcov_libvirt_collect_cmd_opts" , "--html" )
13931423 collect_gcovr_coverage (
13941424 libvirt_builddir , gcov_libvirt_dir , "libvirt" , collect_cmd_opts
13951425 )
13961426
13971427 if params .get ("gcov_libvirt_compress" , "no" ) == "yes" :
1398- os .chdir (test . debugdir )
1428+ os .chdir (test_results_dir )
13991429 archive .compress ("gcov_libvirt.tar.gz" , gcov_libvirt_dir )
1430+ shutil .copy2 ("gcov_libvirt.gz" , test .debugdir )
14001431 shutil .rmtree (gcov_libvirt_dir , ignore_errors = True )
14011432 else :
14021433 LOG .warning (
0 commit comments