Closed Ojda22 closed 3 years ago
Thanks @Ojda22 for reporting this!
I've just pushed a fix and here is a step-by-step on how to get coverage/fault-localization report at basic-block level.
mkdir /tmp/gz_issue_34
cd /tmp/gz_issue_34
git clone https://github.com/GZoltar/gzoltar.git gzoltar
cd /tmp/gz_issue_34/gzoltar
git checkout 065aabfa9f78e55d61ce66b2c96f8af2cb0d1421
mvn clean install
cd /tmp/gz_issue_34
git clone https://github.com/jhy/jsoup.git jsoup
cd /tmp/gz_issue_34/jsoup
git checkout 0f7e0cc373aced32629f5321c9521f81d8248647
mvn clean test # Tests run: 653, Failures: 0, Errors: 0, Skipped: 11
As none of the test cases is failing, I change one to fail. Otherwise all components will have a 0% likelihood of being faulty.
diff --git a/src/test/java/org/jsoup/helper/StringUtilTest.java b/src/test/java/org/jsoup/helper/StringUtilTest.java
index 5af8c238..d1035443 100644
--- a/src/test/java/org/jsoup/helper/StringUtilTest.java
+++ b/src/test/java/org/jsoup/helper/StringUtilTest.java
@@ -38,7 +38,7 @@ public class StringUtilTest {
assertTrue(StringUtil.isBlank(null));
assertTrue(StringUtil.isBlank(""));
assertTrue(StringUtil.isBlank(" "));
- assertTrue(StringUtil.isBlank(" \r\n "));
+ assertFalse(StringUtil.isBlank(" \r\n "));
assertFalse(StringUtil.isBlank("hello"));
assertFalse(StringUtil.isBlank(" hello "));
And I also adapted the pom.xml
as follows
diff --git a/pom.xml b/pom.xml
index 4061cf22..b5d02576 100644
--- a/pom.xml
+++ b/pom.xml
@@ -150,6 +150,22 @@
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
</plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.20</version>
+ <configuration>
+ <testFailureIgnore>true</testFailureIgnore>
+ <properties>
+ <property>
+ <name>listener</name>
+ <value>com.gzoltar.internal.core.listeners.JUnitListener</value>
+ </property>
+ </properties>
+ </configuration>
+ </plugin>
+
</plugins>
<resources>
<resource>
# Run project's test suite and collect coverage
mvn clean com.gzoltar:com.gzoltar.maven:1.7.3-SNAPSHOT:prepare-agent test
# Run fault-localization at line level
mvn com.gzoltar:com.gzoltar.maven:1.7.3-SNAPSHOT:fl-report -Dgzoltar.granularity=line
mv target/site/gzoltar gzoltar-line
# Run fault-localization at basicblock level
mvn com.gzoltar:com.gzoltar.maven:1.7.3-SNAPSHOT:fl-report -Dgzoltar.granularity=basicblock
mv target/site/gzoltar gzoltar-basicblock
Then using a tool like meld, e.g.,
meld gzoltar-line/sfl/txt/ochiai.ranking.csv gzoltar-basicblock/sfl/txt/ochiai.ranking.csv
you can easily see that the ranking at basicblock level is different/smaller.
PS: Feel free to report (i.e., open a new issue) if you find any inconsistency while using the basicblock granularity level.
-- Best, Jose
Many thanks @jose, it works like a charm now
Context
I'm trying to generate matrices both for line and basic block coverage. More specifically, I want to obtain which test covered both lines and basic blocks. However, it seems that matrix.txt files for both granularity levels are the same.
Steps to Reproduce
GZoltar arguments
mvn com.gzoltar:com.gzoltar.maven:1.7.2:prepare-agent test
mvn com.gzoltar:com.gzoltar.maven:1.7.2:fl-report -Dgzoltar.granularity=basicblock
Expected behaviour
I'm expecting to obtain spectra.csv files with different content (lines, basicblocks) After 2 separate runs with different granularity, I obtain the same output files (both matrix.txt, spectra.csv)
Environment (please complete the following information, if relevant):
Additional comments
Please help