How can we get the coverage of vb?

Discussions related to using the OSE version of VirtualBox.
Post Reply
roylin
Posts: 6
Joined: 21. Oct 2019, 11:31

How can we get the coverage of vb?

Post by roylin »

Hi, all:

I have a question, how can we get the source code coverage of vb?

With the gcc build, we can use gcov to generate coverage report.

But I don't know how to enable "-ftest-coverage -fprofile-arcs" cflags to vb when building.

Can anyone give some advices?
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: How can we get the coverage of vb?

Post by mpack »

Definitely not a "Using VirtualBox" question. Moving the topic to "VirtualBox OSE".
roylin
Posts: 6
Joined: 21. Oct 2019, 11:31

Re: How can we get the coverage of vb?

Post by roylin »

mpack wrote:Definitely not a "Using VirtualBox" question. Moving the topic to "VirtualBox OSE".
ok, thank you for your moving to the ose panel.
socratis
Site Moderator
Posts: 27330
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: How can we get the coverage of vb?

Post by socratis »

roylin wrote:But I don't know how to enable "-ftest-coverage -fprofile-arcs" cflags to vb when building.
VirtualBox uses a custom build system, 'kmk'. I'm not sure how you would fit 'gcov' in there, especially when in their website they state:
gcov works only on code compiled with GCC. It is not compatible with any other profiling or test coverage mechanism.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
roylin
Posts: 6
Joined: 21. Oct 2019, 11:31

Re: How can we get the coverage of vb?

Post by roylin »

@socratis

Thank you for your reply, so does there exist other way can we generate source code coverage of vb? like gcov or llvm-cov.
Last edited by roylin on 22. Oct 2019, 06:35, edited 1 time in total.
socratis
Site Moderator
Posts: 27330
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: How can we get the coverage of vb?

Post by socratis »

I don't have the slightest idea. Your question is not a usually asked question, in fact I had to lookup what does "source code coverage" means...
roylin wrote:so does there exist other way can we generate source code of vb?
What do you mean "generate source code"? I don't get that part. The source code *is* already there, you can browse it or download it (bottom of the page).
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: How can we get the coverage of vb?

Post by mpack »

I assume that "generate source code" means "generate source code coverage". I.e. just a missing word.

However I'm not sure I understand what "source code coverage" means to the OP. I suspect he means a map of all possible execution paths, whereas when I use the term it's understood to be part of a test harness that's supposed to exercise each possible execution path. It can be a significant effort to construct such a test harness.
roylin
Posts: 6
Joined: 21. Oct 2019, 11:31

Re: How can we get the coverage of vb?

Post by roylin »

thank you for clarification, this is what I mean.

Code coverage is frequently used when we do software testing.
Last edited by socratis on 22. Oct 2019, 09:43, edited 1 time in total.
Reason: Removed unnecessary verbatim quote of the whole previous message.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: How can we get the coverage of vb?

Post by mpack »

roylin wrote:thank you for clarification, this is what I mean.
I'm afraid that you're still unclear. I mentioned two possibilities for what you might mean, you do not say which one you were confirming - if any.

If it's a source code tool that simply works out all the possible execution paths - helping you identify redundant code - then try the same C++ source level tool you use now. Unless it relies on make files instead of building its own netlist? Mind you I don't see how that helps anyone not on the dev team, unless you were planning to fork the code and eliminate the dead wood yourself.

If it's a test harness then I don't understand how a meaningful test harness could be generated automatically (if it can: again use whatever tool you already use), plus I don't think the devs would be under any obligation to provide you with whatever test harness they may use, as that would represent significant work effort not covered by the open source principle. Certainly I would not reveal that kind of info to someone who is not a paying customer. The only reason I can think of for someone wanting a test harness for VirtualBox code is that they have a business reliance on this code and need to formally demonstrate adequate testing. Business users should be paying for support.
roylin
Posts: 6
Joined: 21. Oct 2019, 11:31

Re: How can we get the coverage of vb?

Post by roylin »

Feel so sorry for my unclear statements.

What I need is just the feature that I can visualize the code coverage of virtualbox's source code, which I can use gcov in gcc build toolchain or llvm-cov in clang build toolchain.

But virtualbox use kmk to build its source code, and I cannot find any method to achieve this goal.

So I come here to ask for help, if there exists some way can help me to achieve the goal.
roylin
Posts: 6
Joined: 21. Oct 2019, 11:31

Re: How can we get the coverage of vb?

Post by roylin »

mpack wrote: I'm afraid that you're still unclear. ... you do not say which one you were confirming.
I mean the first situation, and I cannot insert the cflags of gcov into vb's build toolchain. For they use different build toolchain.
Last edited by mpack on 22. Oct 2019, 18:05, edited 2 times in total.
Reason: Reduce quote to pertinent phrase.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: How can we get the coverage of vb?

Post by mpack »

I just looked up gcov, it seems to be primarily an execution profiler? gcc only.

Anyway, in fact I have no idea what build tools the devs use. For some reason I believe they do use gcc for most things except device drivers, which will use whatever devtools work best for each target platform.

I don't see any reliance on make system mentioned in the gcov notes that I scanned. It probably only requires debug info in a gcc supported format.
Post Reply