Package: src:vsftpd
Version: 3.0.2-14
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu utopic ubuntu-patch

Hi,

I've written the attached dep8 test for Ubuntu. This should be useful
for Debian as well to help prevent regressions in the vsftpd package.

HTH,

Robie
From 3381547f4371c972db5758a04639b9f0fbe7ee41 Mon Sep 17 00:00:00 2001
From: Robie Basak <robie.ba...@canonical.com>
Date: Tue, 29 Apr 2014 11:07:32 +0000
Subject: [PATCH]   * Add dep8 test.

---
 debian/control       |  1 +
 debian/tests/control |  6 ++++++
 debian/tests/smoke   | 45 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 52 insertions(+)
 create mode 100644 debian/tests/control
 create mode 100644 debian/tests/smoke

diff --git a/debian/control b/debian/control
index d192462..fec25ad 100644
--- a/debian/control
+++ b/debian/control
@@ -14,6 +14,7 @@ Standards-Version: 3.9.5
 Homepage: http://vsftpd.beasts.org/
 Vcs-Browser: http://daniel-baumann.ch/gitweb/?p=debian/packages/vsftpd.git
 Vcs-Git: git://daniel-baumann.ch/git/debian/packages/vsftpd.git
+XS-Testsuite: autopkgtest
 
 Package: vsftpd
 Architecture: any
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..0245c2a
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,6 @@
+# Ideally, this test should be run in both LXC and qemu environments, since
+# behaviour was shown to fail in only one environment in LP: #1219857. But we
+# do not have the ability to request this yet.
+Tests: smoke
+Depends: vsftpd
+Restrictions: needs-root allow-stderr breaks-testbed
diff --git a/debian/tests/smoke b/debian/tests/smoke
new file mode 100644
index 0000000..1bee1c0
--- /dev/null
+++ b/debian/tests/smoke
@@ -0,0 +1,45 @@
+#!/bin/sh
+set -ex
+
+# Simple smoke test for vsftpd. Tests get and put functionality.
+# Author: Robie Basak <robie.ba...@canonical.com>
+# dep8 restrictions: breaks-bestbed needs-root allow-stderr
+
+# Written in response to https://launchpad.net/bugs/1219857
+# This passed on LXC, affecting qemu only. So it is advisable to test both.
+
+# Enable writes, to test both get and put
+sed -i 's/^#\(write_enable=YES\)$/\1/' /etc/vsftpd.conf
+service vsftpd reload
+
+# Create test user
+adduser --disabled-password --gecos '' ftptest
+echo ftptest:dep8|chpasswd ftptest
+
+# Set up .netrc so that the ftp client can login in automatically
+> ~ftptest/.netrc
+chown ftptest: ~ftptest/.netrc
+chmod 600 ~ftptest/.netrc
+cat > ~ftptest/.netrc <<EOT
+machine localhost
+login ftptest
+password dep8
+EOT
+
+# Test get and put
+
+mkdir ~ftptest/local ~ftptest/remote
+echo "Hello, world! 1." > ~ftptest/local/put
+echo "Hello, world! 2." > ~ftptest/remote/get
+chown -R ftptest: ~ftptest/local ~ftptest/remote
+
+su -c 'ftp localhost' - ftptest <<EOT
+lcd local
+cd remote
+get get
+put put
+quit
+EOT
+
+cmp ~ftptest/local/put ~ftptest/remote/put
+cmp ~ftptest/local/get ~ftptest/remote/get
-- 
1.9.1

Attachment: signature.asc
Description: Digital signature

Reply via email to