Hi All,
I have instrumented a sample java program in windows, using clover-ant and was able to get the coverage info when running the .jar file using commandline.
Query : How to run an instrumented build in Linux.
Plan A : I tried using the same build which we instrumented in windows and tried runnning the same in linux environment by using the same clover.jar and same coverage.db file. (This didnt work out because the clover.jar path in windows cant be matched to any similar path in linux, similarly the same issue with initstring)
Plan B : Installed ant in the linux environment, copied the same java project in to linux machine, modified the build.xml to the expected paths of clover.jar present in the linux machine. When trying to run the .jar file I am seeing the below error :
/home/sv186037/Desktop/code_coverage/CloverInstrumentBuild/build/jar/CIB.jar: line 1: $'PK\003\004': command not found
/home/sv186037/Desktop/code_coverage/CloverInstrumentBuild/build/jar/CIB.jar: line 2: $'\bS#\261J': command not found
/home/sv186037/Desktop/code_coverage/CloverInstrumentBuild/build/jar/CIB.jar: line 3: syntax error near unexpected token `)'
/home/sv186037/Desktop/code_coverage/CloverInstrumentBuild/build/jar/CIB.jar: line 3:R#�J�C8�s�META-INF/MANIFEST.MFM�1�0
�H��Gb%����fb��X���T����� �����)�ٛhM%Ɂ���v�κ<�&�p���?��D��oW��pU`(���G0
�l�Ƶ˛bZ)\f0`�PK'
I actually though of moving the same insturmented jar from windows to linux, but the paths mentioned in the build.xml will not be matchng the linux environment.
So I have instrumented a new one using new paths for clover.jar and coverage.db in linux machine.
To build a new instumented build in linux only clover.jar is enough or I need the total folder of clover-ant-4.1.2 ?
I tried with the complete folder of clover-ant-4.1.2 and build was successful, only thing is the coverege.db file is not getting created, even the .clover folder is also not getting created.
but the paths mentioned in the build.xml will not be matchng the linux environment.
You need to write proper path handling in the ANT project. You may use:
To build a new instumented build in linux only clover.jar is enough or I need the total folder of clover-ant-4.1.2 ?
Clover.jar will be sufficient. Clover-ant cotains API documentation, 3rd party libraries licenses and tutorial. The main part is clover.jar
I tried with the complete folder of clover-ant-4.1.2 and build was successful, only thing is the coverege.db file is not getting created, even the .clover folder is also not getting created.
Without build logs and build file I can't really tell what's wrong. Also please note, there's no such thing like coverage.db. There's a Clover database which is generated during instrumentation phase, it contains infromation about your project structure and there're coverage recordings files which contains data about actual coverage. Those are created when instrumented code is executed and has access to Clover database.
Hi Grzegorz,
Was able to instrument the same java code in linux by istalling ant, and modifying the paths of clover.jar and clover registry file in build.xml.
Even the coverage recording files are getting created as well.
Thanks,
Sagar.
I want to generate a clover report but that's possible only if I test my jars. How do I test my .jar files which have been instrumented by clover?
I don't know how your tests configuration looks like. But replace 'normal production' JAR with instrumented JAR on a classpath.