rjust / defects4j

A Database of Real Faults and an Experimental Infrastructure to Enable Controlled Experiments in Software Engineering Research
MIT License
718 stars 299 forks source link

`defects4j export` removes .class files #39

Open jose opened 8 years ago

jose commented 8 years ago

Hi,

I noticed that for (at least one) Mockito's bug defects4j export deletes the test classes directory. For example, suppose that I checkout Mockito-25b and then I compile it:

$ $D4J_HOME/framework/bin/defects4j checkout -p Mockito -v 25b -w Mockito-25b
$ cd Mockito-25b
$ $D4J_HOME/framework/bin/defects4j compile

at this point I have a target directory with two sub-directories: classes and test-classes, each one with the respective .class files.

But, if I execute $D4J_HOME/framework/bin/defects4j export -p cp.compile or $D4J_HOME/framework/bin/defects4j export -p cp.test the target/test-classes is deleted.

The world will not end tomorrow just because of this, but anyway... :smiley:

rjust commented 7 years ago

This is related to issue #111. Defects4J calls the compile task of the project before exporting a property. Since the dependencies are set up in a way that every compilation cleans the target directories first, the test classes are deleted.

mudasirhw commented 5 years ago

hi. can u please help me with the set up process of defects4j. i do clone but thereafter , i am not able to run all commands eg. defects4j info -p Lang

mernst commented 5 years ago

@mobilemania123 This issue about removing .class files is not the right place to ask an unrelated question. As a quick answer, merely cloning is not enough. You should follow the setup instructions.

bkushigian commented 4 years ago

@rjust @jose Issue #111 was closed---did that resolve this issue?

jose commented 4 years ago

@bkushigian, no.

BEbillionaireUSD commented 3 weeks ago

This is related to issue #111. Defects4J calls the compile task of the project before exporting a property. Since the dependencies are set up in a way that every compilation cleans the target directories first, the test classes are deleted.

Could I understand it this way if I modify the code and compile it again, Defects4J will recompile by default without being affected by previous results?

rjust commented 3 weeks ago

@BEbillionaireUSD If you modify the source code in a Defects4J working directory and then rerun defects4j compile, Defects4J should incrementally compile your changes. (As a simple test, you can modify an existing source file so that it no longer compiles.)

That said, we have seen reports of the underlying build system not picking up incremental changes reliably, possibly leading to stale class files. Therefore, it is best to delete at least the class file that you want Defects4J to recompile before calling the compile or test command.

If you have additional questions, please open a new issue. Issue #39 is about the export command and issue #111 is about gradle builds.