Closed rhwood closed 6 years ago
I believe this is just a simple bug in the logging: these messages are the only logging messages that actually include a "\n" in the formatting string, so I believe that whitespace characters are being escaped by the log formatter and printing the \n
. I'll correct that format string shortly: the actual prefix being used does not have a newline in it.
In your case it seems like you might not need to specify the prefix. The --prefix
is necessary when the paths to the source file in the coverage report are not relative to the PWD
where the test reporter is running. You say your project's source files are in src/main/java
, and the log message for the first source file indicates that the file might have been listed in your jacoco coverage report as src/main/java/com/alexandriasoftware/swing/JSplitButton.java
(which got stripped of the prefix to just com/alexandriasoftware/swing/JSplitButton.java
). If the file really is at src/main/java/com/alexandriasoftware/swing/JSplitButton.java
, and is referred to as such in your jacoco coverage report, you probably don't want the prefix at all. Does that make sense?
I'm inferring a fair amount about your jacoco coverage report above based on the log messages, so I could be making some rash & erroneous assumptions. If I'm wrong, could you please give an example of what the path in a <sourcefile>
tag looks like in your jacoco report XML? Thanks.
Thank you. So the original reported problem isn't a problem.
The jacoco report lists the files as (this is a manually formatted beginning of the jacoco report):
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE report PUBLIC "-//JACOCO//DTD Report 1.0//EN" "report.dtd">
<report name="JSplitButton">
<sessioninfo id="Calculus.fios-router.home-6e7e81a9" start="1515678608418" dump="1515678614603"/>
<package name="com/alexandriasoftware/swing">
<class name="com/alexandriasoftware/swing/JSplitButton">
Running cc-test-reporter without the prefix yields:
$ ./cc-test-reporter after-build --debug --coverage-input-type jacoco --exit-code $TRAVIS_TEST_RESULT
time="2018-01-12T00:46:18Z" level=debug msg="about to run format-coverage"
time="2018-01-12T00:46:18Z" level=debug msg="using formatter jacoco"
time="2018-01-12T00:46:18Z" level=debug msg="checking search path for jacoco formatter"
time="2018-01-12T00:46:18Z" level=debug msg="checking search path jacoco.xml for jacoco formatter"
time="2018-01-12T00:46:18Z" level=debug msg="couldn't load committed at from ENV, trying git..."
time="2018-01-12T00:46:18Z" level=info msg="triming with prefix /home/travis/build/rhwood/jsplitbutton/\n"
time="2018-01-12T00:46:18Z" level=debug msg="getting fallback blob_id for source file com/alexandriasoftware/swing/JSplitButton.java"
time="2018-01-12T00:46:18Z" level=error msg="failed to read file com/alexandriasoftware/swing/JSplitButton.java\nopen com/alexandriasoftware/swing/JSplitButton.java: no such file or directory"
Error: open com/alexandriasoftware/swing/JSplitButton.java: no such file or directory
Usage:
cc-test-reporter after-build [flags]
Thanks for the details @rhwood, apologies that my assumptions about the paths in the report were incorrect. My colleague @ale7714, who's more familiar with some of our test reporter behavior than I am, pointed out to me that this looks like behavior other jacoco users have encountered: there's discussion around that in #243, and some workarounds, including a gradle task that would hopefully be easy to integrate. Can you please take a look at that issue & let me know if any of those workarounds are useful to you?
No reply here in a long time, closing due to staleness
Running the cc-test-reporter on Travis CI, it appears that a trailing
\n
is added to the prefix that should not be.In the case below, the project is at
/home/travis/build/rhwood/jsplitbutton
and the sources in the project are insrc/main/java
(so it possible I have the prefix wrong, but I definitely am not adding the trailing\n
myself.