Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/org.eclipse.etrice.generator.common.tests')
-rw-r--r--tests/org.eclipse.etrice.generator.common.tests/buckminster.cspec1
-rw-r--r--tests/org.eclipse.etrice.generator.common.tests/build.gradle2
-rw-r--r--tests/org.eclipse.etrice.generator.common.tests/common.xml217
-rw-r--r--tests/org.eclipse.etrice.generator.common.tests/etTest.gradle111
4 files changed, 1 insertions, 330 deletions
diff --git a/tests/org.eclipse.etrice.generator.common.tests/buckminster.cspec b/tests/org.eclipse.etrice.generator.common.tests/buckminster.cspec
deleted file mode 100644
index b9bd37b93..000000000
--- a/tests/org.eclipse.etrice.generator.common.tests/buckminster.cspec
+++ /dev/null
@@ -1 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><cs:cspec xmlns:cs="http://www.eclipse.org/buckminster/CSpec-1.0" name="org.eclipse.etrice.generator.common.tests" componentType="buckminster" version="0.5.0.qualifier"/>
diff --git a/tests/org.eclipse.etrice.generator.common.tests/build.gradle b/tests/org.eclipse.etrice.generator.common.tests/build.gradle
index 8e6530812..9fd487354 100644
--- a/tests/org.eclipse.etrice.generator.common.tests/build.gradle
+++ b/tests/org.eclipse.etrice.generator.common.tests/build.gradle
@@ -4,7 +4,7 @@ plugins {
id 'java-base'
}
-apply from: etTest
+apply from: "$rootDir/gradle/etTest.gradle"
def genericPhysical = 'models/GenericPhysical.etphys'
diff --git a/tests/org.eclipse.etrice.generator.common.tests/common.xml b/tests/org.eclipse.etrice.generator.common.tests/common.xml
deleted file mode 100644
index 63b4ab7d3..000000000
--- a/tests/org.eclipse.etrice.generator.common.tests/common.xml
+++ /dev/null
@@ -1,217 +0,0 @@
-<?xml version="1.0"?>
-<project name="org.eclipse.etrice.generator.common.tests">
-
- <target name="testing" depends="copyModels">
-
- <!-- add test here, testid==testSuiteFileName -->
- <test testid="ActorCommunicationTest" models="${models.path}/ActorCommunicationTest.room ${models.path}/GenericPhysical.etphys ${models.path}/TimingService.room" />
- <test testid="ChoicePointTest" models="${models.path}/ChoicePointTest.room ${models.path}/GenericPhysical.etphys" />
- <test testid="ChoicePointTestExtended" models="${models.path}/ChoicePointTestExtended.room ${models.path}/GenericPhysical.etphys" />
- <test testid="DataDrivenTest" models="${models.path}/DataDrivenTest.room ${models.path}/GenericPhysical.etphys ${models.path}/TimingService.room" />
- <test testid="EnumTest" models="${models.path}/EnumTest.room ${models.path}/GenericPhysical.etphys" />
- <test testid="CompileTests" models="${models.path}/CompileTests.room ${models.path}/GenericPhysical.etphys ${models.path}/DetailExpressionTest.room ${models.path}/StatemachineInterfaceTest.room ${models.path}/StatemachineInterfaceInheritedTest.room ${models.path}/StatemachineInterfaceTest.room ${models.path}/ContinuationTransitionTest.room ${models.path}/TimingService.room" />
- <test testid="HandlerTest" models="${models.path}/HandlerTest.room ${models.path}/GenericPhysical.etphys" />
- <test testid="OperationInheritanceTest" models="${models.path}/OperationInheritanceTest.room ${models.path}/GenericPhysical.etphys" />
- <test testid="PingPongThreadTest" models="${models.path}/PingPongThreadTest.etmap ${models.path}/PingPongThreadTest.room ${models.path}/TimingService.room" />
- <test testid="PingPongThreadReplPortTest" models="${models.path}/PingPongThreadReplPortTest.etmap ${models.path}/PingPongThreadReplPortTest.room ${models.path}/TimingService.room" />
-
-
- <echo>done with ${ant.project.name}</echo>
- </target>
-
- <target name="copyModels" depends="setVars">
- <copy todir="${models.path}">
- <fileset dir="../org.eclipse.etrice.generator.common.tests/models"/>
- </copy>
- <copy todir="${models.path}" >
- <fileset dir="${modellib.path}/model">
- <include name="*.room"/>
- <include name="*.etphys"/>
- </fileset>
- </copy>
- </target>
-
- <!-- ################################################################ -->
-
- <!-- global properties -->
- <!-- test.results, target.platform -->
-
- <!-- private properties-->
- <property name="models.path" value="./models"/>
- <property name="testlog.path" value="./log/testlog"/>
- <property name="output" value="./output"/>
- <property name="bin.path" value="./bin"/>
-
- <property name="run.msTimout" value="5000"/>
-
- <!-- show ALL used variables -->
- <target name="showVars">
- <echo> ant.project.name = ${ant.project.name} </echo>
- <echo> runtime.path = ${runtime.path} </echo>
- <echo> testlog.path = ${testlog.path} </echo>
- <echo> test.results = ${test.results} </echo>
- <echo> output = ${output} </echo>
- <echo> bin.path = ${bin.path} </echo>
- <echo> target.platform = ${target.platform} </echo>
- <echo> modellib.path = ${modellib.path} </echo>
- <echo> models.path = ${models.path} </echo>
- <echo> basedir = ${basedir} </echo>
-
- <echo> org.eclipse.emf.ecore = ${org.eclipse.emf.ecore} </echo>
- <echo> org.eclipse.emf.common = ${org.eclipse.emf.common} </echo>
- <echo> org.eclipse.emf.ecore.xmi = ${org.eclipse.emf.ecore.xmi} </echo>
- <echo> com.google.inject = ${com.google.inject} </echo>
- <echo> com.google.guava = ${com.google.guava} </echo>
- <echo> org.eclipse.equinox.common = ${org.eclipse.equinox.common} </echo>
- <echo> org.eclipse.xtext = ${org.eclipse.xtext} </echo>
- <echo> org.eclipse.xtext.util = ${org.eclipse.xtext.util} </echo>
- <echo> org.eclipse.xtext.common.types = ${org.eclipse.xtext.common.types} </echo>
- <echo> org.eclipse.xtend.lib = ${org.eclipse.xtend.lib} </echo>
- <echo> org.eclipse.xtext.xbase.lib = ${org.eclipse.xtext.xbase.lib} </echo>
- <echo> org.apache.log4j = ${org.apache.log4j} </echo>
- <echo> org.antlr.runtime = ${org.antlr.runtime} </echo>
- <echo> javax.inject = ${javax.inject} </echo>
-
- <pathconvert property="classpathProp" refid="etrice.clspath"/>
- <echo> etrice.clspath = ${classpathProp} </echo>
- </target>
-
- <!-- set global properties if not set-->
- <target name="set_local_tr" unless="test.results">
- <property name="test.results" value="./results"/>
- </target>
- <target name="set_local_tp" unless="target.platform">
- <property name="target.platform" value="${eclipse.home}"/>
- </target>
-
- <target name="setVars" depends="set_local_tp,set_local_tr,set_etrice_clspath,showVars"/>
-
- <target name="set_etrice_clspath">
- <path id="etrice.clspath">
- <pathelement location="../../plugins/org.eclipse.etrice.generator.c/bin"/>
- <pathelement location="../../plugins/org.eclipse.etrice.generator.java/bin"/>
- <pathelement location="../../plugins/org.eclipse.etrice.generator.cpp/bin"/>
- <pathelement location="../../plugins/org.eclipse.etrice.etunit.converter/bin"/>
- <pathelement location="../../plugins/org.eclipse.etrice.generator.config/bin"/>
- <pathelement location="../../plugins/org.eclipse.etrice.generator.doc/bin"/>
- <pathelement location="../../plugins/org.eclipse.etrice.generator.fsm/bin" />
- <pathelement location="../../plugins/org.eclipse.etrice.generator/bin"/>
- <pathelement location="../../plugins/org.eclipse.etrice.generator.gnuplot/bin"/>
- <pathelement location="../../plugins/org.eclipse.etrice.core.common/bin"/>
- <pathelement location="../../plugins/org.eclipse.etrice.core.fsm/bin" />
- <pathelement location="../../plugins/org.eclipse.etrice.core.room/bin"/>
- <pathelement location="../../plugins/org.eclipse.etrice.core.etphys/bin"/>
- <pathelement location="../../plugins/org.eclipse.etrice.core.etmap/bin"/>
- <pathelement location="../../plugins/org.eclipse.etrice.core.config/bin"/>
- <pathelement location="../../plugins/org.eclipse.etrice.core.genmodel.fsm/bin" />
- <pathelement location="../../plugins/org.eclipse.etrice.core.genmodel/bin"/>
-
- <!-- resolve dependencies using Oomph util in properties of launch config -->
- <pathelement location="${org.eclipse.emf.ecore}"/>
- <pathelement location="${org.eclipse.emf.common}"/>
- <pathelement location="${org.eclipse.emf.ecore.xmi}"/>
- <pathelement location="${com.google.inject}"/>
- <pathelement location="${com.google.guava}"/>
- <pathelement location="${org.eclipse.equinox.common}"/>
- <pathelement location="${org.eclipse.xtext}"/>
- <pathelement location="${org.eclipse.xtext.util}"/>
- <pathelement location="${org.eclipse.xtext.common.types}"/>
- <pathelement location="${org.eclipse.xtend.lib}"/>
- <pathelement location="${org.eclipse.xtext.xbase.lib}"/>
- <pathelement location="${org.apache.log4j}"/>
- <pathelement location="${org.antlr.runtime}"/>
- <pathelement location="${javax.inject}"/>
-
- <!-- resolve if used from Buckminster Ant task -->
- <fileset dir="${target.platform}/plugins/">
- <include name="org.eclipse.emf.ecore_2.1*.jar" />
- <include name="org.eclipse.emf.common_2.1*.jar" />
- <include name="org.eclipse.emf.ecore.xmi_2.1*.jar" />
- <include name="com.google.inject_*.jar" />
- <include name="com.google.guava_1*.jar" />
- <include name="org.eclipse.equinox.common_3.*.jar" />
- <include name="org.apache.log4j_1.2*.jar" />
- <include name="org.antlr.runtime_3.2*.jar" />
- <include name="javax.inject_1.0*.jar" />
-
- <!-- Xtext 2.6 -->
- <include name="org.eclipse.xtext_2.6*.jar" />
- <include name="org.eclipse.xtext.util_2.6*.jar" />
- <include name="org.eclipse.xtext.common.types_2.6*.jar" />
- <include name="org.eclipse.xtend.lib_2.6*.jar" />
- <include name="org.eclipse.xtext.xbase.lib_2.6*.jar" />
-
- <!-- Xtext 2.7 -->
- <include name="org.eclipse.xtext_2.7*.jar" />
- <include name="org.eclipse.xtext.util_2.7*.jar" />
- <include name="org.eclipse.xtext.common.types_2.7*.jar" />
- <include name="org.eclipse.xtend.lib_2.7*.jar" />
- <include name="org.eclipse.xtext.xbase.lib_2.7*.jar" />
-
- <!-- Xtext 2.8 -->
- <include name="org.eclipse.xtext_2.8*.jar" />
- <include name="org.eclipse.xtext.util_2.8*.jar" />
- <include name="org.eclipse.xtext.common.types_2.8*.jar" />
- <include name="org.eclipse.xtend.lib_2.8*.jar" />
- <include name="org.eclipse.xtext.xbase.lib_2.8*.jar" />
-
- <!-- Xtext 2.10 -->
- <include name="org.eclipse.xtext_2.10*.jar" />
- <include name="org.eclipse.xtext.util_2.10*.jar" />
- <include name="org.eclipse.xtext.common.types_2.10*.jar" />
- <include name="org.eclipse.xtend.lib_2.10*.jar" />
- <include name="org.eclipse.xtext.xbase.lib_2.10*.jar" />
- </fileset>
- </path>
- </target>
-
- <!--
- clean: deletes all folders created by this script
- -->
- <target name="clean" depends="setVars">
- <delete dir="${testlog.path}"/>
- <!--deletes resulst from other script on server <delete dir="${test.results}"/>-->
- <delete dir="${output}"/>
- <delete dir="${bin.path}"/>
- <delete dir="${models.path}"/>
- <delete dir="log"/>
- <delete dir="src-gen"/>
- </target>
-
- <macrodef name="convert">
- <attribute name="testId"/>
- <sequential>
- <java output="${output}/convert.txt" append="true" classname="org.eclipse.etrice.etunit.converter.EtUnitReportConverter" fork="true" failonerror="true">
- <arg value="-suite"/>
- <arg value="${ant.project.name}.@{testId}"/>
- <arg value="${testlog.path}/@{testId}.etu"/>
- <classpath refid="etrice.clspath"/>
- </java>
- </sequential>
- </macrodef>
-
- <macrodef name="convertPre">
- <attribute name="testId"/>
- <sequential>
- <java output="${output}/convert.txt" append="true" classname="org.eclipse.etrice.etunit.converter.EtUnitReportConverter" fork="true" failonerror="true">
- <arg value="-presuite"/>
- <arg value="${ant.project.name}."/>
- <arg value="${testlog.path}/@{testId}.etu"/>
- <classpath refid="etrice.clspath"/>
- </java>
- </sequential>
- </macrodef>
-
- <!--
- copy_results: copies the *.xml results to their final destination
- -->
- <macrodef name="copyResult">
- <attribute name="testId"/>
- <attribute name="targetId" default=""/>
- <sequential>
- <mkdir dir="${test.results}"/>
- <move file="${testlog.path}/@{testId}.xml" tofile="${test.results}/@{targetId}@{testId}.xml"/>
- </sequential>
- </macrodef>
-
-</project> \ No newline at end of file
diff --git a/tests/org.eclipse.etrice.generator.common.tests/etTest.gradle b/tests/org.eclipse.etrice.generator.common.tests/etTest.gradle
deleted file mode 100644
index 544b6f8f0..000000000
--- a/tests/org.eclipse.etrice.generator.common.tests/etTest.gradle
+++ /dev/null
@@ -1,111 +0,0 @@
-import static org.apache.tools.ant.taskdefs.condition.Os.*
-
-apply from: etGenerator
-apply from: etUnitConverter
-
-def outputDir = 'log'
-def srcGenDir = 'src-gen'
-
-clean.delete srcGenDir, outputDir
-
-def getMainClass(String genDir) {
- // search for SubSystemRunner java file
- def mainFile = fileTree(genDir, { include '**/*Runner.java' }).getSingleFile()
- // relativize path to generation directory
- def relPath = file(genDir).toPath().relativize(mainFile.toPath()).normalize().toString()
- // remove '.java' at the end
- def path = relPath.substring(0, relPath.length() - 5)
- // replace all separators with '.'
- def mainClass = path.replace(File.separatorChar, '.' as char)
- return mainClass
-}
-
-/**
- * Creates all needed tasks for one test execution
- * @param lang: The eTrice generator type ('c', 'cpp', 'java')
- * @param name: The test name starting with a lower case letter
- * @param models: Models that are passed to the eTrice generator
- * @param options: Options that are passed to the eTrice generator
- */
-ext.createTest = { lang, name, models, options = [] ->
-
- def nameCap = name.capitalize()
- def langCap = lang.capitalize()
- def testName = "$name$langCap"
- def testNameCap = testName.capitalize()
- def suiteName = "${project.name}.$testNameCap"
- def genDir = "$srcGenDir/$testName"
- def workingDir = "$outputDir/$testName"
- def etuFile = "$workingDir/log/${nameCap}.etu"
-
- def generateTask = createGeneratorTask("generate$testNameCap", lang, models, genDir, options)
- generateTask.environment 'etModellib', "org.eclipse.etrice.modellib.$lang"
-
- def runTask
-
- if(lang == 'c' || lang == 'cpp') {
- model {
- components {
- "$testName"(NativeExecutableSpec) {
- sources."$lang" {
- builtBy generateTask
- source {
- srcDirs = [genDir]
- include "**/*.$lang"
- }
- exportedHeaders {
- srcDirs = [genDir]
- }
- lib project: ":runtime:org.eclipse.etrice.modellib.$lang", library: "etrice_modellib_$lang", linkage: 'static'
- if(lang == 'cpp') lib project: ':runtime:org.eclipse.etrice.runtime.cpp', library: 'etrice_runtime_cpp', linkage: 'static'
- lib project: ':runtime:org.eclipse.etrice.runtime.c', library: 'etrice_runtime_c', linkage: 'static'
- }
- binaries.all {
- cCompiler.args '-g3'
- cppCompiler.args '-g3'
- if(isFamily(FAMILY_UNIX)) { linker.args '-lpthread', '-lrt', '-lm' }
- }
- }
- }
- }
-
- def exeFile = "$buildDir/exe/$testName/$testName"
- runTask = tasks.create(name: "run$testNameCap", type: Exec) {
- dependsOn "${testName}Executable"
- commandLine exeFile, '-run_as_test'
- inputs.file exeFile
- outputs.file etuFile
- it.workingDir = workingDir
- }
- }
-
- else if(lang == 'java') {
- def testSourceSet = sourceSets.create(name) {
- java.srcDirs = [genDir]
- }
-
- dependencies {
- add "${name}Compile", project(':runtime:org.eclipse.etrice.modellib.java')
- add "${name}Compile", project(':runtime:org.eclipse.etrice.runtime.java')
- }
-
- tasks.getByName("compile${nameCap}Java").dependsOn generateTask
-
- runTask = tasks.create(name: "run$testNameCap", type: JavaExec) {
- dependsOn "${name}Classes"
- classpath = testSourceSet.runtimeClasspath
- args '-run_as_test'
- outputs.file etuFile
- it.workingDir = workingDir
-
- doFirst { main = getMainClass(genDir) }
- }
- }
-
- runTask.doFirst { file("$workingDir/log").mkdirs() }
-
- def convertTask = createEtUnitConverterTask("convert$testNameCap", [etuFile], ['-suite', suiteName])
- convertTask.dependsOn runTask
-
- check.dependsOn tasks.create(name: testName, dependsOn: convertTask, group: 'verification')
-}

Back to the top