Commit c6f513f4 authored by František Haas's avatar František Haas

moved test2 to test

parent da9ee432
...@@ -222,26 +222,26 @@ ...@@ -222,26 +222,26 @@
<!-- *** test instrumentaion package *** --> <!-- *** test instrumentaion package *** -->
<!-- package suite test application --> <!-- package suite test application -->
<target name="package-test2-app"> <target name="package-test-app">
<jar jarfile="${build.test}/disl-app-${tmp.test2.name}.jar" basedir="${bin}" includes="${tmp.test2.path}/app/**"> <jar jarfile="${build.test}/disl-app-${tmp.test.name}.jar" basedir="${bin}" includes="${tmp.test.path}/app/**">
<manifest> <manifest>
<attribute name="Main-Class" value="${tmp.test2.pkg}.app.TargetClass" /> <attribute name="Main-Class" value="${tmp.test.pkg}.app.TargetClass" />
</manifest> </manifest>
</jar> </jar>
</target> </target>
<!-- package suite test instrumentaton with default DiSLClass --> <!-- package suite test instrumentaton with default DiSLClass -->
<target name="package-test2-instr-nomanifest"> <target name="package-test-instr-nomanifest">
<jar jarfile="${build.test}/disl-instr-${tmp.test2.name}.jar" basedir="${bin}" includes="${tmp.test2.path}/instr/**" excludes="${tmp.test2.path}/instr/MANIFEST.MF"> <jar jarfile="${build.test}/disl-instr-${tmp.test.name}.jar" basedir="${bin}" includes="${tmp.test.path}/instr/**" excludes="${tmp.test.path}/instr/MANIFEST.MF">
<manifest> <manifest>
<attribute name="DiSL-Classes" value="${tmp.test2.path}.instr.DiSLClass" /> <attribute name="DiSL-Classes" value="${tmp.test.path}.instr.DiSLClass" />
</manifest> </manifest>
</jar> </jar>
</target> </target>
<!-- package suite test instrumentaton with manifest file --> <!-- package suite test instrumentaton with manifest file -->
<target name="package-test2-instr-manifest"> <target name="package-test-instr-manifest">
<jar jarfile="${build.test}/disl-instr-${tmp.test2.name}.jar" basedir="${bin}" includes="${tmp.test2.path}/instr/**" excludes="${tmp.test2.path}/instr/MANIFEST.MF" manifest="${tmp.test2.manifest}"> <jar jarfile="${build.test}/disl-instr-${tmp.test.name}.jar" basedir="${bin}" includes="${tmp.test.path}/instr/**" excludes="${tmp.test.path}/instr/MANIFEST.MF" manifest="${tmp.test.manifest}">
</jar> </jar>
</target> </target>
...@@ -251,7 +251,7 @@ ...@@ -251,7 +251,7 @@
currently used ant-contrib instead currently used ant-contrib instead
javascript requires js.jar and bsf.jar in lower versions of jdk and ant javascript requires js.jar and bsf.jar in lower versions of jdk and ant
<scriptdef name="package-test2-script" language="javascript"> <scriptdef name="package-test-script" language="javascript">
<element name="dirset" type="dirset" /> <element name="dirset" type="dirset" />
<![CDATA[ <![CDATA[
dirsets = elements.get("dirset"); dirsets = elements.get("dirset");
...@@ -259,53 +259,53 @@ ...@@ -259,53 +259,53 @@
var it = dirsets.get(i).iterator(); var it = dirsets.get(i).iterator();
while (it.hasNext()) { while (it.hasNext()) {
var name = it.next().getName(); var name = it.next().getName();
var path = "ch/usi/dag/disl/test2/suite/" + name; var path = "ch/usi/dag/disl/test/suite/" + name;
var pkg = "ch.usi.dag.disl.test2.suite." + name; var pkg = "ch.usi.dag.disl.test.suite." + name;
var manifest = self.project.getProperty("src.test") + "/" + path + "/instr/MANIFEST.MF"; var manifest = self.project.getProperty("src.test") + "/" + path + "/instr/MANIFEST.MF";
self.project.setProperty( "tmp.test2.name", name); self.project.setProperty( "tmp.test.name", name);
self.project.setProperty( "tmp.test2.path", path); self.project.setProperty( "tmp.test.path", path);
self.project.setProperty( "tmp.test2.pkg", pkg); self.project.setProperty( "tmp.test.pkg", pkg);
self.project.setProperty( "tmp.test2.manifest", manifest); self.project.setProperty( "tmp.test.manifest", manifest);
self.project.executeTarget( "package-test2-app"); self.project.executeTarget( "package-test-app");
if (new java.io.File( manifest).exists()) { if (new java.io.File( manifest).exists()) {
self.project.executeTarget( "package-test2-instr-manifest"); self.project.executeTarget( "package-test-instr-manifest");
} else { } else {
self.project.executeTarget( "package-test2-instr-nomanifest"); self.project.executeTarget( "package-test-instr-nomanifest");
} }
} }
} }
]]> ]]>
</scriptdef> </scriptdef>
<target name="package-test2"> <target name="package-test">
<mkdir dir="${build.test}"/> <mkdir dir="${build.test}"/>
<package-test2-script> <package-test-script>
<dirset dir="src-test/ch/usi/dag/disl/test2/suite/"> <dirset dir="src-test/ch/usi/dag/disl/test/suite/">
<include name="*" /> <include name="*" />
</dirset> </dirset>
</package-test2-script> </package-test-script>
</target> </target>
--> -->
<!-- build single suite test --> <!-- build single suite test -->
<target name="package-test2-single"> <target name="package-test-single">
<antcall target="package-test2-app" /> <antcall target="package-test-app" />
<if> <if>
<available file="${tmp.test2.manifest}" /> <available file="${tmp.test.manifest}" />
<then> <then>
<antcall target="package-test2-instr-manifest" /> <antcall target="package-test-instr-manifest" />
</then> </then>
<else> <else>
<antcall target="package-test2-instr-nomanifest" /> <antcall target="package-test-instr-nomanifest" />
</else> </else>
</if> </if>
</target> </target>
<!-- build jars for every directory in suite tests --> <!-- build jars for every directory in suite tests -->
<target name="package-test2"> <target name="package-test">
<taskdef resource="${ant-contrib.resource}"> <taskdef resource="${ant-contrib.resource}">
<classpath> <classpath>
<pathelement location="${ant-contrib.path}" /> <pathelement location="${ant-contrib.path}" />
...@@ -316,24 +316,24 @@ ...@@ -316,24 +316,24 @@
<for param="file"> <for param="file">
<path> <path>
<dirset dir="src-test/ch/usi/dag/disl/test2/suite/"> <dirset dir="src-test/ch/usi/dag/disl/test/suite/">
<include name="*" /> <include name="*" />
</dirset> </dirset>
</path> </path>
<sequential> <sequential>
<propertyregex override="yes" property="basename" input="@{file}" regexp="(.*)/(.*)" replace="\2" /> <propertyregex override="yes" property="basename" input="@{file}" regexp="(.*)/(.*)" replace="\2" />
<antcall target="package-test2-single"> <antcall target="package-test-single">
<param name="tmp.test2.name" value="${basename}" /> <param name="tmp.test.name" value="${basename}" />
<param name="tmp.test2.path" value="ch/usi/dag/disl/test2/suite/${basename}" /> <param name="tmp.test.path" value="ch/usi/dag/disl/test/suite/${basename}" />
<param name="tmp.test2.pkg" value="ch.usi.dag.disl.test2.suite.${basename}" /> <param name="tmp.test.pkg" value="ch.usi.dag.disl.test.suite.${basename}" />
<param name="tmp.test2.manifest" value="${src.test}/ch/usi/dag/disl/test2/suite/${basename}/instr/MANIFEST.MF" /> <param name="tmp.test.manifest" value="${src.test}/ch/usi/dag/disl/test/suite/${basename}/instr/MANIFEST.MF" />
</antcall> </antcall>
</sequential> </sequential>
</for> </for>
</target> </target>
<!-- copy resource files needed to run the tests from source to bin directory --> <!-- copy resource files needed to run the tests from source to bin directory -->
<target name="copy-test2-resource"> <target name="copy-test-resource">
<copy todir="${bin}"> <copy todir="${bin}">
<fileset dir="${src.test}"> <fileset dir="${src.test}">
<include name="**/*.resource" /> <include name="**/*.resource" />
...@@ -341,10 +341,10 @@ ...@@ -341,10 +341,10 @@
</copy> </copy>
</target> </target>
<target name="prepare-test2" depends="prepare-all, copy-test2-resource, package-test2" /> <target name="prepare-test" depends="prepare-all, copy-test-resource, package-test" />
<!-- run all junit and junit wrapped suite tests --> <!-- run all junit and junit wrapped suite tests -->
<target name="test2" depends="prepare-test2"> <target name="test" depends="prepare-test">
<junit haltonfailure="no" haltonerror="no" failureproperty="junit.failure"> <junit haltonfailure="no" haltonerror="no" failureproperty="junit.failure">
<classpath refid="classpath" /> <classpath refid="classpath" />
<formatter type="brief" usefile="false" /> <formatter type="brief" usefile="false" />
...@@ -354,25 +354,25 @@ ...@@ -354,25 +354,25 @@
</syspropertyset> </syspropertyset>
<batchtest fork="yes"> <batchtest fork="yes">
<fileset dir="${src.test}"> <fileset dir="${src.test}">
<include name="ch/usi/dag/disl/test2/junit/*Test.java" /> <include name="ch/usi/dag/disl/test/junit/*Test.java" />
<include name="ch/usi/dag/disl/test2/suite/*/junit/*Test.java" /> <include name="ch/usi/dag/disl/test/suite/*/junit/*Test.java" />
</fileset> </fileset>
</batchtest> </batchtest>
</junit> </junit>
</target> </target>
<target name="report-test2-name" depends="check-test2-name" unless="test2.name.set"> <target name="report-test-name" depends="check-test-name" unless="test.name.set">
<fail message="Property test2.name is not set. Set it using -Dtest2.name=value" /> <fail message="Property test.name is not set. Set it using -Dtest.name=value" />
</target> </target>
<target name="check-test2-name"> <target name="check-test-name">
<condition property="test2.name.set"> <condition property="test.name.set">
<isset property="test2.name" /> <isset property="test.name" />
</condition> </condition>
</target> </target>
<!-- run single suite test --> <!-- run single suite test -->
<target name="suite-test2" depends="prepare-test2, report-test2-name"> <target name="suite-test" depends="prepare-test, report-test-name">
<junit haltonfailure="no" haltonerror="no" failureproperty="junit.failure"> <junit haltonfailure="no" haltonerror="no" failureproperty="junit.failure">
<classpath refid="classpath" /> <classpath refid="classpath" />
<formatter type="brief" usefile="false" /> <formatter type="brief" usefile="false" />
...@@ -382,7 +382,7 @@ ...@@ -382,7 +382,7 @@
</syspropertyset> </syspropertyset>
<batchtest fork="yes"> <batchtest fork="yes">
<fileset dir="${src.test}"> <fileset dir="${src.test}">
<include name="*ch/usi/dag/disl/test2/suite/${test2.name}/junit/*Test.java" /> <include name="*ch/usi/dag/disl/test/suite/${test.name}/junit/*Test.java" />
</fileset> </fileset>
</batchtest> </batchtest>
</junit> </junit>
......
package ch.usi.dag.disl.test2.junit; package ch.usi.dag.disl.test.junit;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
......
package ch.usi.dag.disl.test2.junit; package ch.usi.dag.disl.test.junit;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
......
package ch.usi.dag.disl.test.suite.aaaexample.app;
public class TargetClass {
public static void main(String[] args) {
System.out.println("app: TargetClass.main(..)");
}
}
package ch.usi.dag.disl.test.suite.aaaexample.instr;
import ch.usi.dag.disl.annotation.After;
import ch.usi.dag.disl.marker.BodyMarker;
public class DiSLClass {
@After(marker = BodyMarker.class, scope = "TargetClass.main")
public static void after() {
System.out.println("disl: after");
}
}
package ch.usi.dag.disl.test.suite.aaaexample.junit;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import ch.usi.dag.disl.test.utils.ClientServerEvaluationRunner;
@RunWith(JUnit4.class)
public class ExampleTest {
ClientServerEvaluationRunner r = new ClientServerEvaluationRunner(this.getClass());
@Test
public void test()
throws Exception {
r.start();
r.waitFor();
r.assertIsFinished();
if (Boolean.parseBoolean(System.getProperty("disl.test.verbose"))) {
r.destroyIfRunningAndFlushOutputs();
}
r.assertIsSuccessfull();
r.assertEvaluationOut("evaluation.out.resource");
r.assertRestOutErrNull();
}
@After
public void cleanup() {
r.destroy();
}
}
package ch.usi.dag.disl.test2.suite.after.app; package ch.usi.dag.disl.test.suite.after.app;
public class TargetClass { public class TargetClass {
......
package ch.usi.dag.disl.test2.suite.after.instr; package ch.usi.dag.disl.test.suite.after.instr;
import ch.usi.dag.disl.annotation.After; import ch.usi.dag.disl.annotation.After;
import ch.usi.dag.disl.annotation.AfterThrowing; import ch.usi.dag.disl.annotation.AfterThrowing;
......
package ch.usi.dag.disl.test2.suite.after.junit; package ch.usi.dag.disl.test.suite.after.junit;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
...@@ -7,7 +7,7 @@ import org.junit.Test; ...@@ -7,7 +7,7 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
import ch.usi.dag.disl.test2.utils.ClientServerRunner; import ch.usi.dag.disl.test.utils.ClientServerRunner;
@RunWith(JUnit4.class) @RunWith(JUnit4.class)
public class AfterTest { public class AfterTest {
......
package ch.usi.dag.disl.test2.suite.after2.app; package ch.usi.dag.disl.test.suite.after2.app;
public class TargetClass { public class TargetClass {
public static void main(String[] args) { public static void main(String[] args) {
......
package ch.usi.dag.disl.test2.suite.after2.instr; package ch.usi.dag.disl.test.suite.after2.instr;
import java.util.Stack; import java.util.Stack;
...@@ -7,7 +7,7 @@ import ch.usi.dag.disl.annotation.Before; ...@@ -7,7 +7,7 @@ import ch.usi.dag.disl.annotation.Before;
import ch.usi.dag.disl.annotation.ThreadLocal; import ch.usi.dag.disl.annotation.ThreadLocal;
import ch.usi.dag.disl.marker.BodyMarker; import ch.usi.dag.disl.marker.BodyMarker;
import ch.usi.dag.disl.staticcontext.uid.UniqueMethodId; import ch.usi.dag.disl.staticcontext.uid.UniqueMethodId;
import ch.usi.dag.disl.test2.suite.after2.instr.runtime.Analysis; import ch.usi.dag.disl.test.suite.after2.instr.runtime.Analysis;
public class DiSLClass { public class DiSLClass {
@ThreadLocal @ThreadLocal
......
package ch.usi.dag.disl.test2.suite.after2.instr; package ch.usi.dag.disl.test.suite.after2.instr;
import ch.usi.dag.disl.annotation.GuardMethod; import ch.usi.dag.disl.annotation.GuardMethod;
import ch.usi.dag.disl.staticcontext.MethodStaticContext; import ch.usi.dag.disl.staticcontext.MethodStaticContext;
......
package ch.usi.dag.disl.test2.suite.after2.instr.runtime; package ch.usi.dag.disl.test.suite.after2.instr.runtime;
import java.util.Stack; import java.util.Stack;
......
package ch.usi.dag.disl.test2.suite.after2.junit; package ch.usi.dag.disl.test.suite.after2.junit;
import org.junit.After; import org.junit.After;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
import ch.usi.dag.disl.test2.utils.*; import ch.usi.dag.disl.test.utils.*;
@RunWith(JUnit4.class) @RunWith(JUnit4.class)
public class After2Test { public class After2Test {
......
package ch.usi.dag.disl.test2.suite.after3.app; package ch.usi.dag.disl.test.suite.after3.app;
public class TargetClass { public class TargetClass {
public static void main(String[] args) { public static void main(String[] args) {
......
package ch.usi.dag.disl.test2.suite.after3.instr; package ch.usi.dag.disl.test.suite.after3.instr;
import ch.usi.dag.disl.annotation.AfterReturning; import ch.usi.dag.disl.annotation.AfterReturning;
import ch.usi.dag.disl.annotation.AfterThrowing; import ch.usi.dag.disl.annotation.AfterThrowing;
......
package ch.usi.dag.disl.test2.suite.after3.junit; package ch.usi.dag.disl.test.suite.after3.junit;
import org.junit.After; import org.junit.After;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
import ch.usi.dag.disl.test2.utils.*; import ch.usi.dag.disl.test.utils.*;
@RunWith(JUnit4.class) @RunWith(JUnit4.class)
public class After3Test { public class After3Test {
......
package ch.usi.dag.disl.test2.suite.afterinit.app; package ch.usi.dag.disl.test.suite.afterinit.app;
public class TargetClass { public class TargetClass {
......
package ch.usi.dag.disl.test2.suite.afterinit.instr; package ch.usi.dag.disl.test.suite.afterinit.instr;
import ch.usi.dag.disl.annotation.After; import ch.usi.dag.disl.annotation.After;
import ch.usi.dag.disl.annotation.Before; import ch.usi.dag.disl.annotation.Before;
......
package ch.usi.dag.disl.test2.suite.afterinit.junit; package ch.usi.dag.disl.test.suite.afterinit.junit;
import org.junit.After; import org.junit.After;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
import ch.usi.dag.disl.test2.utils.*; import ch.usi.dag.disl.test.utils.*;
@RunWith(JUnit4.class) @RunWith(JUnit4.class)
public class AfterInitTest { public class AfterInitTest {
......
package ch.usi.dag.disl.test2.suite.args.app; package ch.usi.dag.disl.test.suite.args.app;
public class TargetClass { public class TargetClass {
......
package ch.usi.dag.disl.test2.suite.args.instr; package ch.usi.dag.disl.test.suite.args.instr;
import ch.usi.dag.disl.annotation.AfterReturning; import ch.usi.dag.disl.annotation.AfterReturning;
import ch.usi.dag.disl.marker.BodyMarker; import ch.usi.dag.disl.marker.BodyMarker;
......
package ch.usi.dag.disl.test2.suite.args.junit; package ch.usi.dag.disl.test.suite.args.junit;
import org.junit.After; import org.junit.After;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
import ch.usi.dag.disl.test2.utils.*; import ch.usi.dag.disl.test.utils.*;
@RunWith(JUnit4.class) @RunWith(JUnit4.class)
public class ArgsTest { public class ArgsTest {
......
app: TargetClass.main - begin app: TargetClass.main - begin
disl: args for ch/usi/dag/disl/test2/suite/args/app/TargetClass.<init> ()V disl: args for ch/usi/dag/disl/test/suite/args/app/TargetClass.<init> ()V
app: TargetClass.test_int app: TargetClass.test_int
disl: args for ch/usi/dag/disl/test2/suite/args/app/TargetClass.test_int (I)V disl: args for ch/usi/dag/disl/test/suite/args/app/TargetClass.test_int (I)V
disl: arg[0] disl: arg[0]
disl: java.lang.Integer disl: java.lang.Integer
disl: 42 disl: 42
app: TargetClass.test_Integer app: TargetClass.test_Integer
disl: args for ch/usi/dag/disl/test2/suite/args/app/TargetClass.test_Integer (Ljava/lang/Integer;)V disl: args for ch/usi/dag/disl/test/suite/args/app/TargetClass.test_Integer (Ljava/lang/Integer;)V
disl: arg[0] disl: arg[0]
disl: java.lang.Integer disl: java.lang.Integer
disl: 42 disl: 42
app: TargetClass.test_float app: TargetClass.test_float
disl: args for ch/usi/dag/disl/test2/suite/args/app/TargetClass.test_float (F)V disl: args for ch/usi/dag/disl/test/suite/args/app/TargetClass.test_float (F)V
disl: arg[0] disl: arg[0]
disl: java.lang.Float disl: java.lang.Float
disl: 42.42 disl: 42.42
app: TargetClass.test_Float app: TargetClass.test_Float
disl: args for ch/usi/dag/disl/test2/suite/args/app/TargetClass.test_Float (Ljava/lang/Float;)V disl: args for ch/usi/dag/disl/test/suite/args/app/TargetClass.test_Float (Ljava/lang/Float;)V
disl: arg[0] disl: arg[0]
disl: java.lang.Float disl: java.lang.Float
disl: 42.42 disl: 42.42
app: TargetClass.test_double app: TargetClass.test_double
disl: args for ch/usi/dag/disl/test2/suite/args/app/TargetClass.test_double (D)V disl: args for ch/usi/dag/disl/test/suite/args/app/TargetClass.test_double (D)V
disl: arg[0] disl: arg[0]
disl: java.lang.Double disl: java.lang.Double
disl: 42.42 disl: 42.42
app: TargetClass.test_Double app: TargetClass.test_Double
disl: args for ch/usi/dag/disl/test2/suite/args/app/TargetClass.test_Double (Ljava/lang/Double;)V disl: args for ch/usi/dag/disl/test/suite/args/app/TargetClass.test_Double (Ljava/lang/Double;)V
disl: arg[0] disl: arg[0]