Clover merge command line tool slow on merging
Asked by will zhang:

Hi,

I'm trying to merge clover.db for the same application from 15 test machines. I'm using the command line merge tool. It seems the merging takes really long time on a scale of 15 clover.db. Is this normal?

Also, I have another application that I want to merge them together into one report. Should I merge them into one db and generate html report afterwards? Or is there any better way on doing this?

Thanks a lot!

Will


Answers:
author: Marek Parfianowicz
body: Hi Will,
> I'm trying to merge clover.db for the same application from 15 test machines.

Did you run the same application on these 15 test machines? By 'the same application' I mean the same binaries, for instance compiled on a single build machine and next deployed to test machines.

Did you use Distributed Per-Test Coverage feature? In other words - did you have one dedicated machine which was launching tests, which were calling application logic on these 15 test machines? Or you have rather launched 15 different sets of tests - each running on it's own test machine?

Why am I asking about it? Because if you have used the same binaries and the same clover.db database on all these test machines and at the same time they were not communicating with each other, but were running tests independently, then there is no need to run Clover merge task. Instead of this, you can just copy all coverage recording files produced on all these machines into one directory (together with clover.db) and create a report.

> It seems the merging takes really long time on a scale of 15 clover.db.

During the database merge, usually the time-consuming operation is merging per-test coverage files. Could you check how many clover.db\*.s files do you have? Could you also tell how many tests (test methods) did you run in your build plan?

Having more than 500'000 files may indeed cause a performance problem.

> Also, I have another application that I want to merge them together into one report. Should I merge them into one db and generate html report afterwards?

Yes. The HTML report task allows to specify only one clover.db. For this reason you'll have to merge clover.db files from different applications into one.

Cheers  
Marek

comments: author: will zhang
body: Hi Marek,

Thanks for your help!

My Inline comment:

Did you run the same application on these 15 test machines? By 'the same application' I mean the same binaries, for instance compiled on a single build machine and next deployed to test machines.

###### ++*Yes.*++ {#toc-hId-834672328}

Did you use Distributed Per-Test Coverage feature? In other words - did you have one dedicated machine which was launching tests, which were calling application logic on these 15 test machines? Or you have rather launched 15 different sets of tests - each running on it's own test machine?

###### **++*I have launched 15 different sets of tests*++** {#toc-hId--1717484633}

then there is no need to run Clover merge task. Instead of this, you can just copy all coverage recording files produced on all these machines into one directory (together with clover.db) and create a report.

###### ++***I see, this makes sense since clover.db only has structure of the source files and never changed. It is the recording file that has the coverage data.***++ {#toc-hId-25325702}

We have about 2017 recording files. Now that I only merge two clover.db and the merging is much faster.

Regards,

Will


author: Marek Parfianowicz
body: > ++***I see, this makes sense since clover.db only has structure of the source files and never changed. It is the recording file that has the coverage data.***++

That's correct. The clover.db keeps information about code structure (classses, methods, statements, branches and how they map to specific source lines). Coverage data is stored in recording files - global coverage files are named *'clover.db\<hash\>'* and *'clover.db\<hash\>.1'* , while per-test coverage files are named *'clover.db\<longer hash\>.s'.*

Therefore, as long as your application binaries are based on the same clover.db, there is no point to merge databases.

> We have about 2017 recording files.

This is a very small number of files. Merge operation should be really fast. In case you have a huge trouble with it, feel free to create a ticket at support.atlassian.com, I can analyse this performance problem.


Tags: clover

clover-html-report