[mongo-java-driver] 01/01: Enable build tests

Christopher Hoskin christopher.hoskin at gmail.com
Fri Aug 19 16:09:07 UTC 2016


This is an automated email from the git hooks/post-receive script.

grinorcole-guest pushed a commit to branch master
in repository mongo-java-driver.

commit 3dfda1a47b1026788edcc89f5d6d8234a318d378
Author: Christopher Hoskin <christopher.hoskin at gmail.com>
Date:   Fri Aug 19 16:05:22 2016 +0100

    Enable build tests
---
 debian/changelog          |  1 +
 debian/control            |  4 +++-
 debian/maven.rules        |  1 +
 debian/patches/series     |  1 +
 debian/patches/test.patch | 14 ++++++++++++++
 debian/rules              |  3 +++
 debian/runtest.sh         | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 69 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 3fb4b2f..9f7be65 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,7 @@ mongo-java-driver (3.3.0-1) UNRELEASED; urgency=medium
   * Import new upstream (3.3.0)
   * Update debian/copyright
   * Switch build system from Maven to Gradle
+  * Enable build tests
 
  -- Christopher Hoskin <christopher.hoskin at gmail.com>  Fri, 19 Aug 2016 13:50:19 +0100
 
diff --git a/debian/control b/debian/control
index 0ec4bb6..632e02e 100644
--- a/debian/control
+++ b/debian/control
@@ -3,7 +3,9 @@ Section: java
 Priority: optional
 Maintainer: Debian Java Maintainers <pkg-java-maintainers at lists.alioth.debian.org>
 Uploaders: Emmanuel Bourg <ebourg at apache.org>
-Build-Depends: debhelper (>= 9), default-jdk, gradle-debian-helper, javahelper, libnetty-java
+Build-Depends: debhelper (>= 9), default-jdk, gradle-debian-helper, javahelper, libnetty-java,
+# Required for tests
+ libcodenarc-groovy-java, libspock-java, iproute2, mongodb-server
 Standards-Version: 3.9.6
 Vcs-Git: git://anonscm.debian.org/pkg-java/mongo-java-driver.git
 Vcs-Browser: http://anonscm.debian.org/cgit/pkg-java/mongo-java-driver.git
diff --git a/debian/maven.rules b/debian/maven.rules
index f86a16a..5613b2a 100644
--- a/debian/maven.rules
+++ b/debian/maven.rules
@@ -1,3 +1,4 @@
 
 junit junit jar s/4\..*/4.x/ * *
 org.mongodb mongo-java-driver bundle s/.*/debian/ * *
+com.google.code.findbugs findbugs * * * *
diff --git a/debian/patches/series b/debian/patches/series
index 5879227..7b9a1f9 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 build.patch
+test.patch
diff --git a/debian/patches/test.patch b/debian/patches/test.patch
new file mode 100644
index 0000000..f910e07
--- /dev/null
+++ b/debian/patches/test.patch
@@ -0,0 +1,14 @@
+--- a/build.gradle
++++ b/build.gradle
+@@ -270,3 +270,11 @@
+ 
+ apply from: 'gradle/deploy.gradle'
+ 
++subprojects {
++    configurations.all {
++        resolutionStrategy {
++	    force 'org.apache.commons:commons-lang3:debian'
++            force 'org.apache.bcel:bcel:debian'
++        }
++    }
++}
diff --git a/debian/rules b/debian/rules
index 5c3b520..9117402 100755
--- a/debian/rules
+++ b/debian/rules
@@ -5,5 +5,8 @@ export JAVA_HOME := /usr/lib/jvm/default-java
 %:
 	dh $@ --buildsystem=gradle --with javahelper
 
+override_dh_auto_test:
+	debian/runtest.sh
+
 get-orig-source:
 	uscan --download-current-version --force-download --rename
diff --git a/debian/runtest.sh b/debian/runtest.sh
new file mode 100755
index 0000000..1108ed5
--- /dev/null
+++ b/debian/runtest.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+set -e
+
+cleanup() {
+	echo "Cleanup"
+	if [ -x $PIDFILE ]
+	then
+		 /bin/kill `cat $(PIDFILE)`
+	fi
+	rm -rf $MONGOHOME
+	exit $RET_VAL
+}
+
+
+#if lsof -i:27017
+if [ -x /bin/ss ]; then
+	if ss -a sport = :27017 | grep 127.0.0.1:27017
+	then
+	   echo "ERROR: Cannot start mongod, port 27017 is not free."
+	   exit 1 
+	fi
+else
+	echo "ERROR: ss not found!"
+	exit 1
+fi
+
+trap cleanup EXIT
+
+RET_VAL=1	#Return an error if execution is interrupted before the end.
+MONGOHOME=`pwd`/driver-core/build/mongo
+PIDFILE=$MONGOHOME/mongod.pid
+
+
+	mkdir -p $MONGOHOME
+        if [ -x /usr/bin/mongod ]; then
+          mongod --dbpath $MONGOHOME --noprealloc --nojournal --quiet --fork --logpath $MONGOHOME/mongod.log --pidfilepath $PIDFILE --setParameter enableTestCommands=1;
+          sleep 10;
+	else
+	  echo "ERROR: Mongod not found!"
+	  exit 1
+        fi
+#	dh_auto_build -- check
+        dh_auto_build -- check -x :bson:checkstyleMain -x :bson:checkstyleTest  -x driver:checkstyleMain -x driver:checkstyleTest -x driver-core:compileTestGroovy -x driver:compileTestGroovy -x driver-async:checkstyleMain -x driver-async:checkstyleTest -x driver-async:compileTestGroovy -x driver-core:checkstyleMain -x driver-core:checkstyleTest
+	RET_VAL=$?
+        echo "Test returned $RET_VAL"
+

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/mongo-java-driver.git



More information about the pkg-java-commits mailing list