[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [metrics-web/master] Added task(s) for running pgTAP tests.



commit d9b8b8f998068721e058627c350d2865e5ba42cd
Author: iwakeh <iwakeh@xxxxxxxxxxxxxx>
Date:   Wed Dec 20 13:06:59 2017 +0000

    Added task(s) for running pgTAP tests.
---
 build.xml | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/build.xml b/build.xml
index 8e85956..be9db64 100644
--- a/build.xml
+++ b/build.xml
@@ -91,6 +91,46 @@
     <patternset refid="web" />
   </patternset>
 
+  <!-- Tasks for database testing. -->
+  <target name="test-all-dbs"
+          depends="init"
+          description="Run all available database pgTAP tests." >
+    <antcall target="test-db">
+      <param name="db2test" value="ipv6servers" />
+    </antcall>
+    <antcall target="test-db">
+      <param name="db2test" value="userstats" />
+    </antcall>
+  </target>
+
+  <target name="test-db" description="A helper task for task test-all-dbs." >
+    <property name="dbtestlog" value="${basedir}/${generated}/${db2test}-sql-test.txt" />
+    <exec executable="psql"
+          dir="${generated}"
+          failonerror="false" >
+      <arg value="--output=${dbtestlog}" />
+      <arg value="--log-file=${basedir}/${generated}/all-dbs-test.log" />
+      <arg value="--quiet" />
+      <arg value="--file=${basedir}/src/test/sql/${db2test}/test-${db2test}.sql" />
+      <arg value="--dbname=${db2test}"/>
+    </exec>
+    <exec executable="grep" outputproperty="dbtestresult"
+          dir="${generated}"
+          failonerror="false" >
+      <arg value="failed" />
+      <arg value="${dbtestlog}" />
+    </exec>
+    <fail message="${dbtestresult} see ${dbtestlog} for details." >
+      <condition>
+        <not>
+          <length string="${dbtestresult}"
+                  length="0" />
+        </not>
+      </condition>
+    </fail>
+    <echo message="Tests for ${db2test} passed." />
+  </target>
+
   <!-- Create a .war file for deployment. -->
   <target name="war"
           depends="submoduleupdate,compile">

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits