Browse code

* s3cmd: Added --(no-)check-md5 for [sync]. * run-tests.py, testsuite.tar.gz: Added testsuite for the above. * NEWS: Document the above.

git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3cmd/trunk@459 830e0280-6d2a-0410-9c65-932aecc39d9d

Michal Ludvig authored on 2010/12/23 22:24:24
Showing 4 changed files
... ...
@@ -1,6 +1,9 @@
1 1
 2010-12-24  Michal Ludvig  <mludvig@logix.net.nz>
2 2
 
3 3
 	* s3cmd: Added --(no-)check-md5 for [sync].
4
+	* run-tests.py, testsuite.tar.gz: Added testsuite for
5
+	  the above.
6
+	* NEWS: Document the above.
4 7
 	* s3cmd: Don't crash when file disappears before
5 8
 	  checking MD5.
6 9
 
... ...
@@ -1,3 +1,7 @@
1
+s3cmd 1.0.0
2
+===========
3
+* [sync] now supports --no-check-md5
4
+
1 5
 s3cmd 1.0.0-rc2 -  2010-12-09
2 6
 ===============
3 7
 * [sync] now supports bucket-to-bucket synchronisation
... ...
@@ -189,6 +189,18 @@ def test_flushdir(label, dir_name):
189 189
 	test_rmdir(label + "(rm)", dir_name)
190 190
 	return test_mkdir(label + "(mk)", dir_name)
191 191
 
192
+def test_copy(label, src_file, dst_file):
193
+	if os.name == "posix":
194
+		cmd = ['cp', '-f']
195
+	elif os.name == "nt":
196
+		cmd = ['copy']
197
+	else:
198
+		print "Unknown platform: %s" % os.name
199
+		sys.exit(1)
200
+	cmd.append(src_file)
201
+	cmd.append(dst_file)
202
+	return test(label, cmd)
203
+
192 204
 try:
193 205
 	pwd = pwd.getpwuid(os.getuid())
194 206
 	bucket_prefix = "%s.%s-" % (pwd.pw_name, pwd.pw_uid)
... ...
@@ -287,6 +299,19 @@ if have_encoding:
287 287
 		must_find = [ u"File 'testsuite/encodings/%(encoding)s/%(pattern)s' stored as '%(pbucket)s/xyz/encodings/%(encoding)s/%(pattern)s'" % { 'encoding' : encoding, 'pattern' : enc_pattern , 'pbucket' : pbucket(1)} ])
288 288
 
289 289
 
290
+## ====== Don't check MD5 sum on Sync
291
+test_copy("Change file cksum1.txt", "testsuite/checksum/cksum2.txt", "testsuite/checksum/cksum1.txt")
292
+test_copy("Change file cksum33.txt", "testsuite/checksum/cksum2.txt", "testsuite/checksum/cksum33.txt")
293
+test_s3cmd("Don't check MD5", ['sync', 'testsuite/', 's3://%s/xyz/' % bucket(1), '--no-encrypt', '--no-check-md5'],
294
+	must_find = [ "cksum33.txt" ],
295
+	must_not_find = [ "cksum1.txt" ])
296
+
297
+
298
+## ====== Check MD5 sum on Sync
299
+test_s3cmd("Check MD5", ['sync', 'testsuite/', 's3://%s/xyz/' % bucket(1), '--no-encrypt', '--check-md5'],
300
+	must_find = [ "cksum1.txt" ])
301
+
302
+
290 303
 ## ====== List bucket content
291 304
 test_s3cmd("List bucket content", ['ls', '%s/xyz/' % pbucket(1) ],
292 305
 	must_find_re = [ u"DIR   %s/xyz/binary/$" % pbucket(1) , u"DIR   %s/xyz/etc/$" % pbucket(1) ],
... ...
@@ -375,7 +400,6 @@ test_s3cmd("Sync more to S3", ['sync', 'testsuite/', 's3://%s/xyz/' % bucket(1),
375 375
 	must_not_find = [ "File 'testsuite/etc/linked.png' stored as '%s/xyz/etc/linked.png" % pbucket(1) ])
376 376
            
377 377
 
378
-
379 378
 ## ====== Rename within S3
380 379
 test_s3cmd("Rename within S3", ['mv', '%s/xyz/etc/logo.png' % pbucket(1), '%s/xyz/etc2/Logo.PNG' % pbucket(1)],
381 380
 	must_find = [ 'File %s/xyz/etc/logo.png moved to %s/xyz/etc2/Logo.PNG' % (pbucket(1), pbucket(1))])
382 381
Binary files a/testsuite.tar.gz and b/testsuite.tar.gz differ