dol: initial dol commit
[jump.git] / dol / test / runtests.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <project name="dol" default="all" basedir=".">
4
5   <description>
6     Ant build file to run tests.
7   </description>
8
9   <!-- directory paths -->
10   <property name="lib.dir"     location="./../../../jars"/>
11   <property name="bin.dir"     location="./../../../bin"/>
12   <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"/>
13   <property name="example.dir" location="./../../../examples"/>
14   <property name="test.dir"    location="./../../../test"/>
15
16   <property name="generator" value="HdS"/> <!-- HdS, protothread, systemC, PaF -->
17
18   <target name="all" depends="xml, checkexamples"/>
19
20   <!-- check validity of XML documents -->
21   <target name="xml">
22     <echo message="Check XML documents."/>
23     <java classname="test.test.TreeValidator"
24           dir="."
25           fork="true"
26           failonerror="true">
27       <classpath path="${jars}"/>
28       <arg line="${example.dir}/schema
29                  ${example.dir}/exampleproducerconsumer
30                  ${example.dir}/example1
31                  ${example.dir}/example2
32                  ${example.dir}/example3
33                  ${example.dir}/example4 
34                  ${example.dir}/example5 
35                  ${example.dir}/example6 
36                  ${example.dir}/example7
37                  ${example.dir}/examplesingleprocess
38                  ${example.dir}/arch"/>
39     </java>
40   </target>
41
42   <!-- compile and run examples and check agains reference output --> 
43   <macrodef name="runandcheck">
44     <attribute name="number"/>
45     <sequential>
46       <ant antfile="runexample.xml"
47            target="runexample"
48            inheritAll="false">
49         <property name="number" value="@{number}"/>
50         <property name="generator" value="${generator}"/>
51       </ant>
52
53       <copy file="example@{number}/${generator}/src/log.txt"
54             tofile="test/example@{number}log.txt"
55             overwrite="true">
56       </copy>
57
58       <copy file="${test.dir}/reference/example@{number}_${os.name}.txt"
59             tofile="test/example@{number}ref.txt"
60             overwrite="true">
61       </copy>
62
63       <java classname="test.util.Diff"
64             dir="."
65             fork="true"
66             failonerror="true">
67         <classpath path="${jars}"/>
68         <arg line="test/example@{number}ref.txt test/example@{number}log.txt "/>
69       </java>
70
71       <java classname="dol.main.Main"
72             dir="."
73             fork="true"
74             classpath="${jars}"
75             failonerror="true">
76         <arg line=" -T profile.txt -P example@{number}/example@{number}_flattened.xml -G example@{number}/example@{number}_flattened_annotated.xml"/>
77       </java>
78
79       <echo message="Successfully tested example @{number}."/>
80     </sequential>
81   </macrodef>
82
83   <!-- check all examples -->
84   <target name="checkexamples">
85     <echo message="Check examples."/>
86     <mkdir dir="test"/>
87     <runandcheck number="1"/>
88     <runandcheck number="2"/>
89     <runandcheck number="4"/>
90     <runandcheck number="6"/>
91     <runandcheck number="7"/>
92     <runandcheck number="singleprocess"/>
93     <runandcheck number="3"/>
94   </target>
95
96 </project>