defects4j
defects4j copied to clipboard
Problem with testing patches for Lang 29
There is a problem with Lang 29 where if you compile and test the buggy checkout, patching it next won't change the test result.
Steps to reproduce
- Checkout the buggy version of Lang 29:
$ defects4j/framework/bin/defects4j checkout -p Lang -v 29b -w tmp/lang29-buggy
- Compile and run the tests:
$ defects4j/framework/bin/defects4j compile -w tmp/lang29-buggy $ defects4j/framework/bin/defects4j test -w tmp/lang29-buggy Failing tests: 1 - org.apache.commons.lang3.SystemUtilsTest::testJavaVersionAsInt
- Head to the problematic source file at
tmp/lang29-buggy/src/main/java/org/apache/commons/lang3/SystemUtils.java
, line 1672 and fix the issue:- static float toJavaVersionInt(String version) { + static int toJavaVersionInt(String version) {
- Compile and test (test will fail again):
$ defects4j/framework/bin/defects4j compile -w tmp/lang29-buggy $ defects4j/framework/bin/defects4j test -w tmp/lang29-buggy Failing tests: 1 - org.apache.commons.lang3.SystemUtilsTest::testJavaVersionAsInt
If you manually delete the compiled test class from the target directory at tmp/lang29-buggy/target/test-classes/org/apache/commons/lang3/SystemUtilsTest.class
, the test will pass:
$ defects4j/framework/bin/defects4j test -w tmp/lang29-buggy
Failing tests: 0
Thanks for reporting this, @h4iku.
Can you please let us know what your OS and system environment you are using?
I first encountered this issue on a WSL Ubuntu 20.04 installation on Windows 10. Java version was 1.8.0_332 Temurin installed using SDKMAN. Now the same system is updated to Ubuntu 22.04 with Java 1.8.0_345 Temurin, and the problem is still reproducible. Maven is 3.8.6.
I checked the issue on the latest Manjaro Linux update and Pop!_OS 22.04 with the same Java 8 version, and it still happened. There is no separate Ant or Maven installation on these systems.
I've seen this behavior on other random Java projects. I guess that's why people obsessively clean compile their projects.