Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Coverage Recording files not getting created after deploying application and running.

Sagar Vysyaraju May 25, 2017

Hi All,

We have deployed a connector software built in java in the server. Now we have placed the clover.jar in the location where application jars were deployed. (So we were able to bypass the noclassdef found error com.atlassian testnamesniffer)

 

Now the instrumented application is running fine but coverage recording files are not getting created.

<clover-setup initstring="/tmp/clover/clover4_1_2.db"/> is set in the build.xml

Ensured the folder has the clover4_1_2.db already in place.

I would like to tell you the way we instrumented which might become handy to resolve the issue : Our application deployed is a tar.gz file. which internally have two jar files. We have instrumented a single .jar and the other is left as is.

Inside the sub project, we have updated the build.xml with clover.jar path, initstring with .db file path etc...

<target name="with.clover">
<clover-setup/>
</target>

 

Can you please let me know why the coverage recording files not getting created ? Any debug steps we have to do.

 

3 answers

0 votes
Sagar Vysyaraju June 4, 2017
Hi Grzegorz
 
You are wright, its the permissions issue, I did chmod on the folder where the coverage recording files should be created. Now its able to create the coverage files.
 
The next level blocker is I am not getting any report out of the coverage recording files
 
java -cp /tmp/clover/clover.jar com.atlassian.clover.reporters.html.HtmlReporter -i /opt/teradata/tdqg/connector/tdqg-aster-connector/clover4_1_2.db -o clover_html
Clover Version 4.1.2, built on October 11 2016 (build-994)
Loaded from: /tmp/clover/clover.jar
Clover: Commercial License registered to TERADATA CORP..
WARN: No coverage recordings found. No report will be generated.
 
What should be my next step ?
 
I gave class path of the clover.jar using -cp, running the report from the same machine where i have run the coverage,
ran the command from the location of the clover registry file.
Grzegorz Lewandowski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 6, 2017

Can you show me content of the directory were you put the registry on the same machine you pasted output in your last comment?

E.g ls -la /tmp/clover/clover.jar

 

This most probably means that there are no coverage files, but potentially this may mean they have a different name or there were more than 1 instrumentation session and the files were excluded. 

 

 

0 votes
Grzegorz Lewandowski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 2, 2017

When we run a query, the databse engine can run on any of the nodes. (So we are ensuring the clover.jar, clover.license on all node machines)

This is correct course of action.

Is it mandatory that Ant should be present on the machine where the code coverage is being run ?(May be this might be one more problem I suspect)

Actually Ant is not required at all. You can simply use CloverInstr to instrument sources, compile them on your own and generate reports by using HtmlReporter. Anywa, with the approach you took, Ant is not required to be present on a nodes where you run the application. 

java.io.FileNotFoundException flushing coverage for recorder /tmp/clover/clover4_1_2.db72liop_j3ei5oko: /tmp/clover/clover4_1_2.db72liop_j3ei5oko (Permission denied)

This means Clover was configured properly there, however it can't flush coverage recordings to hard drive. Please ensure process which runs Clover has permissions to write to /tmp/clover directory. Please note: Clover by default flushes data to hard drive once JVM is gracefully shutdown. So please make sure you do shut down JVMs on all notes gracefully. You can change the default behaviour by changing the flush policy.

0 votes
Grzegorz Lewandowski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 30, 2017

Can you see Clover recorders being created when running tests? You should be able to see logs like this: Clover.getRecorder if you enable Clover debug logs.

Could you elaborate a little bit more how you start and stop application server and how you execute tests?

Lack of the coverage recordings may be connected with forced shut down of JVM application server, but it also may be caused by wrong Clover initialisation. 

Sagar Vysyaraju May 31, 2017

Hi Grzegorz, 

We are not using any tests, but we are firing a query from one database to get data from another database. (For which we use the connector software which is instrumented)

I have added the classpath in the JVM file.(/home/beehive/bin/utils/sqlmr/BridgeJVMLauncher.sh)

I found the below error in the logs :


2 20170531-03:47:24-GMT-0400 Error: Could not find or load main class .tmp.clover.clover.jar


I gave the below path in class path:

/tmp/clover/clover.jar

 

Sagar Vysyaraju May 31, 2017

Now I moved the clover.jar to /home/beehive as all the class paths start with the same.

I see the below err in the logs :


20170531-04:50:56-GMT-0400 Error: Could not find or load main class 1464
20170531-05:00:58-GMT-0400 Error: Could not find or load main class 1492

Grzegorz Lewandowski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 31, 2017

Clover doesn't provide any useful Main classes to run instrumetned code. You should just start the application like you normally do with Clover JAR in the classpath and initstring. In that case Clover will pick up the configuration and start recording coverage. 

 

Can you share BridgeJVMLauncher.sh file? I'm still not quite sure what steps are you doing in order to launch instrumented code.

 

Sagar Vysyaraju May 31, 2017

<clover-setup initstring.basedir="/tmp/clover/clover4_1_2.db"/>

Is this the correct way to mention the basedir to let clover know the registry file location.

I am not in favour of the -Dclover.initstring.basedir="path", because basically I am not sure where to give this as an argument for the JVM, because of the unique setup we have.

Grzegorz Lewandowski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 1, 2017

clover-setup tag modifies Ant's project to cope with Test and Javac tasks in order to instrument your code and execute tests. If you don't use it and as far I understand you don't, it won't help you in gathering coverage statistics. 

 

Generally speaking, Clover works in that way it:

* Instruments source code with its own statements

* Once instrumented code is executed, Clover statements are as well thus it's able to gather coverage data

* After JVM is successufly shutdown the data is flushed to hard drive

* Eventually you can generate coverage report from generated data. 

In every step initstring configuration is required. Clover while instrumenting code creates the database which will be used further in the process.

Sagar Vysyaraju June 1, 2017

May be this is the catch... we are using "Make" instead of ant to generate the software build.

We are using commands like make clean; make and make clean build.

Q1 ) So clover doesnt work in this way, i.e through make instead of ant ?

As we are using the clover ant version. Intereseting thing here is that we still get the instrumented classes for the java project.

Q2 ) We have a multi level project, I mean we have some jars inside a tar.gz build.

Instrumentation works at jar level but not at the tar level. Is this expected ?

To make it clear, clover do not instrument the .jar or get into it and do the same ?

Sagar Vysyaraju June 1, 2017

This is the log showing CLOVER related message during build time.

I hope I have set everything correctly. Seems like very close to the final goal. Your inputs please. Still clover4_1_2.db present in /tmp/clover on all the nodes is not getting updated

 CLoverSuccess.jpg

Grzegorz Lewandowski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 1, 2017

So clover doesnt work in this way, i.e through make instead of ant ?


As we are using the clover ant version. Intereseting thing here is that we still get the instrumented classes for the java project.

 

Clover can't seemingly integrate with Make tool. From the screenshot it seems like you're calling ANT underneeth and with addition of clover-setup code instrumention works just fine. 

 

We have a multi level project, I mean we have some jars inside a tar.gz build.

Instrumentation works at jar level but not at the tar level. Is this expected ?

Generally speaking Clover instruments sources only (for Groovy code the instrumentation happens during compilation time via AST transformations). In your canse, when you configure Clover via clover-setup  instrumentation works on a Java file level in the way Clover wraps default Ant Javac instance and instruments the code on the fly. 

I think in your setup the tar.gz archive should contain only instrumented classes. Either way you can find out the truth by peeking into Class bytecode. There should be static fileds indicating that Clover indeed instrumented that file.  

 

In the screenshot you provided states Clover sucessfully instrumented part (or all?) of your code. I think the reason why you're not getting the coverage data lies in the way how you start, and stop the application. 

 


Still clover4_1_2.db present in /tmp/clover on all the nodes is not getting updated

 

What do you mean by that? What do you understand by nodes?

Sagar Vysyaraju June 1, 2017

Actually we are running the instrumented software on a cluster, which has different nodes. Each node is a different machine/ip address.

When we run a query, the databse engine can run on any of the nodes. (So we are ensuring the clover.jar, clover.license on all node machines)

Is it mandatory that Ant should be present on the machine where the code coverage is being run ?(May be this might be one more problem I suspect)

Your inputs please. I hope ant is required while instrumentation, but not required to have ant installed on a the machine we run the software.

 

Sagar Vysyaraju June 1, 2017

Interestingly I see the logs below..... in one of the nodes :


139 20170601-10:14:49-GMT-0400 ERROR: java.io.FileNotFoundException flushing coverage for recorder /tmp/clover/clover4_1_2.db72liop_j3ei5oko: /tmp/clover/clover4_1_2.db72liop_j3ei5oko (Permission denied)
340 20170601-10:14:47-GMT-0400 ERROR: java.io.FileNotFoundException flushing coverage for recorder /tmp/clover/clover4_1_2.dbslnyss_j3ei5nb3: /tmp/clover/clover4_1_2.dbslnyss_j3ei5nb3 (Permission denied)
139 20170601-10:14:49-GMT-0400 ERROR: java.io.FileNotFoundException flushing coverage for recorder /tmp/clover/clover4_1_2.db8x5ing_j3ei5on1: /tmp/clover/clover4_1_2.db8x5ing_j3ei5on1 (Permission denied)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events