Browse Source

Build the unit tests using xvfb if available.

xvfb.disable=true will allow building without, even if xvfb is found.
Fixes issue 3422

Change-Id: I012bdfc694da10eac9a5afd1346841c4164ac386
Reviewed-on: http://gerrit.dmdirc.com/328
Reviewed-by: Shane Mc Cormack <shane@dmdirc.com>
Tested-by: Shane Mc Cormack <shane@dmdirc.com>
tags/0.6.3b1
Shane Mc Cormack 15 years ago
parent
commit
f54550948c
2 changed files with 31 additions and 1 deletions
  1. 30
    0
      build-tests.xml
  2. 1
    1
      nbproject/build-impl.xml

+ 30
- 0
build-tests.xml View File

@@ -6,6 +6,7 @@
6 6
     <taskdef resource="cloverlib.xml" classpath="${clover.jar}"/>
7 7
     <taskdef resource="cloverjunitlib.xml" classpath="${clover.jar}"/>
8 8
     <available property="clover.installed" classname="com.cenqua.clover.CloverInstr" />
9
+    <available file="/usr/bin/xvfb-run" property="has.xvfb"/>
9 10
 
10 11
     <target name="with.clover" depends="clean" if="clover.installed"
11 12
             description="Set up Clover to instrument tests.">
@@ -57,6 +58,35 @@
57 58
         </junitreport>
58 59
     </target>
59 60
 
61
+    <target name="test" depends="check-use-xvfb, -test-xvfb, -test-no-xvfb"/>
62
+
63
+    <target name="check-use-xvfb">
64
+        <condition property="use.xvfb">
65
+            <and>
66
+                <not>
67
+                    <equals arg1="${xvfb.disable}" arg2="true" />
68
+                </not>
69
+                <equals arg1="${has.xvfb}" arg2="true" />
70
+            </and>
71
+        </condition>
72
+    </target>
73
+
74
+    <target name="-test-xvfb" if="use.xvfb">
75
+        <exec executable="/usr/bin/xvfb-run">
76
+            <arg value="-a"/>
77
+            <arg value="-s"/>
78
+            <arg value="-screen 0 1280x1024x24"/>
79
+            <arg value="-w"/>
80
+            <arg value="-5"/>
81
+            <arg value="/usr/bin/ant"/>
82
+            <arg value="do-real-test"/>
83
+        </exec>
84
+    </target>
85
+
86
+    <target name="-test-no-xvfb" unless="use.xvfb">
87
+        <antcall target="do-real-test"/>
88
+    </target>
89
+
60 90
     <target name="test-html" depends="with.clover,compile-test,test,clover.html,clover.snapshot"
61 91
             description="Run tests and generate a Clover HTML report."/>
62 92
     <target name="test-xml" depends="with.clover,compile-test,test,clover.xml,clover.snapshot"

+ 1
- 1
nbproject/build-impl.xml View File

@@ -650,7 +650,7 @@ is divided into following sections:
650 650
     </target>
651 651
     <target depends="init" if="have.tests" name="test-report"/>
652 652
     <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
653
-    <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
653
+    <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="do-real-test"/>
654 654
     <target depends="init" if="have.tests" name="-pre-test-run-single">
655 655
         <mkdir dir="${build.test.results.dir}"/>
656 656
     </target>

Loading…
Cancel
Save