Merge lp:~mterry/duplicity/ship-tests into lp:duplicity/0.6

Proposed by Michael Terry
Status: Merged
Merged at revision: 802
Proposed branch: lp:~mterry/duplicity/ship-tests
Merge into: lp:duplicity/0.6
Prerequisite: lp:~mterry/duplicity/test-reorg
Diff against target: 346 lines (+55/-52)
13 files modified
REPO-README (+4/-12)
dist/makedist (+28/-16)
dist/makeweb (+3/-3)
dist/setup.py (+6/-6)
po/POTFILES.in (+2/-2)
testing/manual/manual-ctrl-c-test.sh (+5/-5)
testing/run-tests (+1/-0)
testing/tests/badupload.py (+1/-1)
testing/tests/cleanuptest.py (+1/-1)
testing/tests/finaltest.py (+1/-1)
testing/tests/logtest.py (+1/-3)
testing/tests/rdiffdirtest.py (+1/-1)
testing/tests/restarttest.py (+1/-1)
To merge this branch: bzr merge lp:~mterry/duplicity/ship-tests
Reviewer Review Type Date Requested Status
duplicity-team Pending
Review via email: mp+81459@code.launchpad.net

Description of the change

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

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'REPO-README'
2--- REPO-README 2009-08-12 19:05:52 +0000
3+++ REPO-README 2011-11-07 15:14:25 +0000
4@@ -11,27 +11,19 @@
5 2) cd $DUP_ROOT/duplicity
6 3) run "python compilec.py" to create _librsync.so
7 4) cd ..
8-5) run "./duplicity-bin -V". You will see "duplicity $version" instead
9+5) run "./bin/duplicity -V". You will see "duplicity $version" instead
10 of the normal version number. Versioning comes during the release.
11
12 To run outside this directory, use PYTHONPATH to set the path.
13
14-PYTHONPATH=$DUP_ROOT duplicity-bin
15+PYTHONPATH=$DUP_ROOT bin/duplicity
16
17 or
18
19-PYTHONPATH=$DUP_ROOT rdiffdir
20+PYTHONPATH=$DUP_ROOT bin/rdiffdir
21
22
23 Running the unit tests:
24 -----------------------
25
26-If you want to try some of tests, you first have to untar the
27-testfiles.tar.gz as root (the tarball contains device files, files
28-with various uid/gid, etc):
29-
30-cd testing; tar -xvzf testfiles.tar.gz
31-
32-Then run the various *test.py files, for instance:
33-
34-cd testing; python lazytest.py
35+cd testing; ./run-tests
36
37=== added directory 'bin'
38=== renamed file 'duplicity-bin' => 'bin/duplicity'
39=== renamed file 'duplicity.1' => 'bin/duplicity.1'
40=== renamed file 'rdiffdir' => 'bin/rdiffdir'
41=== renamed file 'rdiffdir.1' => 'bin/rdiffdir.1'
42=== modified file 'dist/makedist'
43--- dist/makedist 2011-08-23 18:14:17 +0000
44+++ dist/makedist 2011-11-07 15:14:25 +0000
45@@ -20,7 +20,7 @@
46 # along with duplicity; if not, write to the Free Software Foundation,
47 # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
48
49-import os, re, shutil, time, sys
50+import os, re, shutil, time, sys, subprocess
51
52 SourceDir = "duplicity"
53 DistDir = "dist"
54@@ -66,17 +66,17 @@
55 "LOG-README",
56 "README",
57 "tarfile-LICENSE",
58- SourceDir + "/_librsyncmodule.c",
59 DistDir + "/setup.py",
60 ]:
61 assert not os.system("cp %s %s" % (filename, tardir)), filename
62
63- os.mkdir(os.path.join(tardir, "src"))
64+ os.mkdir(os.path.join(tardir, "duplicity"))
65 for filename in [
66 "asyncscheduler.py",
67 "backend.py",
68 "collections.py",
69 "commandline.py",
70+ "compilec.py",
71 "diffdir.py",
72 "dup_temp.py",
73 "dup_threading.py",
74@@ -89,6 +89,7 @@
75 "__init__.py",
76 "lazy.py",
77 "librsync.py",
78+ "_librsyncmodule.c",
79 "log.py",
80 "manifest.py",
81 "misc.py",
82@@ -104,9 +105,9 @@
83 "urlparse_2_5.py",
84 "util.py",
85 ]:
86- assert not os.system("cp %s/%s %s/src" % (SourceDir, filename, tardir)), filename
87+ assert not os.system("cp %s/%s %s/duplicity" % (SourceDir, filename, tardir)), filename
88
89- os.mkdir(os.path.join(tardir, "src", "backends"))
90+ os.mkdir(os.path.join(tardir, "duplicity", "backends"))
91 for filename in [
92 "backends/botobackend.py",
93 "backends/cloudfilesbackend.py",
94@@ -124,9 +125,19 @@
95 "backends/webdavbackend.py",
96 "backends/gdocsbackend.py",
97 ]:
98- assert not os.system("cp %s/%s %s/src/backends" %
99+ assert not os.system("cp %s/%s %s/duplicity/backends" %
100 (SourceDir, filename, tardir)), filename
101
102+ os.mkdir(os.path.join(tardir, "testing"))
103+ bzr = subprocess.Popen(["bzr", "ls", "-RV", "testing"], stdout=subprocess.PIPE)
104+ testfiles = bzr.communicate()[0].split()
105+ for filename in testfiles:
106+ if os.path.isdir(filename):
107+ os.mkdir(os.path.join(tardir, filename))
108+ else:
109+ assert not os.system("cp --parents %s %s" %
110+ (filename, tardir)), filename
111+
112 os.mkdir(os.path.join(tardir, "po"))
113 assert not os.system("cd po && ./update-pot")
114 for filename in [
115@@ -142,21 +153,22 @@
116 assert not os.system("msgfmt po/%s.po -o %s/po/%s/duplicity.mo" % (lang, tardir, lang)), lang
117 linguas.close()
118
119+ os.mkdir(os.path.join(tardir, "bin"))
120 VersionedCopy(os.path.join(SourceDir, "globals.py"),
121- os.path.join(tardir, "src", "globals.py"))
122- VersionedCopy("duplicity-bin",
123- os.path.join(tardir, "duplicity"))
124- VersionedCopy("rdiffdir",
125- os.path.join(tardir, "rdiffdir"))
126- VersionedCopy("duplicity.1",
127- os.path.join(tardir, "duplicity.1"))
128- VersionedCopy("rdiffdir.1",
129- os.path.join(tardir, "rdiffdir.1"))
130+ os.path.join(tardir, "duplicity", "globals.py"))
131+ VersionedCopy(os.path.join("bin", "duplicity"),
132+ os.path.join(tardir, "bin", "duplicity"))
133+ VersionedCopy(os.path.join("bin", "rdiffdir"),
134+ os.path.join(tardir, "bin", "rdiffdir"))
135+ VersionedCopy(os.path.join("bin", "duplicity.1"),
136+ os.path.join(tardir, "bin", "duplicity.1"))
137+ VersionedCopy(os.path.join("bin", "rdiffdir.1"),
138+ os.path.join(tardir, "bin", "rdiffdir.1"))
139 VersionedCopy(os.path.join(DistDir, "setup.py"),
140 os.path.join(tardir, "setup.py"))
141
142 os.chmod(os.path.join(tardir, "setup.py"), 0755)
143- os.chmod(os.path.join(tardir, "rdiffdir"), 0644)
144+ os.chmod(os.path.join(tardir, "bin", "rdiffdir"), 0644)
145 os.system("tar -czf %s %s" % (tarfile, tardir))
146 shutil.rmtree(tardir)
147 return tarfile
148
149=== modified file 'dist/makeweb'
150--- dist/makeweb 2009-04-01 15:07:45 +0000
151+++ dist/makeweb 2011-11-07 15:14:25 +0000
152@@ -60,9 +60,9 @@
153 def upload_new():
154 run("scp %s %s %s bescoto@savannah.nongnu.org:/upload/duplicity"
155 % (tarball, srcrpm, i386rpm))
156- run("cp CHANGELOG duplicity.1 rdiffdir.1 %s" % (duplicity_mirror,))
157- run("rman -f html duplicity.1 > %s/duplicity.1.html" % (duplicity_mirror,))
158- run("rman -f html rdiffdir.1 > %s/rdiffdir.1.html" % (duplicity_mirror,))
159+ run("cp CHANGELOG bin/duplicity.1 bin/rdiffdir.1 %s" % (duplicity_mirror,))
160+ run("rman -f html bin/duplicity.1 > %s/duplicity.1.html" % (duplicity_mirror,))
161+ run("rman -f html bin/rdiffdir.1 > %s/rdiffdir.1.html" % (duplicity_mirror,))
162
163 def move_old():
164 """Move old files from upload area to OLD directory
165
166=== modified file 'dist/setup.py'
167--- dist/setup.py 2011-10-08 16:09:27 +0000
168+++ dist/setup.py 2011-11-07 15:14:25 +0000
169@@ -43,8 +43,8 @@
170 libdir_list = [os.path.join(LIBRSYNC_DIR, 'lib')]
171
172 data_files = [('share/man/man1',
173- ['duplicity.1',
174- 'rdiffdir.1']),
175+ ['bin/duplicity.1',
176+ 'bin/rdiffdir.1']),
177 ('share/doc/duplicity-%s' % version_string,
178 ['COPYING',
179 'REPO-README',
180@@ -75,13 +75,13 @@
181 install_requires = ['filechunkio'],
182 packages = ['duplicity',
183 'duplicity.backends',],
184- package_dir = {"duplicity" : "src",
185- "duplicity.backends" : "src/backends",},
186+ package_dir = {"duplicity" : "duplicity",
187+ "duplicity.backends" : "duplicity/backends",},
188 ext_modules = [Extension("duplicity._librsync",
189- ["_librsyncmodule.c"],
190+ ["duplicity/_librsyncmodule.c"],
191 include_dirs=incdir_list,
192 library_dirs=libdir_list,
193 libraries=["rsync"])],
194- scripts = ['rdiffdir', 'duplicity'],
195+ scripts = ['bin/rdiffdir', 'bin/duplicity'],
196 data_files = data_files,
197 )
198
199=== modified file 'po/POTFILES.in'
200--- po/POTFILES.in 2011-07-27 21:18:47 +0000
201+++ po/POTFILES.in 2011-11-07 15:14:25 +0000
202@@ -1,7 +1,7 @@
203 [encoding: UTF-8]
204
205-duplicity-bin
206-rdiffdir
207+bin/duplicity
208+bin/rdiffdir
209 duplicity/_librsyncmodule.c
210 duplicity/asyncscheduler.py
211 duplicity/backend.py
212
213=== modified file 'testing/manual/manual-ctrl-c-test.sh'
214--- testing/manual/manual-ctrl-c-test.sh 2011-03-21 14:47:55 +0000
215+++ testing/manual/manual-ctrl-c-test.sh 2011-11-07 15:14:25 +0000
216@@ -11,17 +11,17 @@
217
218 cd ~/workspace/duplicity-0.6-series
219 echo "***** Do not disturb the control backup! "
220-PASSPHRASE=foo ./duplicity-bin --exclude="**/udev/devices/*" --name=test-backup1 /lib file:///tmp/backup1
221+PASSPHRASE=foo ./bin/duplicity --exclude="**/udev/devices/*" --name=test-backup1 /lib file:///tmp/backup1
222
223 echo -n "***** Now hit Ctrl-C at random intervals. Hit any key to continue... "
224 read -e DUMMY
225 echo
226
227-trap "pkill -INT duplicity-bin" SIGINT
228+trap "pkill -INT duplicity" SIGINT
229
230 RC=4
231 while [ "$RC" == "4" ]; do
232- PASSPHRASE=foo ./duplicity-bin --exclude="**/udev/devices/*" --name=test-backup2 -v5 /lib file:///tmp/backup2
233+ PASSPHRASE=foo ./bin/duplicity --exclude="**/udev/devices/*" --name=test-backup2 -v5 /lib file:///tmp/backup2
234 RC=$?
235 echo "Exit == $RC"
236 if [ "$RC" != "4" ] && [ "$RC" != "0" ]; then
237@@ -38,8 +38,8 @@
238 trap - SIGINT
239
240 echo "Restoring backups..."
241-PASSPHRASE=foo ./duplicity-bin --name=test-backup1 file:///tmp/backup1 /tmp/restore1
242-PASSPHRASE=foo ./duplicity-bin --name=test-backup2 file:///tmp/backup2 /tmp/restore2
243+PASSPHRASE=foo ./bin/duplicity --name=test-backup1 file:///tmp/backup1 /tmp/restore1
244+PASSPHRASE=foo ./bin/duplicity --name=test-backup2 file:///tmp/backup2 /tmp/restore2
245
246 echo "Diff between /lib and /tmp/restore1"
247 diff -qr /lib /tmp/restore1 | grep -v "Only in /lib/udev/devices"
248
249=== modified file 'testing/run-tests'
250--- testing/run-tests 2011-11-07 15:14:25 +0000
251+++ testing/run-tests 2011-11-07 15:14:25 +0000
252@@ -29,6 +29,7 @@
253 # up for 'duplicity' module and here for 'helper.py'
254 export PYTHONPATH="$(dirname $THISDIR):$THISDIR/helpers"
255 export GNUPGHOME="$THISDIR/gnupg"
256+export PATH="$(dirname $THISDIR)/bin:$PATH"
257
258 TOP_TESTS=$*
259 if [ -z "$TOP_TESTS" ]; then
260
261=== modified file 'testing/tests/badupload.py'
262--- testing/tests/badupload.py 2011-11-07 15:14:25 +0000
263+++ testing/tests/badupload.py 2011-11-07 15:14:25 +0000
264@@ -49,7 +49,7 @@
265 Run duplicity binary with given arguments and options
266 """
267 options.append("--archive-dir testfiles/cache")
268- cmd_list = ["../duplicity-bin"]
269+ cmd_list = ["duplicity"]
270 cmd_list.extend(options + ["--allow-source-mismatch"])
271 cmd_list.extend(arglist)
272 cmdline = " ".join(cmd_list)
273
274=== modified file 'testing/tests/cleanuptest.py'
275--- testing/tests/cleanuptest.py 2011-11-07 15:14:25 +0000
276+++ testing/tests/cleanuptest.py 2011-11-07 15:14:25 +0000
277@@ -56,7 +56,7 @@
278 Run duplicity binary with given arguments and options
279 """
280 options.append("--archive-dir testfiles/cache")
281- cmd_list = ["../duplicity-bin"]
282+ cmd_list = ["duplicity"]
283 cmd_list.extend(options + ["--allow-source-mismatch"])
284 if current_time:
285 cmd_list.append("--current-time %s" % (current_time,))
286
287=== modified file 'testing/tests/finaltest.py'
288--- testing/tests/finaltest.py 2011-11-07 15:14:25 +0000
289+++ testing/tests/finaltest.py 2011-11-07 15:14:25 +0000
290@@ -53,7 +53,7 @@
291 def run_duplicity(self, arglist, options = [], current_time = None):
292 """Run duplicity binary with given arguments and options"""
293 options.append("--archive-dir testfiles/cache")
294- cmd_list = ["../duplicity-bin"]
295+ cmd_list = ["duplicity"]
296 cmd_list.extend(options + ["--allow-source-mismatch"])
297 if current_time:
298 cmd_list.append("--current-time %s" % (current_time,))
299
300=== modified file 'testing/tests/logtest.py'
301--- testing/tests/logtest.py 2011-03-08 19:45:47 +0000
302+++ testing/tests/logtest.py 2011-11-07 15:14:25 +0000
303@@ -24,8 +24,6 @@
304 class LogTest(unittest.TestCase):
305 """Test machine-readable functions/classes in log.py"""
306
307- duplicity_bin = "../duplicity-bin"
308-
309 def setUp(self):
310 assert not os.system("rm -f /tmp/duplicity.log")
311
312@@ -36,7 +34,7 @@
313 """Check notification of a simple error code"""
314
315 # Run actual duplicity command (will fail, because no arguments passed)
316- os.system("%s --log-file=/tmp/duplicity.log >/dev/null 2>&1" % self.duplicity_bin)
317+ os.system("duplicity --log-file=/tmp/duplicity.log >/dev/null 2>&1")
318
319 # The format of the file should be:
320 # """ERROR 2
321
322=== modified file 'testing/tests/rdiffdirtest.py'
323--- testing/tests/rdiffdirtest.py 2011-11-07 15:14:25 +0000
324+++ testing/tests/rdiffdirtest.py 2011-11-07 15:14:25 +0000
325@@ -44,7 +44,7 @@
326
327 def run_rdiffdir(self, argstring):
328 """Run rdiffdir with given arguments"""
329- self.run_cmd("../rdiffdir " + argstring)
330+ self.run_cmd("rdiffdir " + argstring)
331
332 def run_cycle(self, dirname_list):
333 """Run diff/patch cycle on directories in dirname_list"""
334
335=== modified file 'testing/tests/restarttest.py'
336--- testing/tests/restarttest.py 2011-11-07 15:14:25 +0000
337+++ testing/tests/restarttest.py 2011-11-07 15:14:25 +0000
338@@ -58,7 +58,7 @@
339 Run duplicity binary with given arguments and options
340 """
341 options.append("--archive-dir testfiles/cache")
342- cmd_list = ["../duplicity-bin"]
343+ cmd_list = ["duplicity"]
344 cmd_list.extend(options + ["--allow-source-mismatch"])
345 if current_time:
346 cmd_list.append("--current-time %s" % (current_time,))

Subscribers

People subscribed via source and target branches

to all changes: