Package: spamassassin
Version: 3.3.2-6
Severity: wishlist
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu saucy ubuntu-patch

d/tests: Added dep-8-tests


*** /tmp/tmpAnbk_C/bug_body

In Ubuntu, the attached patch was applied to achieve the following:

## Added dep-8-tests in Ubuntu to improve QA


  * d/tests: Added dep-8-tests


Thanks for considering the patch.


-- System Information:
Debian Release: wheezy/sid
  APT prefers raring-updates
  APT policy: (500, 'saucy-updates'), (500, 'saucy-security'), (500, 'saucy'), 
(100, 'saucy-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.8.0-19-generic (SMP w/4 CPU cores)
Locale: LANG=es_ES.UTF-8, LC_CTYPE=es_ES.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
=== modified file 'debian/changelog'

=== modified file 'debian/control'
--- debian/control	2012-09-07 12:05:50 +0000
+++ debian/control	2013-05-13 16:23:26 +0000
@@ -11,6 +11,7 @@
 Homepage: http://www.spamassassin.org/
 Vcs-Svn: svn://svn.debian.org/svn/collab-maint/deb-maint/spamassassin/trunk
 Vcs-Browser: http://svn.debian.org/viewsvn/collab-maint/deb-maint/spamassassin/trunk/
+XS-Testsuite: autopkgtest
 
 Package: spamassassin
 Architecture: all

=== added directory 'debian/tests'
=== added file 'debian/tests/control'
--- debian/tests/control	1970-01-01 00:00:00 +0000
+++ debian/tests/control	2013-05-09 21:13:51 +0000
@@ -0,0 +1,3 @@
+Tests: spamassassin_nospam spamassassin_spam daemon
+Depends: spamassassin
+Restrictions: needs-root

=== added file 'debian/tests/daemon'
--- debian/tests/daemon	1970-01-01 00:00:00 +0000
+++ debian/tests/daemon	2013-05-09 23:41:06 +0000
@@ -0,0 +1,20 @@
+#!/bin/bash
+#----------------------------
+# Testing spamassassin daemon
+#----------------------------
+set -e
+
+# modify /etc/default/spamassassin to enable the daemon
+CONFIG_FILE=/etc/default/spamassassin
+TMP_CONFIG_FILE=/etc/default/spamassassin.old
+sed -e "s/ENABLED=0/ENABLED=1/g" $CONFIG_FILE > $TMP_CONFIG_FILE
+mv $TMP_CONFIG_FILE $CONFIG_FILE
+/etc/init.d/spamassassin restart >/dev/null 2>&1
+
+if ps aux | grep -v "grep" | grep -q "spamd" > /dev/null; then
+    echo "OK"
+    exit 0
+else
+    echo "ERROR: SPAMD IS NOT RUNNING"
+    exit 1
+fi

=== added file 'debian/tests/get_spam_points.py'
--- debian/tests/get_spam_points.py	1970-01-01 00:00:00 +0000
+++ debian/tests/get_spam_points.py	2013-05-07 00:29:59 +0000
@@ -0,0 +1,23 @@
+import sys
+import subprocess
+
+
+if __name__ == '__main__':
+    try:
+        file_name = sys.argv[1]
+
+        # call spamassassin with the given file and return the points
+        output = subprocess.check_output("spamassassin --test-mode < " + file_name, shell=True, stderr=subprocess.STDOUT)
+        if output:
+            lines = output.split('\n')
+            if lines and lines[-4]:
+                results = lines[-4].split(' ')
+                if results and len(results)>0:
+                    points = results[0]
+                    print "%d" % round(float(points))
+                    exit()
+        print "0"
+    except Exception as e:
+        print "ERROR"
+
+

=== added file 'debian/tests/spamassassin_nospam'
--- debian/tests/spamassassin_nospam	1970-01-01 00:00:00 +0000
+++ debian/tests/spamassassin_nospam	2013-05-09 23:03:29 +0000
@@ -0,0 +1,14 @@
+#!/bin/bash
+#----------------------------
+# Testing spamassassin nospam
+#----------------------------
+set -e
+result=$(python `dirname $0`/get_spam_points.py `dirname $0`/../../sample-nonspam.txt 2>&1)
+
+if [ $result -le 0 ]; then
+    echo "OK"
+    exit 0
+else
+    echo "ERROR: POINTS SHOULD BE ZERO"
+    exit 1
+fi

=== added file 'debian/tests/spamassassin_spam'
--- debian/tests/spamassassin_spam	1970-01-01 00:00:00 +0000
+++ debian/tests/spamassassin_spam	2013-05-07 00:15:29 +0000
@@ -0,0 +1,14 @@
+#!/bin/bash
+#----------------------------
+# Testing spamassassin nospam
+#----------------------------
+set -e
+result=$(python `dirname $0`/get_spam_points.py `dirname $0`/../../sample-spam.txt 2>&1)
+
+if [ $result -gt 0 ]; then
+    echo "OK"
+    exit 0
+else
+    echo "ERROR: POINTS SHOULD BE HIGHER THAN ZERO"
+    exit 1
+fi

Reply via email to