Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coverage.bin Problem and Fix #26

Open
GoogleCodeExporter opened this issue Apr 13, 2016 · 3 comments
Open

coverage.bin Problem and Fix #26

GoogleCodeExporter opened this issue Apr 13, 2016 · 3 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Run a Cloud9 test on prod-cons (the quickstart tutorial).
2. Use the attached coverage-tool to read the coverage.bin present in 
test-prod-cons.
   $ coverage-tool test-prod-cons/coverage.bin

There should be values for all six fields. However, covered source lines, 
covered assembly lines, and both coverage percentages are all 0. After some 
investigating, I discovered that Cloud9 writes the coverage.bin file *before* 
the actual Cloud9 testing begins. Because of this, I edited the StatsTracker 
class (StatsTracker.h and StatsTracker.cpp). My StatsTracker class is different 
in the following ways:

1. writeDetailedCoverageSnapshot has a second boolean parameter: 
actually_write. If actually_write is true, coverageInfo is updated and  
coverage.bin is created. If actually_write is false, coverageInfo is still 
updated but coverage.bin is not created.

2. In the destructor, writeDetailedCoverageSnapShot is called.

So essentially, this is how my edited code works:
1. On object creation (constructor), coverageInfo is updated but coverage.bin 
is *not* written.
2. On object deallocation (destructor), coverageInfo is updated and 
coverage.bin is written.

I am using the latest version of Cloud9 on Ubuntu 12.04 LTS.


coverage-tool is my own creation. Feel free to add it to the Cloud9 tools and 
modify it all you like. It's yours now. 

I've also attached my modified StatsTracker.cpp and StatsTracker.h.

Thanks,
Will O'Leary


Original issue reported on code.google.com by willis.c...@gmail.com on 29 Jul 2013 at 10:46

Attachments:

@GoogleCodeExporter
Copy link
Author

Forgot to attach these files! Here you are...

Original comment by willis.c...@gmail.com on 29 Jul 2013 at 10:47

Attachments:

@GoogleCodeExporter
Copy link
Author

Will, I'm sorry you had to spend more time than necessary trying out things 
here -- the Cloud9 documentation in this space is deficient.

The coverage.bin file actually contains multiple protobuf messages, each 
message contained in a "message frame". A message frame starts with a 32-bit 
integer describing the message size, followed by the message bytes themselves.

The first protobuf message lists all coverable lines in the program, so it 
constitutes the 100% coverage. It is written once before the actual symbolic 
exporation starts.

The following protobuf messages in the file are coverage snapshots at different 
moments in time. If I remember correctly, by default they are written to the 
coverage log every minute. Each message contains the lines covered by symbolic 
execution up to that moment in time.

Original comment by stefan.b...@gmail.com on 30 Jul 2013 at 6:08

@GoogleCodeExporter
Copy link
Author

One more thing: Would it be possible to provide the Cloud9 changes as a patch 
file, so I can easily see what's changed?

Original comment by stefan.b...@gmail.com on 30 Jul 2013 at 6:12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant