Edgewall Software
Modify

Opened 14 years ago

Last modified 10 years ago

#609 new defect

ctools: gcov returns absolute file paths -> parsing fails

Reported by: p_thomas@… Owned by:
Priority: major Milestone: 0.6.1
Component: Recipe commands Version: 0.6b2
Keywords: gcov Cc:
Operating System: Linux

Description

For loop from c:gcov build command:

cmd = CommandLine('gcov', ['-b', '-n', '-o', objfile, srcfile],
	                          cwd=ctxt.basedir)
for out, err in cmd.execute():
    if out == '': # catch blank lines, reset the block state...
        skip_block = False
    elif out and not skip_block:
        # Check for a file name
        match = file_re.match(out)
        if match:
            if os.path.isabs(match.group('file')):
                skip_block = True
                continue
        else:
            # check for a "Lines executed" message
            match = lines_re.match(out)
            if match:
                lines = float(match.group('num'))
                cov = float(match.group('cov'))
                num_covered += int(lines * cov / 100)
                num_lines += int(lines)

gcov gives stats for project and system files - system files should be ignored:

But for me the line

if os.path.isabs(match.group('file')):

makes the parsing incorrect as gcov returns every file as absolute path. A quick (but probably not elegant) fix for me was

if os.path.commonprefix([match.group('file'), ctxt.basedir]) != ctxt.basedir:

Attachments (0)

Change History (2)

comment:1 Changed 14 years ago by osimons

  • Milestone changed from 0.6 to 0.6.1

comment:2 Changed 13 years ago by anonymous

I can confirm the problem and the solution.

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.