[devscripts] 09/14: Add test for the file exclusion feature of uscan
James McCoy
jamessan at debian.org
Thu Nov 21 03:53:46 UTC 2013
This is an automated email from the git hooks/post-receive script.
jamessan pushed a commit to branch master
in repository devscripts.
commit ec3368ccc7c4f3801f3606aa245fa31b12bd5b0e
Author: Rafael Laboissiere <rafael at laboissiere.net>
Date: Sat Nov 2 18:15:54 2013 +0100
Add test for the file exclusion feature of uscan
This test is included into the test/test_uscan file and runs under the
shunit2 framework (testFileExclusion). The file previously named
test/test_uscan is renamed as test/test_uscan_online. The
test/Makefile has been changed accordingly.
Signed-off-by: James McCoy <jamessan at debian.org>
---
debian/copyright | 2 +
test/Makefile | 3 +-
test/test_uscan | 100 +++++++++++++++++++++++---------
test/{test_uscan => test_uscan_online} | 0
4 files changed, 78 insertions(+), 27 deletions(-)
diff --git a/debian/copyright b/debian/copyright
index 515cb94..dcf0094 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -62,9 +62,11 @@ License: GPL-3
Files: doc/what-patch.1
scripts/what-patch.sh
+ test/test_uscan
Copyright: 2009, Jonathan Patrick Davies <jpds at ubuntu.com>
2006-2008, Kees Cook <kees at ubuntu.com>
2007-2008, Siegfried-Angel Gevatter Pujals <rainct at ubuntu.com>
+ 2013, Rafael Laboissiere <rafael at laboissiere.net>
License: GPL-3+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/test/Makefile b/test/Makefile
index 7b10a5c..473c68d 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -5,8 +5,9 @@ test:
./test_debchange
./test_debdiff
./test_licensecheck
+ ./test_uscan
online-test:
- ./test_uscan
+ ./test_uscan_online
.PHONY: test online-test
diff --git a/test/test_uscan b/test/test_uscan
index 47da566..fd213bc 100755
--- a/test/test_uscan
+++ b/test/test_uscan
@@ -1,38 +1,86 @@
#!/bin/sh
-# Copyright (C) 2012, Benjamin Drung <bdrung at debian.org>
+# Copyright (C) 2013, Rafael Laboissiere <rafael at laboissiere.net>
#
-# Permission to use, copy, modify, and/or distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3 of the License, or (at your
+# option) any later version.
#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# On Debian systems, the complete text of the GNU General Public License
+# version 3 can be found in the /usr/share/common-licenses/GPL-3 file.
-COMMAND="${0%/*}/../scripts/uscan.pl"
+COMMAND="$(pwd)/../scripts/uscan.pl"
-. "${0%/*}/shunit2-helper-functions.sh"
+cleanup(){
+ kill -9 $(cat $TMPDIR/repo/pid)
+ rm -rf $TMPDIR
-found() {
- runCommand "--report --watchfile ${0%/*}/uscan/$1 --package $2 --upstream-version $3" "$4" "" 0
}
-testS3Bucket() {
- local latest=$(curl -s http://s3.amazonaws.com/rds-downloads | \
- sed 's@\(</[A-Za-z]*>\)@\1\n at g' | grep '<Key>RDSCli-' | \
- sed 's at .*<Key>RDSCli-\([0-9.]*\)\.zip</Key>.*@\1 at g' | \
- sort -n | tail -n 1)
- local result="Processing watchfile line for package rdscli...
-Newest version on remote site is ${latest}, local version is 1.4.007
-rdscli: Newer version (${latest}) available on remote site:
- http://s3.amazonaws.com/rds-downloads/RDSCli-${latest}.zip
- (local version is 1.4.007)"
- found "s3bucket" "rdscli" "1.4.007" "$result"
+trap cleanup 1 2 3 13 15
+
+. "${0%/*}/shunit2-helper-functions.sh"
+
+# The following function tests the Files-Excluded feature of uscan, which
+# allows the selective exclusion of files from the upstream tarball before
+# repacking it.
+#
+# This function does the following: (1) create a minimal Debian package
+# directory, containing minimal files debian/{changelog,watch,copyright},
+# (2) create a minimal repository, containing a tarball (built on the fly),
+# (3) start an HTTP server that works offline, using the SimpleHTTPServer
+# module of Python, and (4) run uscan inside that minimal universe.
+
+testFileExclusion() {
+
+ PKG=foo
+ PORT=8000
+ TMPDIR=$(mktemp -d)
+
+ mkdir -p $TMPDIR/$PKG/debian
+
+ cat <<END > $TMPDIR/$PKG/debian/watch
+version=3
+http://localhost:$PORT/$PKG-(\d).tar.gz
+END
+
+ cat <<END > $TMPDIR/$PKG/debian/changelog
+$PKG (0-1) unstable; urgency=low
+
+ * Initial release
+
+ -- Joe Developer <jd at debian.org> Mon, 02 Nov 2013 22:21:31 -0100
+END
+
+ cat <<END > $TMPDIR/$PKG/debian/copyright
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Files-Excluded: exclude-this
+END
+
+ mkdir -p $TMPDIR/repo/$PKG
+ touch $TMPDIR/repo/$PKG/include-this
+ touch $TMPDIR/repo/$PKG/exclude-this
+
+ ( cd $TMPDIR/repo ;
+ tar cfz $PKG-1.tar.gz $PKG ;
+ python -m SimpleHTTPServer $PORT &
+ echo $! > pid )
+
+ ( cd $TMPDIR/$PKG ; $COMMAND )
+
+ TARBALL=${PKG}_1+dfsg.orig.tar.gz
+ assertTrue 'pristine tarball is not created' "[ -f $TMPDIR/$TARBALL ]"
+ assertNull 'file that must be excluded is present in the tarball' \
+ "$( tar tzf $TMPDIR/$TARBALL | grep exclude-this )"
+
+ cleanup
+
}
. shunit2
diff --git a/test/test_uscan b/test/test_uscan_online
similarity index 100%
copy from test/test_uscan
copy to test/test_uscan_online
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git
More information about the devscripts-devel
mailing list