dol: initial dol commit
[jump.git] / dol / test / runtests.xml
diff --git a/dol/test/runtests.xml b/dol/test/runtests.xml
new file mode 100644 (file)
index 0000000..f6578e9
--- /dev/null
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project name="dol" default="all" basedir=".">
+
+  <description>
+    Ant build file to run tests.
+  </description>
+
+  <!-- directory paths -->
+  <property name="lib.dir"     location="./../../../jars"/>
+  <property name="bin.dir"     location="./../../../bin"/>
+  <property name="jars"        value=".:./..:${lib.dir}/dol.jar:${lib.dir}/xercesImpl.jar:${lib.dir}/jdom.jar:${bin.dir}/dol.jar:${bin.dir}/xercesImpl.jar:${bin.dir}/jdom.jar"/>
+  <property name="example.dir" location="./../../../examples"/>
+  <property name="test.dir"    location="./../../../test"/>
+
+  <property name="generator" value="HdS"/> <!-- HdS, protothread, systemC, PaF -->
+
+  <target name="all" depends="xml, checkexamples"/>
+
+  <!-- check validity of XML documents -->
+  <target name="xml">
+    <echo message="Check XML documents."/>
+    <java classname="test.test.TreeValidator"
+          dir="."
+          fork="true"
+          failonerror="true">
+      <classpath path="${jars}"/>
+      <arg line="${example.dir}/schema
+                 ${example.dir}/exampleproducerconsumer
+                 ${example.dir}/example1
+                 ${example.dir}/example2
+                 ${example.dir}/example3
+                 ${example.dir}/example4 
+                 ${example.dir}/example5 
+                 ${example.dir}/example6 
+                 ${example.dir}/example7
+                 ${example.dir}/examplesingleprocess
+                 ${example.dir}/arch"/>
+    </java>
+  </target>
+
+  <!-- compile and run examples and check agains reference output --> 
+  <macrodef name="runandcheck">
+    <attribute name="number"/>
+    <sequential>
+      <ant antfile="runexample.xml"
+           target="runexample"
+           inheritAll="false">
+        <property name="number" value="@{number}"/>
+        <property name="generator" value="${generator}"/>
+      </ant>
+
+      <copy file="example@{number}/${generator}/src/log.txt"
+            tofile="test/example@{number}log.txt"
+            overwrite="true">
+      </copy>
+
+      <copy file="${test.dir}/reference/example@{number}_${os.name}.txt"
+            tofile="test/example@{number}ref.txt"
+            overwrite="true">
+      </copy>
+
+      <java classname="test.util.Diff"
+            dir="."
+            fork="true"
+            failonerror="true">
+        <classpath path="${jars}"/>
+        <arg line="test/example@{number}ref.txt test/example@{number}log.txt "/>
+      </java>
+
+      <java classname="dol.main.Main"
+            dir="."
+            fork="true"
+            classpath="${jars}"
+            failonerror="true">
+        <arg line=" -T profile.txt -P example@{number}/example@{number}_flattened.xml -G example@{number}/example@{number}_flattened_annotated.xml"/>
+      </java>
+
+      <echo message="Successfully tested example @{number}."/>
+    </sequential>
+  </macrodef>
+
+  <!-- check all examples -->
+  <target name="checkexamples">
+    <echo message="Check examples."/>
+    <mkdir dir="test"/>
+    <runandcheck number="1"/>
+    <runandcheck number="2"/>
+    <runandcheck number="4"/>
+    <runandcheck number="6"/>
+    <runandcheck number="7"/>
+    <runandcheck number="singleprocess"/>
+    <runandcheck number="3"/>
+  </target>
+
+</project>