Changeset 2756


Ignore:
Timestamp:
04/05/12 11:32:20 (2 years ago)
Author:
jdsiiro
Message:

Cleanup in how we parse/split gcov result lines. This resolves path
issues on Windows (see #3913, item 1).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gcovr/trunk/scripts/gcovr

    r2755 r2756  
    2525# For more information, see the FAST README.txt file. 
    2626# 
    27 # $Revision 2755 $ 
    28 # $Date 2012-04-05 11:06:44 -0700 (Thu, 05 Apr 2012) $ 
     27# $Revision 2756 $ 
     28# $Date 2012-04-05 11:32:20 -0700 (Thu, 05 Apr 2012) $ 
    2929# _________________________________________________________________________ 
    3030# 
     
    4444 
    4545__version__ = "2.4-prerelease" 
    46 src_revision = "$Revision 2755 $" 
     46src_revision = "$Revision 2756 $" 
    4747gcov_cmd = "gcov" 
    4848 
     
    216216    # 
    217217    line = INPUT.readline() 
    218     segments=line.split(":") 
     218    segments=line.split(':',3) 
     219    if len(segments) != 4 or not segments[2].lower().strip().endswith('source'): 
     220        raise RuntimeError('Fatal error parsing gcov file, line 1: \n\t"%s"' % line.rstrip()) 
    219221    fname = os.path.abspath((segments[-1]).strip()) 
    220222    if options.verbose: 
     
    248250    lineno = 0 
    249251    for line in INPUT: 
    250         segments=line.split(":") 
     252        segments=line.split(":",2) 
    251253        tmp = segments[0].strip() 
    252         try: 
    253             lineno = int(segments[1].strip()) 
    254         except: 
    255             pass # keep previous line number! 
     254        if len(segments) > 1: 
     255            try: 
     256                lineno = int(segments[1].strip()) 
     257            except: 
     258                pass # keep previous line number! 
    256259             
    257260        if tmp[0] == '#': 
Note: See TracChangeset for help on using the changeset viewer.