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

New Post: Can run opencppcoverage without source code?

$
0
0
Hello,

As an alternative, you can try the following command:
OpenCppCoverage --sources YourFilter --export_type=binary:test.cov -- YOUR_PROGRAM
It generates a file test.cov that contains the coverage data. Copy this file on the computer where you compile your program (Or another computer with the same source location) and run:
OpenCppCoverage --input_coverage test.cov
It generates the HTML report.

Hope that help,

OpenCppCoverage

New Post: Can run opencppcoverage without source code?

$
0
0
Thanks,

One more question here,

1.Compile my program on computer A, source code location is c:\workspace\src1
2.Copy program on computer B, and run it with
OpenCppCoverage --export_type=binary:c:\test_data\data.cov -- PROGRAM
3.Copy data.cov on computer C, and check out source code on C, but location is c:\workspace\src2, use following command:
OpenCppCoverage --sources=c:\workspace\src2 --input_coverage data.cov --export_type html:c:\my_report
In html report, it shows source file does not exist.

So, on computer C, source code location must be same as compiling location, and option "--sources" can't resolve this problem, right?

New Post: opencppcoverage for VS unit test framework?

$
0
0
The MS VS unit testing framework generates a DLL, which is then invoked by vstest.executionengine.exe. Any clues how to use opencppcoverage for such a project?

New Post: Can run opencppcoverage without source code?

$
0
0
Hello,

Yes, source files on computer C should be at the same location as on computer A. "--sources" defines which source files should be included in the coverage not source location.

You can try to use folder shortcut to have the same path (not tested).
Perhaps this link can also help: https://msdn.microsoft.com/en-us/library/ms680641.aspx

Let me know if you find something.


OpenCppCoverage

New Post: opencppcoverage for VS unit test framework?

$
0
0
Hello,

See this discussion to have an example of command line to run OpenCppCoverage with VS unit test framework.

Unfortunately, we discovered a bug and you will probably have an empty coverage (You can read the last message of this discussion for more information). I am working on the fix and plan to create a new release in a few days.
I will add a message to this discussion.

OpenCppCoverage

New Post: Empty Report

$
0
0
1) Created a hello world project.
2) Added google cpp testing framework GTest to the project.
3) Created a few simple tests.
4) Installed plugin for VS2015 and restarted VS2015
5) From the menu Tools==>Run OpenCPPCoverage
6) An empty HTML report is produced. (expected a code coverage report)

Image


Source code:
// HelloWorldTest.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include "gtest/gtest.h"
GTEST_API_ int main(int argc, char **argv) {
    printf("Running main() from gtest_main.cc\n");
    testing::InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();
}

// Testing 
// ----------------------------------------------------------------------------
TEST(HelloWorld, TestingTrue) {
    EXPECT_TRUE(true);
}
TEST(HelloWorld, TestingFalse) {
    EXPECT_FALSE(false); 
}
TEST(HelloWorld, TestingEqual) {
    EXPECT_EQ(123, 123); 
}
In the console window I get the following output
[info] Start Program:
Path:"X:\XXXX\XXX-testing\example\HelloWorldTest\Debug\HelloWorldTest.exe"
Arguments:
Working directory: not set.

Modules: Selected: X:\XXXX\XXX-testing\example\HelloWorldTest\Debug\HelloWorldTest.exe Excluded:
Sources: Selected: X:\XXXX\XXX-testing\example\HelloWorldTest\HelloWorldTest Excluded:
Log Level: Normal
Cover Children: 0
Aggregate by file: 1
Export: Html C:\Users\user\AppData\Local\Temp\1qpzw1lj.wqi Input coverage:

[info] Module: E:\xdrive\XXXX\XXX-testing\example\HelloWorldTest\Debug\HelloWorldTest.exe is skipped because it matches no selected patterns
I assume the issue is with "skipped because it matches no selected patterns" but I am not sure how to resolve this issue.

New Post: opencppcoverage for VS unit test framework?

New Post: Empty Report

$
0
0
It probably has to do with module filters. Personally I found them to be a bit of a pain, which is why my own addin simply accepts everything underneath the solution folder.

The OpenCPPCoverage team is building a new VS addin, which they intend to release after the summer. Until then, I suggest trying https://github.com/atlaste/VSOpenCPPCoverage , it might solve your issue here.

New Post: Empty report following Unity tests

$
0
0
Hello,

I am sorry if this discussion is a duplicate of this.

I am trying to generate a coverage report after performing tests with Unity. The files I have are very basic:

Source file
#include "MyExampleHeader.h"

int8_t AverageThreeBytes(int8_t a, int8_t b, int8_t c)
{
    return (int8_t)(((int16_t)a + (int16_t)b + (int16_t)c) / 3);
}

int8_t FindMaximum(int8_t a, int8_t b, int8_t c)
{
    uint8_t tmax = a;
    if (tmax < b)
    {
        tmax = b;
    }
    if (tmax < c)
    {
        tmax = c;
    }
    return tmax;
}
Test file
#include "C:\Projects\CUnitTests\Unity-master\src\unity.h"
#include "MyExampleHeader.h"

void setUp(void)
{

}

void tearDown(void)
{

}

void test_FindMaximum(void)
{
    TEST_ASSERT_EQUAL_HEX8(50, FindMaximum(20, 30, 50));
}

int main(void)
{
    UNITY_BEGIN();
    RUN_TEST(test_FindMaximum);
    return UNITY_END();
}
I compile the two using MSVC2015 in the command line:
C:\Projects\CUnitTests\Files\Project1\Project1>cl /EHsc TestExample.c Source.c C
:\Projects\CUnitTests\Unity-master\src\unity.c
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24210 for x86
Copyright (C) Microsoft Corporation. All rights reserved.

TestExample.c
Source.c
unity.c
Generating Code...
Microsoft (R) Incremental Linker Version 14.00.24210.0
Copyright (C) Microsoft Corporation. All rights reserved.

/out:TestExample.exe
TestExample.obj
Source.obj
unity.obj
After running OpenCppCoverage from the command line, I get an empty HTML report.

The output also has some peculiar lines:
[2016-07-22 10:42:57] [info] Start Program:
Path:"C:\Projects\CUnitTests\Files\Project1\Project1\TestExample.exe"
Arguments:
Working directory: not set.
Modules: Selected: * Excluded:
Sources: Selected: C:\Projects\CUnitTests\Files\Project1\Project1\Debug Excluded:
Log Level: Normal
Cover Children: 1
Aggregate by file: 1
Continue after C++ exception: 1
Export: Html
Input coverage:
Unified diff:
[2016-07-22 10:42:57] [info] Module: C:\Projects\CUnitTests\Files\Project1\Project1\TestExample.exe is selected because it matches selected pattern: *
[2016-07-22 10:42:58] [warning] Cannot find pdb for C:\Projects\CUnitTests\Files\Project1\Project1\TestExample.exe
[2016-07-22 10:42:58] [info] Module: C:\Windows\System32\ntdll.dll is selected because it matches selected pattern: *
[2016-07-22 10:42:58] [warning] Cannot find pdb for C:\Windows\System32\ntdll.dll
[2016-07-22 10:42:58] [info] Module: C:\Windows\SysWOW64\ntdll.dll is selected because it matches selected pattern: *
[2016-07-22 10:42:58] [warning] Cannot find pdb for C:\Windows\SysWOW64\ntdll.dll
[2016-07-22 10:42:58] [info] Module: C:\Windows\System32\wow64.dll is selected because it matches selected pattern: *
[2016-07-22 10:42:58] [warning] Cannot find pdb for C:\Windows\System32\wow64.dll
[2016-07-22 10:42:58] [info] Module: C:\Windows\System32\wow64win.dll is selected because it matches selected pattern: *
[2016-07-22 10:42:58] [warning] Cannot find pdb for C:\Windows\System32\wow64win.dll
[2016-07-22 10:42:58] [info] Module: C:\Windows\System32\wow64cpu.dll is selected because it matches selected pattern: *
[2016-07-22 10:42:58] [warning] Cannot find pdb for C:\Windows\System32\wow64cpu.dll
[2016-07-22 10:42:58] [info] Module: C:\Windows\System32\kernel32.dll is selected because it matches selected pattern: *
[2016-07-22 10:42:58] [warning] Cannot find pdb for C:\Windows\System32\kernel32.dll
[2016-07-22 10:42:58] [info] Module: C:\Windows\SysWOW64\kernel32.dll is selected because it matches selected pattern: *
[2016-07-22 10:42:58] [warning] Cannot find pdb for C:\Windows\SysWOW64\kernel32.dll
[2016-07-22 10:42:58] [info] Module: C:\Windows\System32\kernel32.dll is selected because it matches selected pattern: *
[2016-07-22 10:42:58] [warning] Cannot find pdb for C:\Windows\System32\kernel32.dll
[2016-07-22 10:42:58] [info] Module: C:\Windows\System32\user32.dll is selected because it matches selected pattern: *
[2016-07-22 10:42:58] [warning] Cannot find pdb for C:\Windows\System32\user32.dll
[2016-07-22 10:42:58] [info] Module: C:\Windows\SysWOW64\kernel32.dll is selected because it matches selected pattern: *
[2016-07-22 10:42:58] [warning] Cannot find pdb for C:\Windows\SysWOW64\kernel32.dll
[2016-07-22 10:42:58] [info] Module: C:\Windows\SysWOW64\KernelBase.dll is selected because it matches selected pattern: *
[2016-07-22 10:42:58] [warning] Cannot find pdb for C:\Windows\SysWOW64\KernelBase.dll
[2016-07-22 10:42:58] [info] Module: C:\Windows\SysWOW64\api-ms-win-core-synch-l1-2-0.dll is selected because it matches selected pattern: *
[2016-07-22 10:42:58] [warning] Cannot find pdb for C:\Windows\SysWOW64\api-ms-win-core-synch-l1-2-0.dll
[2016-07-22 10:42:58] [info] ----------------------------------------------------
[2016-07-22 10:42:58] [info] Coverage generated in Folder C:\Program Files\OpenCppCoverage\CoverageReport-2016-07-22-10h42m58s
[2016-07-22 10:42:58] [info] ----------------------------------------------------
I can see that the .exe is tested, however, I do not understand why are the dlls tested, why it cannot find the program pdb and why the report is empty. Any suggestions will be greatly appreciated.

Thanks
Radoslav

New Post: Empty report following Unity tests

$
0
0
Hello,

It seems your --sources pattern is not correct (Sources: Selected: C:\Projects\CUnitTests\Files\Project1\Project1\Debug ) except if your source files are located in Debug folder. You do not need to have full path and probably --sources Project1 does the job.

Let me know if it solves your problem,

OpenCppCoverage

New Post: Can run opencppcoverage without source code?

New Post: Empty report following Unity tests

$
0
0
Hello,

It turned out that I was just being silly and forgot to add '/Zi' as an argument in Visual C++, which actually generates the .pdb file. I got it to work and generate a coverage report, it's a fantastic tool!

Thank you for the support!

Best regards

Radoslav

New Post: Empty Report

$
0
0
Hello,

Your analysis is correct, the path of your executable ([info] Module: E:\xdrive\XXXX\XXX-testing\example\HelloWorldTest\Debug\HelloWorldTest.exe) does not match the filter (_Modules: Selected: X:\XXXX\XXX-testing\example\HelloWorldTest\Debug\HelloWorldTest.exe)

I am able to reproduce your problem when using a network drive with (subst).
I created a project in C:\Dev\ConsoleApplication1 and mapped Z: to C:\Dev
  • If I open Visual Studio from C:\Dev\ConsoleApplication1\ConsoleApplication1.sln and run the plugin, the coverage is ok.
  • If I open Visual Studio from Z:\ConsoleApplication1\ConsoleApplication1.sln the coverage is empty.
It is possible for you to not use network drive?
If not, you can try to use OpenCppCoverage command line version. Please see Network path special considerationshere.

Let me know if it help,

OpenCppCoverage

New Post: OpenCPPCover with native C++ test

New Post: opencppcoverage for VS unit test framework?

$
0
0
Hello,

OpenCppCoverage 0.9.5.3 should solve the problem with VS unit test framework.
You have an example of how to run VS unit test framework from command line here.

Let me know if it solve or not your problem,

OpenCppCoverage

New Post: OpenCPPCover with native C++ test

$
0
0
Hello,

I find issue in viewing the index.html file logged after executing RunOpenCppCoverage. I am using version OpenCppCoverage 0.9.5.3. It just displays Coverage total lines Items and rest is empty. Can you please tell me if I have to do any settings in my VS2013 pro.

New Post: Empty Report

$
0
0
You are correct OpenCppCoverage. I was using a subst drive.
I compiled from a normal drive and this issue was resolved.

Thank you.

New Post: opencppcoverage for VS unit test framework?

$
0
0
Hello,

running opencppcoverage from command line as shown in the linked discussion works now. Great job.

Wolfgang



On Wed 27/07/16 23:49 , "OpenCppCoverage" [email removed] sent:

From: OpenCppCoverage

Hello,

OpenCppCoverage 0.9.5.3 should solve the problem with VS unit test framework.
You have an example of how to run VS unit test framework from command line here.

Let me know if it solve or not your problem,

OpenCppCoverage

New Post: OpenCPPCover with native C++ test

New Post: Multithreaded Test Application

$
0
0
Hi - should OpenCppCoverage successfully handle a multithreaded application ? I am seeing frequent crashes of covered processes that are multithreaded. I am using debug builds, with only the executable module itself being covered, no DLLs.
Viewing all 235 articles
Browse latest View live


Latest Images

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