Skip to content

Commit

Permalink
Migrate unit tests over from SVN
Browse files Browse the repository at this point in the history
  • Loading branch information
sgtcoolguy committed Oct 6, 2009
1 parent 4b18ae6 commit a1ed227
Show file tree
Hide file tree
Showing 51 changed files with 2,145 additions and 0 deletions.
11 changes: 11 additions & 0 deletions builders/org.radrails.rails.tests.build/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.radrails.rails.tests.build</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
256 changes: 256 additions & 0 deletions builders/org.radrails.rails.tests.build/build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,256 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- ======================================================================
April 20, 2009 2:43:07 PM
rails_tests
Tests the rails_tests feature
cwilliams
====================================================================== -->
<project name="rails_tests" default="test">
<description>
Tests the rails_tests feature
</description>

<property file="build_local.properties" />

<!-- Set up EMMA location and instrumentation path -->
<path id="emma.lib">
<pathelement location="lib/emma.jar" />
<pathelement location="lib/emma_ant.jar" />
</path>
<taskdef resource="emma_ant.properties" classpathref="emma.lib" />

<path id="instrument.classpath">
<fileset dir="${baseLocation}/plugins">
<include name="org.radrails.*.jar" />
<include name="net.lucky-dip*.jar" />
<include name="com.aptana.radrails.*.jar" />
<include name="com.aptana.ide.editor.yml*.jar" />
<include name="com.aptana.ide.editor.erb*.jar" />
</fileset>
</path>

<!-- =================================
target: build
================================= -->
<target name="build" description="Builds the rails_tests feature" depends="generate.build.properties,generate.base">
<java jar="${baseLocation}/plugins/${launcher.plugin}.jar" fork="true" failonerror="yes">
<arg line="-application org.eclipse.ant.core.antRunner -buildfile ${baseLocation}/plugins/${builder.plugin}/scripts/build.xml -Dbuilder=${basedir} -Dbuild.revision=${build.revision} -nosplash" />
</java>
</target>

<!-- =================================
target: generate.build.properties
================================= -->
<target name="generate.build.properties" description="Takes in properties from build_local.properties and the command line overrides and generates a combined build.properties to use for the build">
<echoproperties destfile="build.properties">
<propertyset negate="true">
<propertyref prefix="java." />
<propertyref prefix="ant." />
<propertyref prefix="awt." />
<propertyref prefix="user." />
<propertyref prefix="sun." />
</propertyset>
</echoproperties>
</target>

<!-- =================================
target: clean
================================= -->
<target name="clean" depends="generate.build.properties" description="Clean up temp and build files">
<delete failonerror="false">
<fileset dir="${buildDirectory}" defaultexcludes="true">
<include name="assemble.*" />
<include name="finalFeaturesVersions.*" />
<include name="finalPluginsVersions.*" />
<include name="package.*" />
</fileset>
</delete>
<delete dir="${coverageDirectory}" failonerror="false" />
<delete dir="${testResultsDirectory}" failonerror="false" />
<delete dir="${buildDirectory}/${buildLabel}" failonerror="false" />
<java jar="${baseLocation}/plugins/${launcher.plugin}.jar" fork="true" failonerror="false">
<arg line="-application org.eclipse.ant.core.antRunner -buildfile ${baseLocation}/plugins/${builder.plugin}/scripts/productBuild/productBuild.xml -Dbuilder=${basedir} -nosplash clean" />
</java>
<delete dir="${baseLocation}" />
<delete dir="${buildDirectory}/features/org.eclipse.pde.build.container.feature" failonerror="false" />
<delete dir="${p2.repo.dir}" failonerror="false" />
<!-- Do an svn revert of the build directory -->
<exec executable="svn">
<arg line="revert -R ${buildDirectory}" />
</exec>
<delete file="build.properties" failonerror="false" />
</target>

<!-- - - - - - - - - - - - - - - - - -
target: clean.after
- - - - - - - - - - - - - - - - - -->
<target name="clean.after" if="cleanAfter">
<antcall target="clean" />
</target>

<!-- - - - - - - - - - - - - - - - - -
target: generate.base
- - - - - - - - - - - - - - - - - -->
<target name="generate.base" depends="copy.base.windows,copy.base">
<!-- Workaround for https://bugs.eclipse.org/241430 shouldn't be necessary when we move to 3.5 -->
<delete>
<fileset dir="${baseLocation}/configuration/.settings">
<include name="org.eclipse.equinox.p2.*.repository.prefs" />
</fileset>
</delete>
<antcall target="run.director">
<param name="p2.installIU" value="org.eclipse.gef.feature.group" />
<param name="p2.repo" value="${gef.p2.repo}" />
</antcall>
<antcall target="run.director">
<param name="p2.installIU" value="com.aptana.ide.feature.studio.feature.group" />
<param name="p2.repo" value="${studio.p2.repo}" />
</antcall>
<antcall target="run.director">
<param name="p2.installIU" value="org.radrails.rails.feature.group" />
<param name="p2.repo" value="${rails.p2.repo}" />
</antcall>
<antcall target="run.director">
<param name="p2.installIU" value="org.rubypeople.rdt.tests.feature.group" />
<param name="p2.repo" value="${rdt-test.p2.repo}" />
</antcall>
</target>

<!-- - - - - - - - - - - - - - - - - -
target: copy.base
- - - - - - - - - - - - - - - - - -->
<target name="copy.base" unless="is.windows">
<!-- Copy over the original base eclipse to a new location.
Have to use exec cp to retain permissions on *nix, Mac -->
<exec executable="cp">
<arg line="-R ${vanilla.eclipse} ${baseLocation}" />
</exec>
</target>

<!-- - - - - - - - - - - - - - - - - -
target: copy.base.windows
- - - - - - - - - - - - - - - - - -->
<target name="copy.base.windows" if="is.windows">
<copy todir="${baseLocation}">
<fileset dir="${vanilla.eclipse}" includes="**/*" defaultexcludes="false" />
</copy>
</target>

<!-- - - - - - - - - - - - - - - - - -
target: run.director
- - - - - - - - - - - - - - - - - -->
<target name="run.director" description="Runs the p2 director installs">
<java jar="${baseLocation}/plugins/${launcher.plugin}.jar" fork="true" failonerror="true" dir="${baseLocation}" timeout="900000">
<arg line="-application org.eclipse.equinox.p2.director.app.application" />
<arg line="-nosplash" />
<arg line="-consoleLog" />
<arg line="-metadataRepository ${p2.repo}" />
<arg line="-artifactRepository ${p2.repo}" />
<arg line="-installIU ${p2.installIU}" />
</java>
</target>

<target name="test" depends="build">
<antcall target="run.director">
<param name="p2.installIU" value="${topLevelElementId}.feature.group" />
<param name="p2.repo" value="${p2.artifact.repo}" />
</antcall>
<!-- Add Eclipse Testing Framework -->
<unzip src="eclipse-test-framework-3.4.2.zip" dest="${buildDirectory}/test-framework" />
<copy todir="${baseLocation}/dropins">
<fileset dir="${buildDirectory}/test-framework" defaultexcludes="false" />
</copy>
<delete dir="${buildDirectory}/test-framework" />

<!-- Modify the plugin_custimization.ini to set initial properties for tests! -->
<concat append="true" destfile="${baseLocation}/plugins/org.eclipse.sdk_3.4.2.v200902111700/plugin_customization.ini">
<filelist dir="${basedir}/prefs" files="plugin_customization.ini" />
</concat>

<!-- Instrument the code using EMMA -->
<emma enabled="true">
<instr instrpathref="instrument.classpath" mode="overwrite" metadatafile="${coverageDirectory}/metadata.emma">
<filter file="emma-filters.txt" />
</instr>
</emma>

<property name="library-file" value="${baseLocation}/dropins/eclipse/plugins/org.eclipse.test_3.2.0/library.xml" />
<!-- Run the tests. -->
<antcall target="run-core-test">
<param name="test.plugin" value="org.radrails.rails.core.tests" />
<param name="test.classname" value="org.radrails.rails.core.AllTests" />
</antcall>
<antcall target="run-core-test">
<param name="test.plugin" value="org.radrails.rails.server.core.tests" />
<param name="test.classname" value="org.radrails.rails.server.core.AllTests" />
</antcall>
<antcall target="run-ui-test">
<param name="test.plugin" value="org.radrails.rails.ui.tests" />
<param name="test.classname" value="org.radrails.rails.ui.AllTests" />
</antcall>
<antcall target="run-ui-test">
<param name="test.plugin" value="org.radrails.rails.server.ui.tests" />
<param name="test.classname" value="org.radrails.rails.server.ui.AllTests" />
</antcall>
<antcall target="run-ui-test">
<param name="test.plugin" value="com.aptana.radrails.cloud.tests" />
<param name="test.classname" value="com.aptana.radrails.cloud.AllTests" />
</antcall>

<!-- Collect all test results into single file and move to results directory. -->
<ant target="collect" antfile="${library-file}" dir="${baseLocation}">
<property name="includes" value="com*.xml" />
<property name="output-file" value="test-results.xml" />
</ant>
<move file="${baseLocation}/test-results.xml" todir="${testResultsDirectory}" />

<!-- Produce coverage analysis docs using EMMA -->
<emma enabled="true">
<report sourcepath="${instrument.classpath}">
<fileset dir="${coverageDirectory}">
<include name="*.emma" />
</fileset>

<txt outfile="${coverageDirectory}/coverage.txt" />
<html outfile="${coverageDirectory}/coverage.html" encoding="UTF-8" />
<xml outfile="${coverageDirectory}/coverage.xml" depth="method" />
</report>
</emma>

<antcall target="clean.after" />
</target>

<target name="run-ui-test">
<ant target="ui-test" antfile="${library-file}" dir="${baseLocation}">
<reference refid="emma.lib" />
<property name="extra.java-test.classpath" value="emma.lib" />
<property name="timeout" value="${test.timeout}" />
<property name="os" value="${baseos}" />
<property name="ws" value="${basews}" />
<property name="arch" value="${basearch}" />
<property name="eclipse-home" value="${baseLocation}" />
<property name="data-dir" value="${baseLocation}/junit-workspace -clean" />
<property name="plugin-name" value="${test.plugin}" />
<property name="classname" value="${test.classname}" />
<property name="extraVMargs" value="-Demma.coverage.out.file=${coverageDirectory}/coverage.emma -Dosgi.dev=${basedir}/lib/emma.jar" />
</ant>
</target>

<target name="run-core-test">
<ant target="core-test" antfile="${library-file}" dir="${baseLocation}">
<reference refid="emma.lib" />
<property name="extra.java-test.classpath" value="emma.lib" />
<property name="timeout" value="${test.timeout}" />
<property name="os" value="${baseos}" />
<property name="ws" value="${basews}" />
<property name="arch" value="${basearch}" />
<property name="eclipse-home" value="${baseLocation}" />
<property name="data-dir" value="${baseLocation}/junit-workspace -clean" />
<property name="plugin-name" value="${test.plugin}" />
<property name="classname" value="${test.classname}" />
<property name="extraVMargs" value="-Demma.coverage.out.file=${coverageDirectory}/coverage.emma -Dosgi.dev=${basedir}/lib/emma.jar" />
</ant>
</target>
</project>
Loading

0 comments on commit a1ed227

Please sign in to comment.