Edgewall Software
Modify

Opened 15 years ago

Closed 10 years ago

Last modified 10 years ago

#463 closed enhancement (fixed)

Annotate when using ctool

Reported by: ulrich.vdh@… Owned by: osimons
Priority: major Milestone: 0.7
Component: Recipe commands Version: 0.6b2
Keywords: Cc: srl@…
Operating System: Linux

Description

gcov generate annoted c file.

Is it possible to use it to retreive annotation in the c:coverage and not only the percent of coverage ?

Thanks

Attachments (3)

ctools_gcov.diff (2.2 KB) - added by ulrich.vdh@… 15 years ago.
Patch to make it work
ctools.py.diff (2.7 KB) - added by Martin Schulze <spam.martin.schulze@…> 10 years ago.
Now with ===== detection and skipping (with warning!) lines of unknown format
ctools.py_and_tests.diff (7.6 KB) - added by Martin Schulze <spam.martin.schulze@…> 10 years ago.
Improved code and tests

Download all attachments as: .zip

Change History (13)

Changed 15 years ago by ulrich.vdh@…

Patch to make it work

comment:1 Changed 15 years ago by anonymous

I have made a patch to add visualisation of result of the gcov tool in brownser annotate.

Thanks

comment:2 Changed 14 years ago by hefloryd

We have been using this patch for a while and it seems to work fine. Please apply it if possible.

comment:3 Changed 11 years ago by Steven R. Loomis <srl@…>

  • Cc srl@… added

Changed 10 years ago by Martin Schulze <spam.martin.schulze@…>

Now with ===== detection and skipping (with warning!) lines of unknown format

comment:4 Changed 10 years ago by Martin Schulze <spam.martin.schulze@…>

I was pleased to see this patch but it did not work for me. The problem was that my gcov output had another line annotation: ===== for unexecuted lines that are in exceptional code paths.

Unfortunately the code did not cope well with this and errored out with an exception (pattern.search( line ) did not find anything so .groups was called on a None Type?).

Long story short: I revised the code a little bit to make it more robust and handle the aforementioned format as well.

There are still many improvements to make. Basically any exception in the code will throw it off track and give no meaningful error message to the server side which makes it hard to "debug".

comment:5 follow-up: Changed 10 years ago by osimons

Thanks!

What I'd really like is for the patch to include unit tests. Extend bitten.tests.ctools.GCovTestCase to test all supported formats and features. It makes the code a lot easier to support and maintain.

comment:6 in reply to: ↑ 5 Changed 10 years ago by osimons

Replying to osimons:

Extend bitten.tests.ctools.GCovTestCase to test...

That should be bitten.build.tests.ctools.GCovTestCase of course.

comment:7 Changed 10 years ago by Martin Schulze <spam.martin.schulze@…>

Okay, I have some slight improvements on the new code and two test that fail on the old patch and work on the new one:

  • detection of unreached exceptional code (test_unreached_exceptional_path_is_zero)
  • marking of lines that don't match the expected pattern (test_mark_unknown_lines)

I am tempted to test whether there are warnings on such lines but I don't know the framework good enough to test for this.

I have never before written any tests for bitten (or trac or python for that matter) so I would like some feedback on things I should improve upon (aka a code review).

I mostly copied together my code from the preexisting test and extended one of their helper functions (_create_file) for creating a dummy file with the possibility to give the file's contents. I hope I did not break anything there but these tests still pass.

Changed 10 years ago by Martin Schulze <spam.martin.schulze@…>

Improved code and tests

comment:8 Changed 10 years ago by osimons

  • Resolution set to fixed
  • Status changed from new to closed

Superb. Thanks! I've committed the patch in [1027].

comment:9 Changed 10 years ago by osimons

  • Milestone changed from 0.6.1 to 0.7

comment:10 Changed 10 years ago by osimons

  • Owner set to osimons

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain osimons.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.