rjust/defects4j

Ant Test Build Failed

EhsanMashhadi opened this issue · 2 comments

Hi,

I am doing some experiments by using EvoSuite and Defects4J. When I generated tests for ant projects like Chart1b then move the generated test file to the directory containing the proper project cloned by defects4j. It fails to compile the tests:

Running ant (compile)...................................................... OK
Running ant (compile.tests)................................................ FAIL
Executed command:  cd /home/ehsan/Workspace/java/trace4j/projects/chart_1b && /home/ehsan/Workspace/java/defects4j/defects4j/major/bin/ant -f /home/ehsan/Workspace/java/defects4j/defects4j/framework/projects/defects4j.build.xml -Dd4j.home=/home/ehsan/Workspace/java/defects4j/defects4j -Dd4j.dir.projects=/home/ehsan/Workspace/java/defects4j/defects4j/framework/projects -Dbasedir=/home/ehsan/Workspace/java/trace4j/projects/chart_1b -Dbuild.compiler=javac1.7  compile.tests 2>&1
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=1G; support was removed in 8.0
Buildfile: /home/ehsan/Workspace/java/defects4j/defects4j/framework/projects/defects4j.build.xml

initialise:

compile:
    [javac] /home/ehsan/Workspace/java/defects4j/defects4j/framework/projects/Chart/Chart.build.xml:57: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds

compile-experimental:
    [javac] /home/ehsan/Workspace/java/defects4j/defects4j/framework/projects/Chart/Chart.build.xml:106: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds

compile.tests:
    [javac] /home/ehsan/Workspace/java/defects4j/defects4j/framework/projects/Chart/Chart.build.xml:121: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
    [javac] Compiling 390 source files to /home/ehsan/Workspace/java/trace4j/projects/chart_1b/build-tests
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.4
    [javac] /home/ehsan/Workspace/java/trace4j/projects/chart_1b/tests/org/jfree/chart/renderer/category/AbstractCategoryItemRenderer1_ESTest.java:9: error: static import declarations are not supported in -source 1.4
    [javac] import static org.junit.Assert.*;
    [javac]        ^
    [javac]   (use -source 5 or higher to enable static import declarations)
    [javac] /home/ehsan/Workspace/java/trace4j/projects/chart_1b/tests/org/jfree/chart/renderer/category/AbstractCategoryItemRenderer1_ESTest.java:38: error: annotations are not supported in -source 1.4
    [javac]   @Test(timeout = 4000)
    [javac]    ^
    [javac]   (use -source 5 or higher to enable annotations)
    [javac] /home/ehsan/Workspace/java/trace4j/projects/chart_1b/tests/org/jfree/chart/renderer/category/AbstractCategoryItemRenderer1_ESTest.java:135: error: generics are not supported in -source 1.4
    [javac]       ArrayList<Integer> arrayList0 = new ArrayList<Integer>();
    [javac]                ^
    [javac]   (use -source 5 or higher to enable generics)
    [javac] 3 errors
    [javac] 1 warning

Since I am using JAVA1.8 and the JAVA_HOME and PATH variable are set. Would you please help me why it does not work?

rjust commented

Hi @EhsanMashhadi,

The test-generation script produces an archive containing the generated tests. To run/analyze these generated tests, you should call, e.g., defects4j test -s or use the test-execution framework.

Merging the generated test files with the developer-written test files results in all files being compiled/run with the developer-written build file, which in this case specifies a particular source and target version.

Hope this helps.

rjust commented

I am closing this issue. Feel free to reopen it (or open a new issue) if you have further questions.