Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jacococli get error that Invalid execution data file while reporting #1528

Closed
pingchunzhang opened this issue Oct 17, 2023 · 4 comments
Closed

Comments

@pingchunzhang
Copy link

pingchunzhang commented Oct 17, 2023

THIS IS A BUG TRACKER ONLY. FOR QUESTIONS PLEASE CHECK FAQ OR USE FORUM:

http://www.jacoco.org/jacoco/trunk/doc/faq.html

https://groups.google.com/forum/?fromgroups=#!forum/jacoco

Please understand that
ISSUES WITHOUT FOLLOWING INFORMATION WILL BE CLOSED WITHOUT COMMENTS!
Thank you for filing a useful bug report!

Steps to reproduce

  • JaCoCo version: jacoco-0.8.10.zip and jacoco-0.8.11.zip
  • Operating system:
Linux VM-16-12-centos 5.4.119-19-0009.11 #1 SMP Wed Oct 5 18:41:07 CST 2022 x86_64 x86_64 x86_64 GNU/Linux
Linux VM-0-20-ubuntu 5.4.0-153-generic #170-Ubuntu SMP Fri Jun 16 13:43:31 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
  • Tool integration: CLI
  • Complete executable reproducer: pingchunzhang
  • Steps:
  1. start tcp server with jacocoagent
java -javaagent:/mnt/hdd01/zcp/jacoco/lib/jacocoagent.jar=includes=*,output=tcpserver,port=9393,address=localhost,append=true
  1. dump exec file
root@VM-0-20-ubuntu:/mnt/hdd01/zcp# /usr/lib/jvm/java-8-openjdk-amd64/bin/java -jar /mnt/hdd01/zcp/jacoco/lib/jacococli.jar dump --address localhost --port 9393 --destfile fe_cov_01.exec
[INFO] Connecting to localhost/127.0.0.1:9393.
[INFO] Writing execution data to /mnt/hdd01/zcp/fe_cov_01.exec.
  1. report jacoco report
/usr/lib/jvm/java-8-openjdk-amd64/bin/java -jar /mnt/hdd01/zcp/jacoco/lib/jacococli.jar report fe_cov_01.exec --classfiles /mnt/hdd01/zcp/doris/fe/fe-common/target/classes/*.class  --classfiles /mnt/hdd01/zcp/doris/fe/*/target/classes/org/apache/doris/*/*.class --classfiles /mnt/hdd01/zcp/doris/fe/*/target/classes/org/apache/doris/*/*/*.class --classfiles /mnt/hdd01/zcp/doris/fe/fe-core/target/classes/org/apache/doris/*/*/*/*.class --classfiles /mnt/hdd01/zcp/doris/fe/fe-core/target/classes/doris/segment_v2/*.class --sourcefiles /mnt/hdd01/zcp/doris/fe --html report_test
[INFO] Loading execution data file /mnt/hdd01/zcp/fe_cov_01.exec.
[INFO] Loading execution data file /mnt/hdd01/zcp/doris/fe/fe-common/target/classes/org/apache/doris/catalog/AnyElementType.class.
Exception in thread "main" java.io.IOException: Invalid execution data file.
	at org.jacoco.cli.internal.core.data.ExecutionDataReader.read(ExecutionDataReader.java:90)
	at org.jacoco.cli.internal.core.tools.ExecFileLoader.load(ExecFileLoader.java:60)
	at org.jacoco.cli.internal.core.tools.ExecFileLoader.load(ExecFileLoader.java:74)
	at org.jacoco.cli.internal.commands.Report.loadExecutionData(Report.java:99)
	at org.jacoco.cli.internal.commands.Report.execute(Report.java:83)
	at org.jacoco.cli.internal.Main.execute(Main.java:90)
	at org.jacoco.cli.internal.Main.main(Main.java:105)

Expected behaviour

i expect get report correctly, not meet error that Invalid execution data file.

Actual behaviour

Exception in thread "main" java.io.IOException: Invalid execution data file.

(In case of exceptions provide FULL STACKTRACE)

@pingchunzhang pingchunzhang added the type: bug 🐛 Something isn't working label Oct 17, 2023
@Godin
Copy link
Member

Godin commented Oct 17, 2023

Asterisks (*) in your command are interpreted by your shell

i.e. for

--classfiles /mnt/hdd01/zcp/doris/fe/*/target/classes/org/apache/doris/*/*.class

the real executed command is something like

--classfiles class1.class /mnt/hdd01/zcp/doris/fe/fe-common/target/classes/org/apache/doris/catalog/AnyElementType.class

whereas should be

--classfiles class1.class --classfiles /mnt/hdd01/zcp/doris/fe/fe-common/target/classes/org/apache/doris/catalog/AnyElementType.class

as per documentation https://www.jacoco.org/jacoco/trunk/doc/cli.html every argument such as

/mnt/hdd01/zcp/doris/fe/fe-common/target/classes/org/apache/doris/catalog/AnyElementType.class

without preceding --classfiles is interpreted as exec file and not as class file, resulting in

[INFO] Loading execution data file /mnt/hdd01/zcp/doris/fe/fe-common/target/classes/org/apache/doris/catalog/AnyElementType.class.
Exception in thread "main" java.io.IOException: Invalid execution data file.

as expected.

@Godin Godin closed this as completed Oct 17, 2023
@Godin Godin added declined: invalid ❌ and removed type: bug 🐛 Something isn't working labels Oct 17, 2023
@pingchunzhang
Copy link
Author

pingchunzhang commented Oct 17, 2023

OK, got it. thank so much.
btw, in my cases, there is so many .class files, if each of it need --classfiles, this command line is particularly large, idon't know Is there a better way?

@Godin
Copy link
Member

Godin commented Oct 17, 2023

You don't need to specify each file - you can specify directory.

@pingchunzhang
Copy link
Author

ok, thank you so much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants