Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

* run-tests.py, testsuite.tar.gz: Keep the testsuite in

  SVN as a tarball. There's too many "strange" things 
  in the directory for it to be kept in SVN.



git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3cmd/trunk@450 830e0280-6d2a-0410-9c65-932aecc39d9d
  • Loading branch information...
commit 96222f5746254af6369ea5115a8a2580abb8698e 1 parent 3db91d0
Michal Ludvig mludvig authored
6 ChangeLog
... ... @@ -1,5 +1,11 @@
1 1 2010-10-27 Michal Ludvig <mludvig@logix.net.nz>
2 2
  3 + * run-tests.py, testsuite.tar.gz: Keep the testsuite in
  4 + SVN as a tarball. There's too many "strange" things
  5 + in the directory for it to be kept in SVN.
  6 +
  7 +2010-10-27 Michal Ludvig <mludvig@logix.net.nz>
  8 +
3 9 * TODO: Updated.
4 10 * upload-to-sf.sh: Updated for new SF.net system
5 11
82 run-tests.py
@@ -11,6 +11,7 @@
11 11 import re
12 12 from subprocess import Popen, PIPE, STDOUT
13 13 import locale
  14 +import pwd
14 15
15 16 count_pass = 0
16 17 count_fail = 0
@@ -30,6 +31,17 @@
30 31 print "Unknown platform: %s" % os.name
31 32 sys.exit(1)
32 33
  34 +## Unpack testsuite/ directory
  35 +if not os.path.isdir('testsuite') and os.path.isfile('testsuite.tar.gz'):
  36 + os.system("tar -xz -f testsuite.tar.gz")
  37 +if not os.path.isdir('testsuite'):
  38 + print "Something went wrong while unpacking testsuite.tar.gz"
  39 + sys.exit(1)
  40 +
  41 +## Fix up permissions for permission-denied tests
  42 +os.chmod("testsuite/permission-tests/permission-denied-dir", 0444)
  43 +os.chmod("testsuite/permission-tests/permission-denied.txt", 0000)
  44 +
33 45 ## Patterns for Unicode tests
34 46 patterns = {}
35 47 patterns['UTF-8'] = u"ŪņЇЌœđЗ/☺ unicode € rocks ™"
@@ -58,10 +70,6 @@
58 70 # TODO: also unpack if the tarball is newer than the directory timestamp
59 71 # for instance when a new version was pulled from SVN.
60 72
61   -## Fix up permissions for permission-denied tests
62   -os.chmod("testsuite/permission-tests/permission-denied-dir", 0444)
63   -os.chmod("testsuite/permission-tests/permission-denied.txt", 0000)
64   -
65 73 def test(label, cmd_args = [], retcode = 0, must_find = [], must_not_find = [], must_find_re = [], must_not_find_re = []):
66 74 def command_output():
67 75 print "----"
@@ -96,9 +104,6 @@ def skip(message = ""):
96 104 count_skip += 1
97 105 return 0
98 106 def compile_list(_list, regexps = False):
99   - if type(_list) not in [ list, tuple ]:
100   - _list = [_list]
101   -
102 107 if regexps == False:
103 108 _list = [re.escape(item.encode(encoding, "replace")) for item in _list]
104 109
@@ -120,6 +125,11 @@ def compile_list(_list, regexps = False):
120 125 if retcode != p.returncode:
121 126 return failure("retcode: %d, expected: %d" % (p.returncode, retcode))
122 127
  128 + if type(must_find) not in [ list, tuple ]: must_find = [must_find]
  129 + if type(must_find_re) not in [ list, tuple ]: must_find_re = [must_find_re]
  130 + if type(must_not_find) not in [ list, tuple ]: must_not_find = [must_not_find]
  131 + if type(must_not_find_re) not in [ list, tuple ]: must_not_find_re = [must_not_find_re]
  132 +
123 133 find_list = []
124 134 find_list.extend(compile_list(must_find))
125 135 find_list.extend(compile_list(must_find_re, regexps = True))
@@ -179,13 +189,19 @@ def test_flushdir(label, dir_name):
179 189 test_rmdir(label + "(rm)", dir_name)
180 190 return test_mkdir(label + "(mk)", dir_name)
181 191
182   -bucket_prefix = ''
  192 +try:
  193 + pwd = pwd.getpwuid(os.getuid())
  194 + bucket_prefix = "%s.%s-" % (pwd.pw_name, pwd.pw_uid)
  195 +except:
  196 + bucket_prefix = ''
  197 +print "Using bucket prefix: '%s'" % bucket_prefix
  198 +
183 199 argv = sys.argv[1:]
184 200 while argv:
185 201 arg = argv.pop(0)
186   - if arg.startswith('--bucket-prefix='):
187   - print "Usage: '--bucket-prefix PREFIX', not '--bucket-prefix=PREFIX'"
188   - sys.exit(0)
  202 + if arg.startswith('--bucket-prefix='):
  203 + print "Usage: '--bucket-prefix PREFIX', not '--bucket-prefix=PREFIX'"
  204 + sys.exit(0)
189 205 if arg in ("-h", "--help"):
190 206 print "%s A B K..O -N" % sys.argv[0]
191 207 print "Run tests number A, B and K through to O, except for N"
@@ -196,13 +212,13 @@ def test_flushdir(label, dir_name):
196 212 if arg in ("-v", "--verbose"):
197 213 verbose = True
198 214 continue
199   - if arg in ("-p", "--bucket-prefix"):
200   - try:
201   - bucket_prefix = argv.pop(0)
202   - except IndexError:
203   - print "Bucket prefix option must explicitly supply a bucket name prefix"
204   - sys.exit(0)
205   - continue
  215 + if arg in ("-p", "--bucket-prefix"):
  216 + try:
  217 + bucket_prefix = argv.pop(0)
  218 + except IndexError:
  219 + print "Bucket prefix option must explicitly supply a bucket name prefix"
  220 + sys.exit(0)
  221 + continue
206 222 if arg.find("..") >= 0:
207 223 range_idx = arg.find("..")
208 224 range_start = arg[:range_idx] or 0
@@ -223,6 +239,7 @@ def bucket(tail):
223 239 if str(tail) == '3':
224 240 label = 'Autotest'
225 241 return '%ss3cmd-%s-%s' % (bucket_prefix, label, tail)
  242 +
226 243 def pbucket(tail):
227 244 '''Like bucket(), but prepends "s3://" for you'''
228 245 return 's3://' + bucket(tail)
@@ -258,30 +275,29 @@ def pbucket(tail):
258 275
259 276
260 277 ## ====== Sync to S3
261   -test_s3cmd("Sync to S3", ['sync', 'testsuite/', pbucket(1) + '/xyz/', '--exclude', '.svn/*', '--exclude', '*.png', '--no-encrypt', '--exclude-from', 'testsuite/exclude.encodings' ],
  278 +test_s3cmd("Sync to S3", ['sync', 'testsuite/', pbucket(1) + '/xyz/', '--exclude', 'demo/*', '--exclude', '*.png', '--no-encrypt', '--exclude-from', 'testsuite/exclude.encodings' ],
262 279 must_find = [ "WARNING: 32 non-printable characters replaced in: crappy-file-name/non-printables ^A^B^C^D^E^F^G^H^I^J^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y^Z^[^\^]^^^_^? +-[\]^<>%%\"'#{}`&?.end",
263 280 "WARNING: File can not be uploaded: testsuite/permission-tests/permission-denied.txt: Permission denied",
264 281 "stored as '%s/xyz/crappy-file-name/non-printables ^A^B^C^D^E^F^G^H^I^J^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y^Z^[^\^]^^^_^? +-[\\]^<>%%%%\"'#{}`&?.end'" % pbucket(1) ],
265   - must_not_find_re = [ "\.svn/", "\.png$", "permission-denied-dir" ])
  282 + must_not_find_re = [ "demo/", "\.png$", "permission-denied-dir" ])
266 283
267 284 if have_encoding:
268 285 ## ====== Sync UTF-8 / GBK / ... to S3
269   - test_s3cmd("Sync %s to S3" % encoding, ['sync', 'testsuite/encodings/' + encoding, '%s/xyz/encodings/' % pbucket(1), '--exclude', '.svn/*', '--no-encrypt' ],
  286 + test_s3cmd("Sync %s to S3" % encoding, ['sync', 'testsuite/encodings/' + encoding, '%s/xyz/encodings/' % pbucket(1), '--exclude', 'demo/*', '--no-encrypt' ],
270 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)} ])
271 288
272 289
273 290 ## ====== List bucket content
274   -must_find_re = [ u"DIR %s/xyz/binary/$" % pbucket(1) , u"DIR %s/xyz/etc/$" % pbucket(1) ]
275   -must_not_find = [ u"random-crap.md5", u".svn" ]
276 291 test_s3cmd("List bucket content", ['ls', '%s/xyz/' % pbucket(1) ],
277   - must_find_re = must_find_re,
278   - must_not_find = must_not_find)
  292 + must_find_re = [ u"DIR %s/xyz/binary/$" % pbucket(1) , u"DIR %s/xyz/etc/$" % pbucket(1) ],
  293 + must_not_find = [ u"random-crap.md5", u"/demo" ])
279 294
280 295
281 296 ## ====== List bucket recursive
282 297 must_find = [ u"%s/xyz/binary/random-crap.md5" % pbucket(1) ]
283 298 if have_encoding:
284 299 must_find.append(u"%(pbucket)s/xyz/encodings/%(encoding)s/%(pattern)s" % { 'encoding' : encoding, 'pattern' : enc_pattern, 'pbucket' : pbucket(1) })
  300 +
285 301 test_s3cmd("List bucket recursive", ['ls', '--recursive', pbucket(1)],
286 302 must_find = must_find,
287 303 must_not_find = [ "logo.png" ])
@@ -303,16 +319,16 @@ def pbucket(tail):
303 319
304 320
305 321 ## ====== Remove 'demo' directory
306   -test_rmdir("Remove 'demo/'", "testsuite-out/xyz/demo/")
  322 +test_rmdir("Remove 'dir-test/'", "testsuite-out/xyz/dir-test/")
307 323
308 324
309 325 ## ====== Create dir with name of a file
310   -test_mkdir("Create some-file.xml dir", "testsuite-out/xyz/demo/some-file.xml")
  326 +test_mkdir("Create file-dir dir", "testsuite-out/xyz/dir-test/file-dir")
311 327
312 328
313 329 ## ====== Skip dst dirs
314 330 test_s3cmd("Skip over dir", ['sync', '%s/xyz' % pbucket(1), 'testsuite-out'],
315   - must_find = "WARNING: testsuite-out/xyz/demo/some-file.xml is a directory - skipping over")
  331 + must_find = "WARNING: testsuite-out/xyz/dir-test/file-dir is a directory - skipping over")
316 332
317 333
318 334 ## ====== Clean up local destination dir
@@ -355,7 +371,7 @@ def pbucket(tail):
355 371
356 372 ## ====== Sync more to S3
357 373 test_s3cmd("Sync more to S3", ['sync', 'testsuite/', 's3://%s/xyz/' % bucket(1), '--no-encrypt' ],
358   - must_find = [ "File 'testsuite/.svn/entries' stored as '%s/xyz/.svn/entries' " % pbucket(1) ],
  374 + must_find = [ "File 'testsuite/demo/some-file.xml' stored as '%s/xyz/demo/some-file.xml' " % pbucket(1) ],
359 375 must_not_find = [ "File 'testsuite/etc/linked.png' stored as '%s/xyz/etc/linked.png" % pbucket(1) ])
360 376
361 377
@@ -376,7 +392,7 @@ def pbucket(tail):
376 392 test_s3cmd("Sync more from S3", ['sync', '--delete-removed', '%s/xyz' % pbucket(1), 'testsuite-out'],
377 393 must_find = [ "deleted: testsuite-out/logo.png",
378 394 "File '%s/xyz/etc2/Logo.PNG' stored as 'testsuite-out/xyz/etc2/Logo.PNG' (22059 bytes" % pbucket(1),
379   - "File '%s/xyz/.svn/entries' stored as 'testsuite-out/xyz/.svn/entries' " % pbucket(1) ],
  395 + "File '%s/xyz/demo/some-file.xml' stored as 'testsuite-out/xyz/demo/some-file.xml' " % pbucket(1) ],
380 396 must_not_find_re = [ "not-deleted.*etc/logo.png" ])
381 397
382 398
@@ -407,11 +423,11 @@ def pbucket(tail):
407 423 must_find = [ "File %s/xyz/etc2/Logo.PNG copied to %s/xyz/etc2/logo.png" % (pbucket(1), pbucket(3)) ])
408 424
409 425 ## ====== Recursive copy
410   -test_s3cmd("Recursive copy, set ACL", ['cp', '-r', '--acl-public', '%s/xyz/' % pbucket(1), '%s/copy' % pbucket(2), '--exclude', '.svn/*', '--exclude', 'non-printables*'],
  426 +test_s3cmd("Recursive copy, set ACL", ['cp', '-r', '--acl-public', '%s/xyz/' % pbucket(1), '%s/copy' % pbucket(2), '--exclude', 'demo/*', '--exclude', 'non-printables*'],
411 427 must_find = [ "File %s/xyz/etc2/Logo.PNG copied to %s/copy/etc2/Logo.PNG" % (pbucket(1), pbucket(2)),
412 428 "File %s/xyz/blahBlah/Blah.txt copied to %s/copy/blahBlah/Blah.txt" % (pbucket(1), pbucket(2)),
413 429 "File %s/xyz/blahBlah/blah.txt copied to %s/copy/blahBlah/blah.txt" % (pbucket(1), pbucket(2)) ],
414   - must_not_find = [ ".svn" ])
  430 + must_not_find = [ "demo/" ])
415 431
416 432 ## ====== Don't Put symbolic link
417 433 test_s3cmd("Don't put symbolic links", ['put', 'testsuite/etc/linked1.png', 's3://%s/xyz/' % bucket(1),],
@@ -460,7 +476,7 @@ def pbucket(tail):
460 476 ## ====== Recursive delete
461 477 test_s3cmd("Recursive delete", ['del', '--recursive', '--exclude', 'Atomic*', '%s/xyz/etc' % pbucket(1)],
462 478 must_find = [ "File %s/xyz/etc/TypeRa.ttf deleted" % pbucket(1) ],
463   - must_find_re = [ "File .*\.svn/entries deleted" ],
  479 + must_find_re = [ "File .*/etc/logo.png deleted" ],
464 480 must_not_find = [ "AtomicClockRadio.ttf" ])
465 481
466 482 ## ====== Recursive delete all
BIN  testsuite.tar.gz
Binary file not shown
BIN  testsuite/binary/random-crap
Binary file not shown
1  testsuite/binary/random-crap.md5
... ... @@ -1 +0,0 @@
1   -cb76ecee9a834eadd96b226493acac28 random-crap
1  testsuite/blahBlah/Blah.txt
... ... @@ -1 +0,0 @@
1   -Blah
1  testsuite/blahBlah/blah.txt
... ... @@ -1 +0,0 @@
1   -blah
BIN  testsuite/crappy-file-name.tar.gz
Binary file not shown
BIN  testsuite/encodings/GBK.tar.gz
Binary file not shown
BIN  testsuite/encodings/UTF-8.tar.gz
Binary file not shown
BIN  testsuite/etc/AtomicClockRadio.ttf
Binary file not shown
BIN  testsuite/etc/TypeRa.ttf
Binary file not shown
1  testsuite/etc/brokenlink.png
1  testsuite/etc/linked.png
1  testsuite/etc/linked1.png
BIN  testsuite/etc/logo.png
0  testsuite/etc/more/give-me-more.txt
No changes.
1  testsuite/etc/more/linked-dir
1  testsuite/exclude.encodings
... ... @@ -1 +0,0 @@
1   -encodings/*
3  testsuite/permission-tests/.svnignore
... ... @@ -1,3 +0,0 @@
1   -## Run 'svn propset svn:ignore -F .svnignore .' after you change this list
2   -permission-denied-dir
3   -
1  testsuite/permission-tests/permission-denied-dir/inaccessible.txt
... ... @@ -1 +0,0 @@
1   -inaccessible
1  testsuite/permission-tests/permission-denied.txt
... ... @@ -1 +0,0 @@
1   -permission denied

0 comments on commit 96222f5

Please sign in to comment.
Something went wrong with that request. Please try again.