Merge lp:~yolanda.robla/ubuntu/saucy/spamassassin/dep-8-tests into lp:ubuntu/saucy/spamassassin

Proposed by Yolanda Robla
Status: Merged
Merged at revision: 37
Proposed branch: lp:~yolanda.robla/ubuntu/saucy/spamassassin/dep-8-tests
Merge into: lp:ubuntu/saucy/spamassassin
Diff against target: 121 lines (+77/-0)
7 files modified
debian/changelog (+6/-0)
debian/control (+1/-0)
debian/tests/control (+3/-0)
debian/tests/daemon (+18/-0)
debian/tests/get_spam_points.py (+23/-0)
debian/tests/spamassassin_nospam (+13/-0)
debian/tests/spamassassin_spam (+13/-0)
To merge this branch: bzr merge lp:~yolanda.robla/ubuntu/saucy/spamassassin/dep-8-tests
Reviewer Review Type Date Requested Status
Martin Pitt Approve
James Hunt (community) Approve
Daniel Holbach Needs Fixing
Review via email: mp+162690@code.launchpad.net

Description of the change

Added dep-8-tests

To post a comment you must log in.
Revision history for this message
Daniel Holbach (dholbach) wrote :

Good work! Could you add a changelog entry in debian/changelog for the upload? It might also be a good idea to forward the change to Debian.

review: Needs Fixing
Revision history for this message
Yolanda Robla (yolanda.robla) wrote :

recheck

Revision history for this message
James Hunt (jamesodhunt) wrote :

Thanks for your work on this. A few minor style comments:

* debian/tests/daemon:
  - You could simplify the sed+mv combination in debian/tests/daemon using 'sed -i'.
  - pgrep or pidof could be used rather than the ps+grep+grep combination (although you'd need to check the depends for those commands).

Other than that, LGTM.

Revision history for this message
James Hunt (jamesodhunt) wrote :

Status update.

review: Approve
Revision history for this message
Yolanda Robla (yolanda.robla) wrote :

recheck

Revision history for this message
Martin Pitt (pitti) wrote :

I ran "run-adt-test -sS lp:~yolanda.robla/ubuntu/saucy/spamassassin/dep-8-tests spamassassin" on current saucy, which fails:

ubtree0t-spamassassin_nospam FAIL status: 1, stderr: /tmp/tmp.QdqFSdxOtW/ubtree0-ubtree/...
ubtree0t-spamassassin_spam PASS
ubtree0t-daemon PASS

$ cat ubtree0t-spamassassin_nospam-stderr
/tmp/tmp.QdqFSdxOtW/ubtree0-ubtree/debian/tests/spamassassin_nospam: line 8: [: ERROR: integer expression expected

Thanks!

review: Needs Fixing
Revision history for this message
Martin Pitt (pitti) wrote :

Please set back to "needs review" once you are done, setting to WIP now to make it disappear from the sponsoring queue.

Thanks!

Revision history for this message
Martin Pitt (pitti) wrote :

Very quick:

115 +result=$(python `dirname $0`/get_spam_points.py `dirname $0`/../../sample-spam.txt 2>&1)

This doesn't work in a set -e script, the script will abort here if the command fails.

116 +
117 +if [ $result -gt 0 ]; then

I suggest

if python `dirname $0`/get_spam_points.py `dirname $0`/../../sample-spam.txt 2>&1; then
    echo OK
else
    echo "FAIL...."
    exit 1
fi

Revision history for this message
Yolanda Robla (yolanda.robla) wrote :

Updated code according to recomendations, works for me with run-adt-test

Revision history for this message
Martin Pitt (pitti) wrote :

Thanks, works fine now!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2013-03-12 15:29:35 +0000
3+++ debian/changelog 2013-05-29 15:16:27 +0000
4@@ -1,3 +1,9 @@
5+spamassassin (3.3.2-6ubuntu2) saucy; urgency=low
6+
7+ * debian/tests: Added autopkgtests
8+
9+ -- Yolanda Robla <yolanda.robla@canonical.com> Tue, 07 May 2013 23:31:22 +0200
10+
11 spamassassin (3.3.2-6ubuntu1) raring; urgency=low
12
13 * Merge from Debian unstable. Remaining changes:
14
15=== modified file 'debian/control'
16--- debian/control 2012-09-07 12:05:50 +0000
17+++ debian/control 2013-05-29 15:16:27 +0000
18@@ -11,6 +11,7 @@
19 Homepage: http://www.spamassassin.org/
20 Vcs-Svn: svn://svn.debian.org/svn/collab-maint/deb-maint/spamassassin/trunk
21 Vcs-Browser: http://svn.debian.org/viewsvn/collab-maint/deb-maint/spamassassin/trunk/
22+XS-Testsuite: autopkgtest
23
24 Package: spamassassin
25 Architecture: all
26
27=== added directory 'debian/tests'
28=== added file 'debian/tests/control'
29--- debian/tests/control 1970-01-01 00:00:00 +0000
30+++ debian/tests/control 2013-05-29 15:16:27 +0000
31@@ -0,0 +1,3 @@
32+Tests: spamassassin_nospam spamassassin_spam daemon
33+Depends: spamassassin, procps
34+Restrictions: needs-root
35
36=== added file 'debian/tests/daemon'
37--- debian/tests/daemon 1970-01-01 00:00:00 +0000
38+++ debian/tests/daemon 2013-05-29 15:16:27 +0000
39@@ -0,0 +1,18 @@
40+#!/bin/bash
41+#----------------------------
42+# Testing spamassassin daemon
43+#----------------------------
44+set -e
45+
46+# modify /etc/default/spamassassin to enable the daemon
47+CONFIG_FILE=/etc/default/spamassassin
48+sed -i -e "s/ENABLED=0/ENABLED=1/g" $CONFIG_FILE
49+/etc/init.d/spamassassin restart >/dev/null 2>&1
50+
51+if pgrep spamd > /dev/null; then
52+ echo "OK"
53+ exit 0
54+else
55+ echo "ERROR: SPAMD IS NOT RUNNING"
56+ exit 1
57+fi
58
59=== added file 'debian/tests/get_spam_points.py'
60--- debian/tests/get_spam_points.py 1970-01-01 00:00:00 +0000
61+++ debian/tests/get_spam_points.py 2013-05-29 15:16:27 +0000
62@@ -0,0 +1,23 @@
63+import sys
64+import subprocess
65+
66+
67+if __name__ == '__main__':
68+ try:
69+ file_name = sys.argv[1]
70+
71+ # call spamassassin with the given file and return the points
72+ output = subprocess.check_output("spamassassin --test-mode < " + file_name, shell=True, stderr=subprocess.STDOUT)
73+ if output:
74+ lines = output.split('\n')
75+ if lines and lines[-4]:
76+ results = lines[-4].split(' ')
77+ if results and len(results)>0:
78+ points = results[0]
79+ print "%d" % round(float(points))
80+ exit()
81+ print "0"
82+ except Exception as e:
83+ print "ERROR"
84+
85+
86
87=== added file 'debian/tests/spamassassin_nospam'
88--- debian/tests/spamassassin_nospam 1970-01-01 00:00:00 +0000
89+++ debian/tests/spamassassin_nospam 2013-05-29 15:16:27 +0000
90@@ -0,0 +1,13 @@
91+#!/bin/bash
92+#----------------------------
93+# Testing spamassassin nospam
94+#----------------------------
95+set -e
96+
97+if python `dirname $0`/get_spam_points.py `dirname $0`/../../sample-nonspam.txt 2>&1; then
98+ echo "OK"
99+ exit 0
100+else
101+ echo "ERROR: POINTS SHOULD BE ZERO"
102+ exit 1
103+fi
104
105=== added file 'debian/tests/spamassassin_spam'
106--- debian/tests/spamassassin_spam 1970-01-01 00:00:00 +0000
107+++ debian/tests/spamassassin_spam 2013-05-29 15:16:27 +0000
108@@ -0,0 +1,13 @@
109+#!/bin/bash
110+#----------------------------
111+# Testing spamassassin nospam
112+#----------------------------
113+set -e
114+
115+if python `dirname $0`/get_spam_points.py `dirname $0`/../../sample-spam.txt 2>&1; then
116+ echo "OK"
117+ exit 0
118+else
119+ echo "ERROR: POINTS SHOULD BE HIGHER THAN ZERO"
120+ exit 1
121+fi

Subscribers

People subscribed via source and target branches

to all changes: