← Back to team overview

duplicity-team team mailing list archive

[Merge] lp:~mterry/duplicity/ship-tests into lp:duplicity

 

Michael Terry has proposed merging lp:~mterry/duplicity/ship-tests into lp:duplicity with lp:~mterry/duplicity/test-reorg as a prerequisite.

Requested reviews:
  duplicity-team (duplicity-team)

For more details, see:
https://code.launchpad.net/~mterry/duplicity/ship-tests/+merge/81459

This branch ships the tests in tarballs and reorganizes the layout of shipped tarballs to allow running them.

Notable changes:
 * Ship tests in tarball
 * No longer rename duplicity/ to src/
 * Move duplicity-bin to bin/duplicity (as well as rdiffdir and their man pages)
 * Keep _librsyncmodule.c in duplicity/ and ship it's compilec.py script
 * Add bin/ to PATH when running tests, so paths don't have to code in a relative path to the binaries
-- 
https://code.launchpad.net/~mterry/duplicity/ship-tests/+merge/81459
Your team duplicity-team is requested to review the proposed merge of lp:~mterry/duplicity/ship-tests into lp:duplicity.
=== modified file 'REPO-README'
--- REPO-README	2009-08-12 19:05:52 +0000
+++ REPO-README	2011-11-07 15:14:25 +0000
@@ -11,27 +11,19 @@
 2) cd $DUP_ROOT/duplicity
 3) run "python compilec.py" to create _librsync.so
 4) cd ..
-5) run "./duplicity-bin -V". You will see "duplicity $version" instead
+5) run "./bin/duplicity -V". You will see "duplicity $version" instead
 of the normal version number. Versioning comes during the release.
 
 To run outside this directory, use PYTHONPATH to set the path. 
 
-PYTHONPATH=$DUP_ROOT duplicity-bin
+PYTHONPATH=$DUP_ROOT bin/duplicity
 
 or
 
-PYTHONPATH=$DUP_ROOT rdiffdir
+PYTHONPATH=$DUP_ROOT bin/rdiffdir
 
 
 Running the unit tests:
 -----------------------
 
-If you want to try some of tests, you first have to untar the
-testfiles.tar.gz as root (the tarball contains device files, files
-with various uid/gid, etc):
-
-cd testing; tar -xvzf testfiles.tar.gz
-
-Then run the various *test.py files, for instance:
-
-cd testing; python lazytest.py
+cd testing; ./run-tests

=== added directory 'bin'
=== renamed file 'duplicity-bin' => 'bin/duplicity'
=== renamed file 'duplicity.1' => 'bin/duplicity.1'
=== renamed file 'rdiffdir' => 'bin/rdiffdir'
=== renamed file 'rdiffdir.1' => 'bin/rdiffdir.1'
=== modified file 'dist/makedist'
--- dist/makedist	2011-08-23 18:14:17 +0000
+++ dist/makedist	2011-11-07 15:14:25 +0000
@@ -20,7 +20,7 @@
 # along with duplicity; if not, write to the Free Software Foundation,
 # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
-import os, re, shutil, time, sys
+import os, re, shutil, time, sys, subprocess
 
 SourceDir = "duplicity"
 DistDir = "dist"
@@ -66,17 +66,17 @@
         "LOG-README",
         "README",
         "tarfile-LICENSE",
-        SourceDir + "/_librsyncmodule.c",
         DistDir + "/setup.py",
         ]:
         assert not os.system("cp %s %s" % (filename, tardir)), filename
 
-    os.mkdir(os.path.join(tardir, "src"))
+    os.mkdir(os.path.join(tardir, "duplicity"))
     for filename in [
         "asyncscheduler.py",
         "backend.py",
         "collections.py",
         "commandline.py",
+        "compilec.py",
         "diffdir.py",
         "dup_temp.py",
         "dup_threading.py",
@@ -89,6 +89,7 @@
         "__init__.py",
         "lazy.py",
         "librsync.py",
+        "_librsyncmodule.c",
         "log.py",
         "manifest.py",
         "misc.py",
@@ -104,9 +105,9 @@
         "urlparse_2_5.py",
         "util.py",
         ]:
-        assert not os.system("cp %s/%s %s/src" % (SourceDir, filename, tardir)), filename
+        assert not os.system("cp %s/%s %s/duplicity" % (SourceDir, filename, tardir)), filename
 
-    os.mkdir(os.path.join(tardir, "src", "backends"))
+    os.mkdir(os.path.join(tardir, "duplicity", "backends"))
     for filename in [
         "backends/botobackend.py",
         "backends/cloudfilesbackend.py",
@@ -124,9 +125,19 @@
         "backends/webdavbackend.py",
         "backends/gdocsbackend.py",
         ]:
-        assert not os.system("cp %s/%s %s/src/backends" %
+        assert not os.system("cp %s/%s %s/duplicity/backends" %
                              (SourceDir, filename, tardir)), filename
 
+    os.mkdir(os.path.join(tardir, "testing"))
+    bzr = subprocess.Popen(["bzr", "ls", "-RV", "testing"], stdout=subprocess.PIPE)
+    testfiles = bzr.communicate()[0].split()
+    for filename in testfiles:
+        if os.path.isdir(filename):
+            os.mkdir(os.path.join(tardir, filename))
+        else:
+            assert not os.system("cp --parents %s %s" %
+                                 (filename, tardir)), filename
+
     os.mkdir(os.path.join(tardir, "po"))
     assert not os.system("cd po && ./update-pot")
     for filename in [
@@ -142,21 +153,22 @@
             assert not os.system("msgfmt po/%s.po -o %s/po/%s/duplicity.mo" % (lang, tardir, lang)), lang
     linguas.close()
 
+    os.mkdir(os.path.join(tardir, "bin"))
     VersionedCopy(os.path.join(SourceDir, "globals.py"),
-                  os.path.join(tardir, "src", "globals.py"))
-    VersionedCopy("duplicity-bin",
-                  os.path.join(tardir, "duplicity"))
-    VersionedCopy("rdiffdir",
-                  os.path.join(tardir, "rdiffdir"))
-    VersionedCopy("duplicity.1",
-                  os.path.join(tardir, "duplicity.1"))
-    VersionedCopy("rdiffdir.1",
-                  os.path.join(tardir, "rdiffdir.1"))
+                  os.path.join(tardir, "duplicity", "globals.py"))
+    VersionedCopy(os.path.join("bin", "duplicity"),
+                  os.path.join(tardir, "bin", "duplicity"))
+    VersionedCopy(os.path.join("bin", "rdiffdir"),
+                  os.path.join(tardir, "bin", "rdiffdir"))
+    VersionedCopy(os.path.join("bin", "duplicity.1"),
+                  os.path.join(tardir, "bin", "duplicity.1"))
+    VersionedCopy(os.path.join("bin", "rdiffdir.1"),
+                  os.path.join(tardir, "bin", "rdiffdir.1"))
     VersionedCopy(os.path.join(DistDir, "setup.py"),
                   os.path.join(tardir, "setup.py"))
 
     os.chmod(os.path.join(tardir, "setup.py"), 0755)
-    os.chmod(os.path.join(tardir, "rdiffdir"), 0644)
+    os.chmod(os.path.join(tardir, "bin", "rdiffdir"), 0644)
     os.system("tar -czf %s %s" % (tarfile, tardir))
     shutil.rmtree(tardir)
     return tarfile

=== modified file 'dist/makeweb'
--- dist/makeweb	2009-04-01 15:07:45 +0000
+++ dist/makeweb	2011-11-07 15:14:25 +0000
@@ -60,9 +60,9 @@
 def upload_new():
     run("scp %s %s %s bescoto@xxxxxxxxxxxxxxxxxxx:/upload/duplicity"
         % (tarball, srcrpm, i386rpm))
-    run("cp CHANGELOG duplicity.1 rdiffdir.1 %s" % (duplicity_mirror,))
-    run("rman -f html duplicity.1 > %s/duplicity.1.html" % (duplicity_mirror,))
-    run("rman -f html rdiffdir.1 > %s/rdiffdir.1.html" % (duplicity_mirror,))
+    run("cp CHANGELOG bin/duplicity.1 bin/rdiffdir.1 %s" % (duplicity_mirror,))
+    run("rman -f html bin/duplicity.1 > %s/duplicity.1.html" % (duplicity_mirror,))
+    run("rman -f html bin/rdiffdir.1 > %s/rdiffdir.1.html" % (duplicity_mirror,))
 
 def move_old():
     """Move old files from upload area to OLD directory

=== modified file 'dist/setup.py'
--- dist/setup.py	2011-10-08 16:09:27 +0000
+++ dist/setup.py	2011-11-07 15:14:25 +0000
@@ -43,8 +43,8 @@
         libdir_list = [os.path.join(LIBRSYNC_DIR, 'lib')]
 
 data_files = [('share/man/man1',
-               ['duplicity.1',
-                'rdiffdir.1']),
+               ['bin/duplicity.1',
+                'bin/rdiffdir.1']),
               ('share/doc/duplicity-%s' % version_string,
                ['COPYING',
                 'REPO-README',
@@ -75,13 +75,13 @@
       install_requires = ['filechunkio'],
       packages = ['duplicity',
                   'duplicity.backends',],
-      package_dir = {"duplicity" : "src",
-                     "duplicity.backends" : "src/backends",},
+      package_dir = {"duplicity" : "duplicity",
+                     "duplicity.backends" : "duplicity/backends",},
       ext_modules = [Extension("duplicity._librsync",
-                               ["_librsyncmodule.c"],
+                               ["duplicity/_librsyncmodule.c"],
                                include_dirs=incdir_list,
                                library_dirs=libdir_list,
                                libraries=["rsync"])],
-      scripts = ['rdiffdir', 'duplicity'],
+      scripts = ['bin/rdiffdir', 'bin/duplicity'],
       data_files = data_files,
       )

=== modified file 'po/POTFILES.in'
--- po/POTFILES.in	2011-07-27 21:18:47 +0000
+++ po/POTFILES.in	2011-11-07 15:14:25 +0000
@@ -1,7 +1,7 @@
 [encoding: UTF-8]
 
-duplicity-bin
-rdiffdir
+bin/duplicity
+bin/rdiffdir
 duplicity/_librsyncmodule.c
 duplicity/asyncscheduler.py
 duplicity/backend.py

=== modified file 'testing/manual/manual-ctrl-c-test.sh'
--- testing/manual/manual-ctrl-c-test.sh	2011-03-21 14:47:55 +0000
+++ testing/manual/manual-ctrl-c-test.sh	2011-11-07 15:14:25 +0000
@@ -11,17 +11,17 @@
 
 cd ~/workspace/duplicity-0.6-series
 echo "***** Do not disturb the control backup! "
-PASSPHRASE=foo ./duplicity-bin --exclude="**/udev/devices/*" --name=test-backup1 /lib file:///tmp/backup1
+PASSPHRASE=foo ./bin/duplicity --exclude="**/udev/devices/*" --name=test-backup1 /lib file:///tmp/backup1
 
 echo -n "***** Now hit Ctrl-C at random intervals.  Hit any key to continue... "
 read -e DUMMY
 echo
 
-trap "pkill -INT duplicity-bin" SIGINT
+trap "pkill -INT duplicity" SIGINT
 
 RC=4
 while [ "$RC" == "4" ]; do
-    PASSPHRASE=foo ./duplicity-bin --exclude="**/udev/devices/*" --name=test-backup2 -v5 /lib file:///tmp/backup2
+    PASSPHRASE=foo ./bin/duplicity --exclude="**/udev/devices/*" --name=test-backup2 -v5 /lib file:///tmp/backup2
     RC=$?
     echo "Exit == $RC"
     if [ "$RC" != "4" ] && [ "$RC" != "0" ]; then
@@ -38,8 +38,8 @@
 trap - SIGINT
 
 echo "Restoring backups..."
-PASSPHRASE=foo ./duplicity-bin --name=test-backup1 file:///tmp/backup1 /tmp/restore1
-PASSPHRASE=foo ./duplicity-bin --name=test-backup2 file:///tmp/backup2 /tmp/restore2
+PASSPHRASE=foo ./bin/duplicity --name=test-backup1 file:///tmp/backup1 /tmp/restore1
+PASSPHRASE=foo ./bin/duplicity --name=test-backup2 file:///tmp/backup2 /tmp/restore2
 
 echo "Diff between /lib and /tmp/restore1"
 diff -qr /lib /tmp/restore1 | grep -v "Only in /lib/udev/devices"

=== modified file 'testing/run-tests'
--- testing/run-tests	2011-11-07 15:14:25 +0000
+++ testing/run-tests	2011-11-07 15:14:25 +0000
@@ -29,6 +29,7 @@
 # up for 'duplicity' module and here for 'helper.py'
 export PYTHONPATH="$(dirname $THISDIR):$THISDIR/helpers"
 export GNUPGHOME="$THISDIR/gnupg"
+export PATH="$(dirname $THISDIR)/bin:$PATH"
 
 TOP_TESTS=$*
 if [ -z "$TOP_TESTS" ]; then

=== modified file 'testing/tests/badupload.py'
--- testing/tests/badupload.py	2011-11-07 15:14:25 +0000
+++ testing/tests/badupload.py	2011-11-07 15:14:25 +0000
@@ -49,7 +49,7 @@
         Run duplicity binary with given arguments and options
         """
         options.append("--archive-dir testfiles/cache")
-        cmd_list = ["../duplicity-bin"]
+        cmd_list = ["duplicity"]
         cmd_list.extend(options + ["--allow-source-mismatch"])
         cmd_list.extend(arglist)
         cmdline = " ".join(cmd_list)

=== modified file 'testing/tests/cleanuptest.py'
--- testing/tests/cleanuptest.py	2011-11-07 15:14:25 +0000
+++ testing/tests/cleanuptest.py	2011-11-07 15:14:25 +0000
@@ -56,7 +56,7 @@
         Run duplicity binary with given arguments and options
         """
         options.append("--archive-dir testfiles/cache")
-        cmd_list = ["../duplicity-bin"]
+        cmd_list = ["duplicity"]
         cmd_list.extend(options + ["--allow-source-mismatch"])
         if current_time:
             cmd_list.append("--current-time %s" % (current_time,))

=== modified file 'testing/tests/finaltest.py'
--- testing/tests/finaltest.py	2011-11-07 15:14:25 +0000
+++ testing/tests/finaltest.py	2011-11-07 15:14:25 +0000
@@ -53,7 +53,7 @@
     def run_duplicity(self, arglist, options = [], current_time = None):
         """Run duplicity binary with given arguments and options"""
         options.append("--archive-dir testfiles/cache")
-        cmd_list = ["../duplicity-bin"]
+        cmd_list = ["duplicity"]
         cmd_list.extend(options + ["--allow-source-mismatch"])
         if current_time:
             cmd_list.append("--current-time %s" % (current_time,))

=== modified file 'testing/tests/logtest.py'
--- testing/tests/logtest.py	2011-03-08 19:45:47 +0000
+++ testing/tests/logtest.py	2011-11-07 15:14:25 +0000
@@ -24,8 +24,6 @@
 class LogTest(unittest.TestCase):
     """Test machine-readable functions/classes in log.py"""
 
-    duplicity_bin = "../duplicity-bin"
-
     def setUp(self):
         assert not os.system("rm -f /tmp/duplicity.log")
 
@@ -36,7 +34,7 @@
         """Check notification of a simple error code"""
 
         # Run actual duplicity command (will fail, because no arguments passed)
-        os.system("%s --log-file=/tmp/duplicity.log >/dev/null 2>&1" % self.duplicity_bin)
+        os.system("duplicity --log-file=/tmp/duplicity.log >/dev/null 2>&1")
 
         # The format of the file should be:
         # """ERROR 2

=== modified file 'testing/tests/rdiffdirtest.py'
--- testing/tests/rdiffdirtest.py	2011-11-07 15:14:25 +0000
+++ testing/tests/rdiffdirtest.py	2011-11-07 15:14:25 +0000
@@ -44,7 +44,7 @@
 
     def run_rdiffdir(self, argstring):
         """Run rdiffdir with given arguments"""
-        self.run_cmd("../rdiffdir " + argstring)
+        self.run_cmd("rdiffdir " + argstring)
 
     def run_cycle(self, dirname_list):
         """Run diff/patch cycle on directories in dirname_list"""

=== modified file 'testing/tests/restarttest.py'
--- testing/tests/restarttest.py	2011-11-07 15:14:25 +0000
+++ testing/tests/restarttest.py	2011-11-07 15:14:25 +0000
@@ -58,7 +58,7 @@
         Run duplicity binary with given arguments and options
         """
         options.append("--archive-dir testfiles/cache")
-        cmd_list = ["../duplicity-bin"]
+        cmd_list = ["duplicity"]
         cmd_list.extend(options + ["--allow-source-mismatch"])
         if current_time:
             cmd_list.append("--current-time %s" % (current_time,))


Follow ups