[Pkg-privacy-commits] [tor-monitor] 05/05: add autopkgtest

Sascha Steinbiss sascha at steinbiss.name
Tue Dec 29 22:29:17 UTC 2015


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

sascha-guest pushed a commit to branch master
in repository tor-monitor.

commit 29c8efe492145df759631219ea9994cca4fa07eb
Author: Sascha Steinbiss <sascha at steinbiss.name>
Date:   Tue Dec 29 21:55:01 2015 +0000

    add autopkgtest
    
    This test runs tor-monitor as a user and checks that it can connect to a local
    Tor instance.
---
 debian/control              |  1 +
 debian/tests/check-circuits | 19 +++++++++++++++++++
 debian/tests/control        |  3 +++
 debian/tests/ldtp-test      |  7 +++++++
 debian/tests/ldtp-tor-test  | 18 ++++++++++++++++++
 5 files changed, 48 insertions(+)

diff --git a/debian/control b/debian/control
index edc5243..d8d071e 100644
--- a/debian/control
+++ b/debian/control
@@ -16,6 +16,7 @@ Build-Depends: debhelper (>= 9),
                gir1.2-glib-2.0
 X-Python3-Version: >= 3.4.2
 Standards-Version: 3.9.6
+Testsuite: autopkgtest
 Homepage: http://git-tails.immerda.ch/alan/tor-monitor
 Vcs-Git: http://anonscm.debian.org/git/pkg-privacy/packages/tor-monitor.git
 Vcs-Browser: http://anonscm.debian.org/cgit/pkg-privacy/packages/tor-monitor.git
diff --git a/debian/tests/check-circuits b/debian/tests/check-circuits
new file mode 100755
index 0000000..dacadd7
--- /dev/null
+++ b/debian/tests/check-circuits
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+import ldtp, ooldtp
+
+ldtp.launchapp('tormonitor')
+
+frm = ooldtp.context('Tor Monitor')
+frm.waittillguiexist()
+
+print(frm.getobjectlist())
+
+myitem = frm.getchild('ttbl0')
+rowcnt = myitem.getrowcount()
+
+assert(rowcnt > 0)
+
+for i in range(0,rowcnt):
+	print(myitem.getcellvalue(i, 0))
+
+ldtp.closewindow()
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..e4bd80d
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,3 @@
+Tests: ldtp-test
+Depends: @, xvfb, dbus-x11, ldtp, python-ldtp, tor
+Restrictions: needs-root, isolation-container, allow-stderr, needs-recommends
\ No newline at end of file
diff --git a/debian/tests/ldtp-test b/debian/tests/ldtp-test
new file mode 100755
index 0000000..7c87dd7
--- /dev/null
+++ b/debian/tests/ldtp-test
@@ -0,0 +1,7 @@
+#!/bin/sh
+# autopkgtest check: Run Tor Monitor and check if it lists at least one circuit
+# Author: Sascha Steinbiss <sascha at steinbiss.name>
+set -e
+
+useradd -g users -G debian-tor -m testuser
+su testuser -c debian/tests/ldtp-tor-test
\ No newline at end of file
diff --git a/debian/tests/ldtp-tor-test b/debian/tests/ldtp-tor-test
new file mode 100755
index 0000000..a67bd76
--- /dev/null
+++ b/debian/tests/ldtp-tor-test
@@ -0,0 +1,18 @@
+#!/bin/sh
+set -e
+
+printf "waiting for Tor to settle...\n"
+sleep 20
+
+# start X
+(Xvfb :5 >/dev/null 2>&1 &)
+XVFB_PID=$!
+export DISPLAY=:5
+
+# start local session D-BUS
+eval `dbus-launch`
+trap "kill $DBUS_SESSION_BUS_PID $XVFB_PID" 0 TERM QUIT INT
+export DBUS_SESSION_BUS_ADDRESS
+export XAUTHORITY=/dev/null
+
+debian/tests/check-circuits
\ No newline at end of file

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/tor-monitor.git



More information about the Pkg-privacy-commits mailing list