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

Problem with testing patches for Lang 29 #481

Open
h4iku opened this issue Jul 9, 2022 · 2 comments
Open

Problem with testing patches for Lang 29 #481

h4iku opened this issue Jul 9, 2022 · 2 comments

Comments

@h4iku
Copy link
Contributor

h4iku commented Jul 9, 2022

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

  1. Checkout the buggy version of Lang 29:
    $ defects4j/framework/bin/defects4j checkout -p Lang -v 29b -w tmp/lang29-buggy
    
  2. 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
    
  3. 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) {
  4. 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
@rjust
Copy link
Owner

rjust commented Oct 27, 2022

Thanks for reporting this, @h4iku.

Can you please let us know what your OS and system environment you are using?

@h4iku
Copy link
Contributor Author

h4iku commented Oct 27, 2022

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.

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