1<?xml version="1.0" encoding="UTF-8"?>
2
3<!-- test launcher file for Android Eclipse tests -->
4<project name="testsuite" default="run" basedir=".">
5    <!--The following properties should be passed into this script, set to some default value for now -->
6    <property name="eclipse.home" value="/opt/eclipse" />
7    <property name="sdk_home" value="/tmp/sdk" />
8    <property name="eclipse_test" value="${eclipse.home}/plugins/org.eclipse.test_3.2.0" />
9
10    <!-- eclipse scripts use an annoying mixture of eclipse-home and eclipse.home -->
11    <!-- lets define both...-->
12    <property name="eclipse-home" value="${eclipse.home}" />
13    <property name="test-folder" value="${eclipse.home}/test_folder" />
14
15    <!-- sets the properties eclipse.home, and library-file -->
16    <property name="plugin-name" value="com.android.ide.eclipse.tests" />
17    <property name="library-file" value="${eclipse_test}/library.xml" />
18
19    <!-- location of adt preference file (within workspace) -->
20    <property name="prefs_path" value="${test-folder}/.metadata/.plugins/org.eclipse.core.runtime/.settings/com.android.ide.eclipse.adt.prefs" />
21    <!-- location of pref template file relative to this file -->
22
23    <property name="prefs_template" value="prefs.template" />
24
25    <!-- This target holds all initialization code that needs to be done for -->
26    <!-- all tests that are to be run.         -->
27    <target name="init">
28        <tstamp />
29        <echo message="eclipse.home:  ${eclipse.home}" />
30        <echo message="libfile:  ${library-file}" />
31
32        <!-- delete test eclipse workspace -->
33        <delete dir="${test-folder}" quiet="true" />
34
35    	<!-- delete test results dir -->
36    	<delete dir="${eclipse.home}/results" quiet="true" />
37
38        <!-- Copy a preference file into the test workspace. -->
39        <!-- This is done to ensure Android SDK preference is set on startup -->
40        <copy file="${prefs_template}" tofile="${prefs_path}" />
41        <!-- replace sdk path placeholder token with actual sdk path -->
42        <replace file="${prefs_path}" token="sdk_home" value="${sdk_home}" />
43
44        <!-- if this is on windows, escape the drive and file separators -->
45        <replace file="${prefs_path}" token="\" value="\\" />
46        <replace file="${prefs_path}" token=":" value="\:" />
47    </target>
48
49    <!-- This target defines the tests that need to be run. -->
50    <target name="suite">
51        <!-- launch as ui-test ie as a test which needs Eclipse workbench -->
52        <ant target="ui-test" antfile="${library-file}" dir="${eclipse.home}">
53            <property name="data-dir" value="${test-folder}" />
54            <property name="plugin-name" value="${plugin-name}" />
55            <property name="classname" value="com.android.ide.eclipse.tests.AllTests" />
56            <!-- pass extra vm arg to set sdk_home env and test_data env variable -->
57            <property name="extraVMargs" value="-Dtest_data=${test_data}" />
58        </ant>
59    </target>
60
61    <!-- This target holds code to cleanup the testing environment after -->
62    <!-- after all of the tests have been run. You can use this target to -->
63    <!-- delete temporary files that have been created. -->
64    <target name="cleanup">
65    </target>
66
67    <!-- This target runs the test suite. Any actions that need to happen -->
68    <!-- after all the tests have been run should go here. -->
69    <target name="run" depends="init,suite,cleanup">
70        <ant target="collect" antfile="${library-file}" dir="${eclipse.home}/results">
71            <property name="includes" value="com*.xml" />
72            <property name="output-file" value="${plugin-name}.xml" />
73        </ant>
74    </target>
75</project>
76
77