Blame view

fr.femtost.disc.eclipse.sysml2vhdlams.atl/test/build.xml 4.71 KB
f902ce56c   Jean-Marie Gauthier   Commit of projects
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
  <project default="run-all-tests">
      <taskdef resource="net/sf/antcontrib/antlib.xml"
               classpath="/opt/eclipse/plugins/org.apache.ant_1.8.2.v20120109-1030/lib/ant-contrib.jar"/>
  
      <target name="run-all-tests">
          <dirset id="testModels" dir="." includes="*"/>
          <property name="prop.testModels" refid="testModels"/>
          <for list="${prop.testModels}" delimiter=";" param="testModelDirectory" keepgoing="true">
              <sequential>
                  <antcall target="run-test">
                      <param name="testModelDirectory" value="@{testModelDirectory}"/>
                  </antcall>
              </sequential>
          </for>
      </target>
  
      <target name="load-properties">
          <loadproperties srcfile="atl.properties"/>
      </target>
  
      <target name="run-test" depends="load-properties">
          <echo>Run model comparison on directory ${testModelDirectory}</echo>
  
          <fileset id="sourceFS" dir="${testModelDirectory}">
              <include name="source.sysml"/>
          </fileset>
          <property name="inModel" refid="sourceFS"/>
          <echo>Source model is ${inModel}</echo>
  
          <fileset id="expectedFS" dir="${testModelDirectory}">
              <include name="expected.vhdlams"/>
          </fileset>
          <property name="outExpectedModel" refid="expectedFS"/>
          <echo>Expected model is ${outExpectedModel}</echo>
  
          <condition property="isInModel">
              <equals arg1="${inModel}" arg2=""/>
          </condition>
          <fail if="isInModel" message="Source model find not found (source.*) in directory ${testModelDirectory}"/>
  
          <condition property="isOutExpectedModel">
              <equals arg1="${outExpectedModel}" arg2=""/>
          </condition>
          <fail if="isOutExpectedModel" message="Expected model find not found (expected.*) in directory ${testModelDirectory}"/>
  
          <!-- compute inModel and outExpectedModel from testModelDirectory -->
          <epsilon.eunit src="atl.eunit" todir="${testModelDirectory}">
              <modeltasks>
                  <epsilon.emf.loadModel name="SourceModel" modelfile="${testModelDirectory}/${inModel}" metamodeluri="${metamodel.source.nsuri}"
                                         read="true" store="false"/>
                  <epsilon.emf.loadModel name="ExpectedTargetModel" modelfile="${testModelDirectory}/${outExpectedModel}"
                                         metamodeluri="${metamodel.target.nsuri}" read="true" store="false"/>
              </modeltasks>
          </epsilon.eunit>
      </target>
  
  	<target name="run-atl" depends="load-properties">
  		<!-- Create temporary files for input and output models -->
  		<tempfile property="atl.temp.srcfile" />
  		<tempfile property="atl.temp.dstfile" />
  
  		<!-- Save input model to a file -->
  		<epsilon.storeModel model="SourceModel" target="${atl.temp.srcfile}" />
  
  		<!-- Load the metamodels and the source model -->
  		<atl.loadModel name="${metamodel.source.name}" metamodel="MOF" nsURI="${metamodel.source.nsuri}" />
  		<atl.loadModel name="${metamodel.source.name2}" metamodel="MOF" nsURI="${metamodel.source.nsuri2}" />
  		<atl.loadModel name="${metamodel.target.name}" metamodel="MOF" nsURI="${metamodel.target.nsuri}" />
  		<atl.loadModel name="SourceModel3" metamodel="${metamodel.target.name}" path="../../fr.femtost.disc.eclipse.vhdlamslibrary/library/ieee.vhdl.xmi" />
  		<atl.loadModel name="SourceModel4" metamodel="${metamodel.target.name}" path="../../fr.femtost.disc.eclipse.vhdlamslibrary/library/vhdlPrimitive.vhdl.xmi" />	
  		<atl.loadModel name="SourceModel" metamodel="${metamodel.source.name}" path="${atl.temp.srcfile}" />
  		<atl.loadModel name="SourceModel2" metamodel="${metamodel.source.name2}" path="${atl.temp.srcfile}" />
  		
  		<!-- Run ATL and save the model -->
  		<atl.launch path="${atl.transformationFile}">
  			<option name="supportUML2Stereotypes" value="false"/>
  			<option name="OPTION_CONTENT_TYPE" value="true"/>
  			<option name="allowInterModelReferences" value="true"/>
  			<option name="step" value="false"/>
  			<inmodel name="${model.source.name}" model="SourceModel" />
  			<inmodel name="${model.source.name2}" model="SourceModel2" />
  			<inmodel name="${model.source.name3}" model="SourceModel3" />
  			<inmodel name="${model.source.name4}" model="SourceModel4" />
  			<outmodel name="${model.target.name}" model="TargetModel" metamodel="${metamodel.target.name}" />
  		</atl.launch>
  		<atl.saveModel model="TargetModel" path="${atl.temp.dstfile}" derived="false" />
  
  		<!-- Load it back into the EUnit suite -->
  		<epsilon.emf.loadModel name="TargetModel" modelfile="${atl.temp.dstfile}" metamodeluri="${metamodel.target.nsuri}" read="true" store="false" />
  
  		<!-- Delete temporary files  -->
  		<delete file="${atl.temp.dstfile}" />	
  		<delete file="${atl.temp.srcfile}" />
  	</target>
  </project>