Quantcast
Channel: opencppcoverage Discussions Rss Feed
Viewing all 235 articles
Browse latest View live

New Post: Multithreaded Test Application

$
0
0
Hello,

There is no know issue about multithreaded application and OpenCppCoverage is a single threaded application.
I did some test on a small multithreaded code but do not find any issue.

As OpenCppCoverage put breakpoints on each line, it can change the order of thread executation and may be can explain your issue.
Are you able to reproduce the problem on a smaller example?
If yes I will be happy to investigate.

Hope that help,

OpenCppCoverage

New Post: Multithreaded Test Application

$
0
0
Thanks, I will look into it in more detail and report back.

Cheers
Nigel

New Post: Multithreaded Test Application

$
0
0
It looks like this was a false alarm, sorry about that. Once I had finalized the command line arguments I was using for our other programs that weren't crashing, it is now working with those same arguments on the multi-threaded program. Although it is a debug build it also incorporates some optimized (release build) third-party code which is now excluded from the source files, possibly that was the problem.

Cheers
Nigel

New Post: Empty Report/Coverage of DLL file?

$
0
0
Hi. I am trying to get code coverage of a dll file with has a pdb associated with it.

But it looks like the utility only accepts .exe files.

Is there anyway around this?


I believe my reports are coming up empty because of this issue.
(I end up selecting an exe in hopes that it captures the dll, but because I have no pdb for that exe, I'm guessing the report comes up empty.

New Post: Multithreaded Test Application

$
0
0
Hi,

Happy to hear your problem is solved,

OpenCppCoverage

New Post: Empty Report/Coverage of DLL file?

$
0
0
Hello,

I created a console application that calls a class located in another dll. I removed the pdb associated to the executable. I was able to see the coverage of the dll, but of course, not the one of the executable.

Can you try to run OpenCppCoverage without filters (do not use --sources or --modules)?
Does your application run a child process. If yes, please use --cover_children flag.
Is there anything special in your application or dll?

If none of the previous suggestion help, can you send the log created with --verbose flag.

Let me know if you solve your problem,

OpenCppCoverage

New Post: Empty Report/Coverage of DLL file?

$
0
0
Hmm, I think I may have resolved this, though I'm not sure.

Is it required to have Visual Studio installed on the machine in order to generate the report?

Because I have the source files and I am basically trying to run it, and perhaps because pdb files are 'Visual Studio' based, it's not generating the report because VS is missing?

New Post: Empty Report/Coverage of DLL file?

$
0
0
Hello,

Visual Studio should not be need to generate the report.
Can you provide the log file, perhaps I can find something?

OpenCppCoverage

New Post: Cannot find path for the handle.The handle is invalid.

$
0
0
I'm using a CI workflow with Jenkins.

A bat file is generated at the end of every compilation, which looks like this:
OpenCppCoverage -q --continue_after_cpp_exception  --sources D:\Jenkins\workspace\bfsearch --modules D:\Jenkins\workspace\bfsearch  --excluded_sources D:\Jenkins\workspace\bfsearch\tests  --excluded_sources D:\Jenkins\workspace\bfsearch\bin  --export_type=binary:coverage_results_bfs_add_test_TESTTARGET.exe.cov -- D:\Jenkins\workspace\bfsearch\bin\tests\Debug\bfs_add_test_TESTTARGET.exe
OpenCppCoverage -q --continue_after_cpp_exception  --sources D:\Jenkins\workspace\bfsearch --modules D:\Jenkins\workspace\bfsearch  --excluded_sources D:\Jenkins\workspace\bfsearch\tests  --excluded_sources D:\Jenkins\workspace\bfsearch\bin  --export_type=binary:coverage_results_bfs_cluster_around_center_tests_TESTTARGET.exe.cov -- D:\Jenkins\workspace\bfsearch\bin\tests\Debug\bfs_cluster_around_center_tests_TESTTARGET.exe
OpenCppCoverage -q --continue_after_cpp_exception  --sources D:\Jenkins\workspace\bfsearch --modules D:\Jenkins\workspace\bfsearch  --excluded_sources D:\Jenkins\workspace\bfsearch\tests  --excluded_sources D:\Jenkins\workspace\bfsearch\bin  --export_type=binary:coverage_results_bfs_multiple_cluster_centers_test_TESTTARGET.exe.cov -- D:\Jenkins\workspace\bfsearch\bin\tests\Debug\bfs_multiple_cluster_centers_test_TESTTARGET.exe
OpenCppCoverage -q --continue_after_cpp_exception  --sources D:\Jenkins\workspace\bfsearch --modules D:\Jenkins\workspace\bfsearch  --excluded_sources D:\Jenkins\workspace\bfsearch\tests  --excluded_sources D:\Jenkins\workspace\bfsearch\bin --input_coverage=coverage_results_bfs_add_test_TESTTARGET.exe.cov --input_coverage=coverage_results_bfs_cluster_around_center_tests_TESTTARGET.exe.cov --input_coverage=coverage_results_bfs_multiple_cluster_centers_test_TESTTARGET.exe.cov  --export_type=cobertura:coverage_results.xml -- D:\Jenkins\workspace\bfsearch\bin\tests\Debug\bfs_radius_test_TESTTARGET.exe
My test runs always fail due to an unambiguous bug in opencppcoverage:
Error: HandleInformation.cpp:85 Cannot find path for the handle.The handle is invalid.

D:\Jenkins\workspace\bfsearch>./runtests.bat

D:\Jenkins\workspace\bfsearch>OpenCppCoverage -q --continue_after_cpp_exception  --sources D:\Jenkins\workspace\bfsearch --modules D:\Jenkins\workspace\bfsearch  --excluded_sources D:\Jenkins\workspace\bfsearch\\tests  --excluded_sources D:\Jenkins\workspace\bfsearch\\bin  --export_type=binary:coverage_results_bfs_add_test_TESTTARGET.exe.cov -- D:\Jenkins\workspace\bfsearch\bin\tests\Debug\bfs_add_test_TESTTARGET.exe 
Error: HandleInformation.cpp:85 Cannot find path for the handle.The handle is invalid.



D:\Jenkins\workspace\bfsearch>OpenCppCoverage -q --continue_after_cpp_exception  --sources D:\Jenkins\workspace\bfsearch --modules D:\Jenkins\workspace\bfsearch  --excluded_sources D:\Jenkins\workspace\bfsearch\\tests  --excluded_sources D:\Jenkins\workspace\bfsearch\\bin  --export_type=binary:coverage_results_bfs_cluster_around_center_tests_TESTTARGET.exe.cov -- D:\Jenkins\workspace\bfsearch\bin\tests\Debug\bfs_cluster_around_center_tests_TESTTARGET.exe 
Error: HandleInformation.cpp:85 Cannot find path for the handle.The handle is invalid.



D:\Jenkins\workspace\bfsearch>OpenCppCoverage -q --continue_after_cpp_exception  --sources D:\Jenkins\workspace\bfsearch --modules D:\Jenkins\workspace\bfsearch  --excluded_sources D:\Jenkins\workspace\bfsearch\\tests  --excluded_sources D:\Jenkins\workspace\bfsearch\\bin  --export_type=binary:coverage_results_bfs_multiple_cluster_centers_test_TESTTARGET.exe.cov -- D:\Jenkins\workspace\bfsearch\bin\tests\Debug\bfs_multiple_cluster_centers_test_TESTTARGET.exe 
Error: HandleInformation.cpp:85 Cannot find path for the handle.The handle is invalid.



D:\Jenkins\workspace\bfsearch>OpenCppCoverage -q --continue_after_cpp_exception  --sources D:\Jenkins\workspace\bfsearch --modules D:\Jenkins\workspace\bfsearch  --excluded_sources D:\Jenkins\workspace\bfsearch\\tests  --excluded_sources D:\Jenkins\workspace\bfsearch\\bin --input_coverage=coverage_results_bfs_add_test_TESTTARGET.exe.cov --input_coverage=coverage_results_bfs_cluster_around_center_tests_TESTTARGET.exe.cov --input_coverage=coverage_results_bfs_multiple_cluster_centers_test_TESTTARGET.exe.cov  --export_type=cobertura:coverage_results.xml -- D:\Jenkins\workspace\bfsearch\bin\tests\Debug\bfs_radius_test_TESTTARGET.exe 
Argument of input_coverage <coverage_results_bfs_add_test_TESTTARGET.exe.cov> does not exist.
OpenCppCoverage Version: 0.9.5.2

Usage: [options] -- program_to_run optional_arguments:

Command line only:
  -v [ --verbose ]                 Verbose mode.
  -q [ --quiet ]                   Quiet mode.
  -h [ --help ]                    Show help message.
  --config_file arg                Filename of a configuration file.

Command line and configuration file:
  --modules arg (=*)               The pattern that module's paths should 
                                   match. Can have multiple occurrences.
  --excluded_modules arg           The pattern that module's paths should NOT 
                                   match. Can have multiple occurrences.
  --sources arg (=*)               The pattern that source's paths should 
                                   match. Can have multiple occurrences.
  --excluded_sources arg           The pattern that source's paths should NOT 
                                   match. Can have multiple occurrences.
  --input_coverage arg             A output path of export_type=binary. This 
                                   coverage data will be merged with the 
                                   current one. Can have multiple occurrences.
  --export_type arg (=html)        Format: <exportType>:<outputPath>.
                                   <exportType> can be: binary, cobertura, html
                                   <outputPath> (optional) output file or 
                                   directory for the export.
                                   Example: html:MyFolder\MySubFolder
                                   This flag can have multiple occurrences.
  --working_dir arg                The program working directory.
  --cover_children                 Enable code coverage for children processes.
  --no_aggregate_by_file           Do not aggregate coverage for same file 
                                   path.
  --unified_diff arg               Format: <unifiedDiffPath>?<rootFolder>
                                   <unifiedDiffPath> path of the unified diff 
                                   file. Git users can use git diff output.
                                   <rootFolder> (optional) root folder for 
                                   paths in the diff file.
                                   See documentation for limitations.
  --continue_after_cpp_exception   Try to continue after throwing a C++ 
                                   exception.

Build step 'Execute Windows batch command' marked build as failure
Skipping Cobertura coverage report as build was not UNSTABLE or better ...
Can you help me with this? The same script was working a month ago, now it doesn't. Is there something related to windows updates ? I've also looked at the source code, there's no such code at HandleInformation.cpp:85 that can cause an error like that. Is source code updated in the repository?

Best,
Onat

New Post: Cannot find path for the handle.The handle is invalid.

$
0
0
Hello,

If you want to see the latest code you need to select release 0.9 branch (and not master).
When an executable load a dll, the method GetFinalPathNameByHandle is called with the dll handle to get the full path. For unkkown reason, this method return an errorin your case.

Can you try to create a small project and check if you have the problem? If yes we need to look at your operating / environment changes.
Do you have an antivirus software? If yes can you try to temporary disable?
Does resintalling OpenCppCoverage help?

Let me know if you find something,

OpenCppCoverage

New Post: Cannot find path for the handle.The handle is invalid.

$
0
0
Hello.

I've installed the latest version, the problem persists.

Here's a quick project I've created to test the issue.

https://github.com/onatbas/OpenCppCoverageTestFail

I've included the verbose output for you.

I'm running Windws 7 x64.
I don't have any antivirus software.

Best,
Onat

New Post: Cannot find path for the handle.The handle is invalid.

$
0
0
Hello,

I would like to thanks for your link, this is a big help for understanding your problem!
I tried exactly the steps you described but I was available to create the coverage with any issue on Windows 10.

I have just noticed your issue looks like this one.
Are your sources located in a ClearCase view or a network drive?

If not, I will try to test OpenCppCoverageTestFail on Windows 7.

I hope this will help,

OpenCppCoverage

New Post: Does OpenCppCoverage work with managed C++ code?

$
0
0
Does this work with managed C++? Is it able to either report on managed C++ coverage or ignore it?

I have tried it on a few native applications and it works great. However, I also have a native Windows app “TestRunner” that runs a series of C++ unit tests. Some of the tests call into managed C++ code.

The TestRunner app runs fine when executed without OpenCppCoverage.

First attempt at using OpenCppCoverage

But when I run under OpenCppCoverage and hit the test that will call into managed code, an exception is thrown that is caught by the TestRunner app itself. If I run the tests a second time without quitting the Windows TestRunner app, same thing happens.

OpenCppCoverage finishes and generates a valid coverage report. The report displays the executable lines in the managed C++ source files correctly, but they are all red, indicating that they were apparently not executed. The LastCoverageResults.log file doesn’t show any problems.

The "--continue_after_cpp_exception" flag has no apparent effect on this behavior.

Another attempt

If I put in “--excluded_modules” for the managed DLL, when I hit the test that will call into managed code, the target application exits, and apparently OpenCppCoverage.exe quits as well, since it doesn’t generate any coverage report. The last line output by OpenCppCoverage is:

Error: FileDebugInformation.cpp:78 Error when calling SymFromAddr

In Visual Studio debugger

If I run the application under the Visual Studio debugger (not using OpenCppCoverage at all), with all Exception catching turned on, the debugger stops at a number of exceptions, and I need to press "Continue". But still the code succeeds; none of the exceptions are uncaught, presumably because they were caught and handled within .NET, and are expected errors. (The initial error is a Microsoft C++ exception EEFileLoadException, followed by a few other Microsoft C++ exceptions and .NET exceptions.) If I run the tests a second time without quitting the Windows TestRunner app, there are no exceptions caught at all.

Analysis

So it seems like OpenCppCoverage is attached to the code like a debugger, but rather than ignoring .NET exceptions and letting .NET itself handle them, it is allowing them to propagate as uncaught exceptions out of the managed code back to the native code.

Question: is this kind of scenario supposed to work?

Thanks!

New Post: Does OpenCppCoverage work with managed C++ code?

$
0
0
Hello,

Unfortunately, managed code is not supported. It seems only the pdb format is supported.

I have just run vstest.console.exe (unmanaged application to run MSTest) on a managed tests.
  • If I exclude the managed dll, the test run fine but of course there is no coverage.
  • If I do not excluded the managed dll, I get an InvalidProgramException, which is normal because OpenCppCoverage modifies MSIL code as if it is x86 assembly.
"but rather than ignoring .NET exceptions and letting .NET itself handle them, it is allowing them to propagate as uncaught exceptions out of the managed code back to the native code."

I suspect exceptions are not ignored but caught inside the code. Your debugger probably breaks before the exception is thrown. OpenCppCoverage does not change whether an exception is caught or not. In my test, another kind of exception was thrown (InvalidProgramException) that made the program stop.

I hope this will help,

OpenCppCoverage

New Post: C Comment HTML coloring

$
0
0
Fantastic tool, wow!

Is it possible to change to the color of C comments in the output HTML files? C comments are rendered in red, which is close enough to highlighted red sections (code which has not been covered) to where it's, well, a little disconcerting.

Can the color of C comments be changed to something more neutral?

Thanks,
Ken

New Post: C Comment HTML coloring

$
0
0
Hello,

I am happy you find OpenCppCoverage useful.

The HTML report is generated using a HTML template located in "Template" folder in your installation folder.

The syntax highlightning is performed by the library code-pretiffy.
The getting_started page explains how to configure it.

In your case, you probably want to update the theme defined in prettify-CppCoverage.css located in Template\third-party\google-code-prettify.
This page shows some examples of theme.
prettify-CppCoverage.css is a minified version of the default theme so you just need to edit this file.

I hope this will help,

OpenCppCoverage

New Post: C Comment HTML coloring

$
0
0
Thanks for the quick response! That is most helpful.

Ken

New Post: Possible support for C++ class coverage?

$
0
0
Hi,

With more and more use of your open source software, I feel very excited that I can configure it to do many interesting things, like: Show which line is covered by which test cases run by our application. Thank you very much for open source the great software!

There is one more thing that I would like to ask for your idea:
Is it possible to get C++ class coverage for my application? For example, I need to gather data about which C++ class has enough coverage and which cpp class has no coverage.

The current coverage rate is measured by source file and source lines. It's great but, I feel a little hard to dig into more detailed C++ class information.


Thanks,
Frank

New Post: Opening our application by OpenCppCoverage tool takes a long time

$
0
0
Dear Sir or Madam,

At first, I would like to say thank you very much because of the helpfulness of the OpenCppCoverage for my current work.
However, recently I have met a problem when I open my application and in the meantime use the OpenCppCoverage tool . It takes quite a long time to start it. But if only my application is opened without the OpenCppcoverage, it can be very quickly started.
I have tried to solve this problem, but it fails. So I come to ask you for the help.
Do you have any idea or suggest about this?
Thank you very much for your help in advance, and I am waiting for your reply.
With best regards,
Feiyun Lin

New Post: Opening our application by OpenCppCoverage tool takes a long time

$
0
0
Hello,

Did you have a look at Faster startup: --moduleshere.
You can also check that --sources flag does not include any third party librarie sources.

Please let me know if it solved your issue.

Best regards,

OpenCppCoverage
Viewing all 235 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>