Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 409 lines (313 sloc) 15.409 kb
330c51eb »
2008-09-09 * testsuite, run-tests.py: Added testsuite with first few tests.
1 #!/usr/bin/env python
f11319be »
2008-11-30 * run-tests.py: Added a lot of new tests.
2 # -*- coding=utf-8 -*-
330c51eb »
2008-09-09 * testsuite, run-tests.py: Added testsuite with first few tests.
3
4 ## Amazon S3cmd - testsuite
5 ## Author: Michal Ludvig <michal@logix.cz>
6 ## http://www.logix.cz/michal
7 ## License: GPL Version 2
8
9 import sys
9856527a »
2008-12-29 * s3cmd, run-tests.py: Make it work on Windows.
10 import os
330c51eb »
2008-09-09 * testsuite, run-tests.py: Added testsuite with first few tests.
11 import re
12 from subprocess import Popen, PIPE, STDOUT
f891a814 »
2008-12-31 * run-tests.py: Don't assume utf-8, use preferred encoding
13 import locale
330c51eb »
2008-09-09 * testsuite, run-tests.py: Added testsuite with first few tests.
14
15 count_pass = 0
16 count_fail = 0
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
17 count_skip = 0
18
19 test_counter = 0
20 run_tests = []
21 exclude_tests = []
22
3677a3ba »
2009-05-27 * run-tests.py: Added --verbose mode.
23 verbose = False
24
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
25 if os.name == "posix":
26 have_wget = True
27 elif os.name == "nt":
28 have_wget = False
29 else:
30 print "Unknown platform: %s" % os.name
31 sys.exit(1)
330c51eb »
2008-09-09 * testsuite, run-tests.py: Added testsuite with first few tests.
32
4986ae85 »
2008-12-31 * run-tests.py: Adapted to the above change.
33 ## Patterns for Unicode tests
34 patterns = {}
35 patterns['UTF-8'] = u"ŪņЇЌœđЗ/☺ unicode € rocks ™"
36 patterns['GBK'] = u"12月31日/1-特色條目"
37
38 encoding = locale.getpreferredencoding()
39 if not encoding:
40 print "Guessing current system encoding failed. Consider setting $LANG variable."
41 sys.exit(1)
5f7a2d5f »
2008-12-31 * s3cmd: Reworked internal handling of unicode vs encoded filenames.
42 else:
43 print "System encoding: " + encoding
4986ae85 »
2008-12-31 * run-tests.py: Adapted to the above change.
44
45 have_encoding = os.path.isdir('testsuite/encodings/' + encoding)
46 if not have_encoding and os.path.isfile('testsuite/encodings/%s.tar.gz' % encoding):
5f7a2d5f »
2008-12-31 * s3cmd: Reworked internal handling of unicode vs encoded filenames.
47 os.system("tar xvz -C testsuite/encodings -f testsuite/encodings/%s.tar.gz" % encoding)
4986ae85 »
2008-12-31 * run-tests.py: Adapted to the above change.
48 have_encoding = os.path.isdir('testsuite/encodings/' + encoding)
49
50 if have_encoding:
51 enc_base_remote = "s3://s3cmd-autotest-1/xyz/%s/" % encoding
52 enc_pattern = patterns[encoding]
5f7a2d5f »
2008-12-31 * s3cmd: Reworked internal handling of unicode vs encoded filenames.
53 else:
54 print encoding + " specific files not found."
4986ae85 »
2008-12-31 * run-tests.py: Adapted to the above change.
55
330c51eb »
2008-09-09 * testsuite, run-tests.py: Added testsuite with first few tests.
56 def test(label, cmd_args = [], retcode = 0, must_find = [], must_not_find = [], must_find_re = [], must_not_find_re = []):
3677a3ba »
2009-05-27 * run-tests.py: Added --verbose mode.
57 def command_output():
58 print "----"
59 print " ".join([arg.find(" ")>=0 and "'%s'" % arg or arg for arg in cmd_args])
60 print "----"
61 print stdout
62 print "----"
63
330c51eb »
2008-09-09 * testsuite, run-tests.py: Added testsuite with first few tests.
64 def failure(message = ""):
65 global count_fail
66 if message:
f891a814 »
2008-12-31 * run-tests.py: Don't assume utf-8, use preferred encoding
67 message = " (%r)" % message
f11319be »
2008-11-30 * run-tests.py: Added a lot of new tests.
68 print "\x1b[31;1mFAIL%s\x1b[0m" % (message)
330c51eb »
2008-09-09 * testsuite, run-tests.py: Added testsuite with first few tests.
69 count_fail += 1
3677a3ba »
2009-05-27 * run-tests.py: Added --verbose mode.
70 command_output()
257d6321 »
2008-12-29 * run-tests.py: Exit on failed test. Fixed order of tests.
71 #return 1
72 sys.exit(1)
330c51eb »
2008-09-09 * testsuite, run-tests.py: Added testsuite with first few tests.
73 def success(message = ""):
74 global count_pass
75 if message:
f891a814 »
2008-12-31 * run-tests.py: Don't assume utf-8, use preferred encoding
76 message = " (%r)" % message
f11319be »
2008-11-30 * run-tests.py: Added a lot of new tests.
77 print "\x1b[32;1mOK\x1b[0m%s" % (message)
330c51eb »
2008-09-09 * testsuite, run-tests.py: Added testsuite with first few tests.
78 count_pass += 1
3677a3ba »
2009-05-27 * run-tests.py: Added --verbose mode.
79 if verbose:
80 command_output()
330c51eb »
2008-09-09 * testsuite, run-tests.py: Added testsuite with first few tests.
81 return 0
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
82 def skip(message = ""):
83 global count_skip
84 if message:
f891a814 »
2008-12-31 * run-tests.py: Don't assume utf-8, use preferred encoding
85 message = " (%r)" % message
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
86 print "\x1b[33;1mSKIP\x1b[0m%s" % (message)
87 count_skip += 1
88 return 0
330c51eb »
2008-09-09 * testsuite, run-tests.py: Added testsuite with first few tests.
89 def compile_list(_list, regexps = False):
90 if type(_list) not in [ list, tuple ]:
91 _list = [_list]
92
93 if regexps == False:
4986ae85 »
2008-12-31 * run-tests.py: Adapted to the above change.
94 _list = [re.escape(item.encode(encoding, "replace")) for item in _list]
330c51eb »
2008-09-09 * testsuite, run-tests.py: Added testsuite with first few tests.
95
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
96 return [re.compile(item, re.MULTILINE) for item in _list]
97
98 global test_counter
99 test_counter += 1
100 print ("%3d %s " % (test_counter, label)).ljust(30, "."),
330c51eb »
2008-09-09 * testsuite, run-tests.py: Added testsuite with first few tests.
101 sys.stdout.flush()
102
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
103 if run_tests.count(test_counter) == 0 or exclude_tests.count(test_counter) > 0:
104 return skip()
105
330c51eb »
2008-09-09 * testsuite, run-tests.py: Added testsuite with first few tests.
106 p = Popen(cmd_args, stdout = PIPE, stderr = STDOUT, universal_newlines = True)
107 stdout, stderr = p.communicate()
108 if retcode != p.returncode:
109 return failure("retcode: %d, expected: %d" % (p.returncode, retcode))
110
111 find_list = []
112 find_list.extend(compile_list(must_find))
113 find_list.extend(compile_list(must_find_re, regexps = True))
f11319be »
2008-11-30 * run-tests.py: Added a lot of new tests.
114 find_list_patterns = []
115 find_list_patterns.extend(must_find)
116 find_list_patterns.extend(must_find_re)
117
330c51eb »
2008-09-09 * testsuite, run-tests.py: Added testsuite with first few tests.
118 not_find_list = []
119 not_find_list.extend(compile_list(must_not_find))
120 not_find_list.extend(compile_list(must_not_find_re, regexps = True))
f11319be »
2008-11-30 * run-tests.py: Added a lot of new tests.
121 not_find_list_patterns = []
122 not_find_list_patterns.extend(must_not_find)
123 not_find_list_patterns.extend(must_not_find_re)
330c51eb »
2008-09-09 * testsuite, run-tests.py: Added testsuite with first few tests.
124
f11319be »
2008-11-30 * run-tests.py: Added a lot of new tests.
125 for index in range(len(find_list)):
126 match = find_list[index].search(stdout)
330c51eb »
2008-09-09 * testsuite, run-tests.py: Added testsuite with first few tests.
127 if not match:
f11319be »
2008-11-30 * run-tests.py: Added a lot of new tests.
128 return failure("pattern not found: %s" % find_list_patterns[index])
129 for index in range(len(not_find_list)):
130 match = not_find_list[index].search(stdout)
330c51eb »
2008-09-09 * testsuite, run-tests.py: Added testsuite with first few tests.
131 if match:
f11319be »
2008-11-30 * run-tests.py: Added a lot of new tests.
132 return failure("pattern found: %s (match: %s)" % (not_find_list_patterns[index], match.group(0)))
3677a3ba »
2009-05-27 * run-tests.py: Added --verbose mode.
133
330c51eb »
2008-09-09 * testsuite, run-tests.py: Added testsuite with first few tests.
134 return success()
135
136 def test_s3cmd(label, cmd_args = [], **kwargs):
137 if not cmd_args[0].endswith("s3cmd"):
9856527a »
2008-12-29 * s3cmd, run-tests.py: Make it work on Windows.
138 cmd_args.insert(0, "python")
139 cmd_args.insert(1, "s3cmd")
140
330c51eb »
2008-09-09 * testsuite, run-tests.py: Added testsuite with first few tests.
141 return test(label, cmd_args, **kwargs)
142
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
143 def test_mkdir(label, dir_name):
144 if os.name in ("posix", "nt"):
145 cmd = ['mkdir']
146 else:
147 print "Unknown platform: %s" % os.name
148 sys.exit(1)
149 cmd.append(dir_name)
150 return test(label, cmd)
151
152 def test_rmdir(label, dir_name):
153 if os.path.isdir(dir_name):
154 if os.name == "posix":
155 cmd = ['rm', '-rf']
156 elif os.name == "nt":
157 cmd = ['rmdir', '/s/q']
158 else:
159 print "Unknown platform: %s" % os.name
160 sys.exit(1)
161 cmd.append(dir_name)
162 return test(label, cmd)
163
3894a49a »
2009-01-21 * run-tests.py: Updated paths for the new sync
164 def test_flushdir(label, dir_name):
165 test_rmdir(label + "(rm)", dir_name)
166 return test_mkdir(label + "(mk)", dir_name)
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
167
168 argv = sys.argv[1:]
169 while argv:
170 arg = argv.pop(0)
171 if arg in ("-h", "--help"):
172 print "%s A B K..O -N" % sys.argv[0]
173 print "Run tests number A, B and K through to O, except for N"
174 sys.exit(0)
175 if arg in ("-l", "--list"):
176 exclude_tests = range(0, 999)
177 break
3677a3ba »
2009-05-27 * run-tests.py: Added --verbose mode.
178 if arg in ("-v", "--verbose"):
179 verbose = True
180 continue
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
181 if arg.find("..") >= 0:
182 range_idx = arg.find("..")
183 range_start = arg[:range_idx] or 0
184 range_end = arg[range_idx+2:] or 999
185 run_tests.extend(range(int(range_start), int(range_end) + 1))
186 elif arg.startswith("-"):
187 exclude_tests.append(int(arg[1:]))
188 else:
189 run_tests.append(int(arg))
190
191 if not run_tests:
192 run_tests = range(0, 999)
193
194 ## ====== Remove test buckets
f11319be »
2008-11-30 * run-tests.py: Added a lot of new tests.
195 test_s3cmd("Remove test buckets", ['rb', '-r', 's3://s3cmd-autotest-1', 's3://s3cmd-autotest-2', 's3://s3cmd-Autotest-3'],
330c51eb »
2008-09-09 * testsuite, run-tests.py: Added testsuite with first few tests.
196 must_find = [ "Bucket 's3://s3cmd-autotest-1/' removed",
197 "Bucket 's3://s3cmd-autotest-2/' removed",
f11319be »
2008-11-30 * run-tests.py: Added a lot of new tests.
198 "Bucket 's3://s3cmd-Autotest-3/' removed" ])
199
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
200
201 ## ====== Create one bucket (EU)
f11319be »
2008-11-30 * run-tests.py: Added a lot of new tests.
202 test_s3cmd("Create one bucket (EU)", ['mb', '--bucket-location=EU', 's3://s3cmd-autotest-1'],
330c51eb »
2008-09-09 * testsuite, run-tests.py: Added testsuite with first few tests.
203 must_find = "Bucket 's3://s3cmd-autotest-1/' created")
204
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
205
206
207 ## ====== Create multiple buckets
f11319be »
2008-11-30 * run-tests.py: Added a lot of new tests.
208 test_s3cmd("Create multiple buckets", ['mb', 's3://s3cmd-autotest-2', 's3://s3cmd-Autotest-3'],
209 must_find = [ "Bucket 's3://s3cmd-autotest-2/' created", "Bucket 's3://s3cmd-Autotest-3/' created" ])
330c51eb »
2008-09-09 * testsuite, run-tests.py: Added testsuite with first few tests.
210
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
211
212 ## ====== Invalid bucket name
f11319be »
2008-11-30 * run-tests.py: Added a lot of new tests.
213 test_s3cmd("Invalid bucket name", ["mb", "--bucket-location=EU", "s3://s3cmd-Autotest-EU"],
330c51eb »
2008-09-09 * testsuite, run-tests.py: Added testsuite with first few tests.
214 retcode = 1,
f11319be »
2008-11-30 * run-tests.py: Added a lot of new tests.
215 must_find = "ERROR: Parameter problem: Bucket name 's3cmd-Autotest-EU' contains disallowed character",
330c51eb »
2008-09-09 * testsuite, run-tests.py: Added testsuite with first few tests.
216 must_not_find_re = "Bucket.*created")
217
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
218
219 ## ====== Buckets list
330c51eb »
2008-09-09 * testsuite, run-tests.py: Added testsuite with first few tests.
220 test_s3cmd("Buckets list", ["ls"],
f11319be »
2008-11-30 * run-tests.py: Added a lot of new tests.
221 must_find = [ "autotest-1", "autotest-2", "Autotest-3" ], must_not_find_re = "Autotest-EU")
222
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
223
224 ## ====== Sync to S3
3894a49a »
2009-01-21 * run-tests.py: Updated paths for the new sync
225 test_s3cmd("Sync to S3", ['sync', 'testsuite/', 's3://s3cmd-autotest-1/xyz/', '--exclude', '.svn/*', '--exclude', '*.png', '--no-encrypt', '--exclude-from', 'testsuite/exclude.encodings' ],
226 must_not_find_re = [ "\.svn/", "\.png$" ])
4986ae85 »
2008-12-31 * run-tests.py: Adapted to the above change.
227
228 if have_encoding:
229 ## ====== Sync UTF-8 / GBK / ... to S3
3894a49a »
2009-01-21 * run-tests.py: Updated paths for the new sync
230 test_s3cmd("Sync %s to S3" % encoding, ['sync', 'testsuite/encodings/' + encoding, 's3://s3cmd-autotest-1/xyz/encodings/', '--exclude', '.svn/*', '--no-encrypt' ],
231 must_find = [ u"File 'testsuite/encodings/%(encoding)s/%(pattern)s' stored as 's3://s3cmd-autotest-1/xyz/encodings/%(encoding)s/%(pattern)s'" % { 'encoding' : encoding, 'pattern' : enc_pattern } ])
9856527a »
2008-12-29 * s3cmd, run-tests.py: Make it work on Windows.
232
233
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
234 ## ====== List bucket content
3894a49a »
2009-01-21 * run-tests.py: Updated paths for the new sync
235 must_find_re = [ u"DIR s3://s3cmd-autotest-1/xyz/binary/$", u"DIR s3://s3cmd-autotest-1/xyz/etc/$" ]
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
236 must_not_find = [ u"random-crap.md5", u".svn" ]
237 test_s3cmd("List bucket content", ['ls', 's3://s3cmd-autotest-1/xyz/'],
238 must_find_re = must_find_re,
239 must_not_find = must_not_find)
9856527a »
2008-12-29 * s3cmd, run-tests.py: Make it work on Windows.
240
241
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
242 ## ====== List bucket recursive
243 must_find = [ u"s3://s3cmd-autotest-1/xyz/binary/random-crap.md5" ]
4986ae85 »
2008-12-31 * run-tests.py: Adapted to the above change.
244 if have_encoding:
3894a49a »
2009-01-21 * run-tests.py: Updated paths for the new sync
245 must_find.append(u"s3://s3cmd-autotest-1/xyz/encodings/%(encoding)s/%(pattern)s" % { 'encoding' : encoding, 'pattern' : enc_pattern })
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
246 test_s3cmd("List bucket recursive", ['ls', '--recursive', 's3://s3cmd-autotest-1'],
247 must_find = must_find,
248 must_not_find = [ "logo.png" ])
9856527a »
2008-12-29 * s3cmd, run-tests.py: Make it work on Windows.
249
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
250 ## ====== FIXME
251 # test_s3cmd("Recursive put", ['put', '--recursive', 'testsuite/etc', 's3://s3cmd-autotest-1/xyz/'])
9856527a »
2008-12-29 * s3cmd, run-tests.py: Make it work on Windows.
252
f11319be »
2008-11-30 * run-tests.py: Added a lot of new tests.
253
3894a49a »
2009-01-21 * run-tests.py: Updated paths for the new sync
254 ## ====== Clean up local destination dir
255 test_flushdir("Clean testsuite-out/", "testsuite-out")
f11319be »
2008-11-30 * run-tests.py: Added a lot of new tests.
256
257
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
258 ## ====== Sync from S3
3894a49a »
2009-01-21 * run-tests.py: Updated paths for the new sync
259 must_find = [ "File 's3://s3cmd-autotest-1/xyz/binary/random-crap.md5' stored as 'testsuite-out/xyz/binary/random-crap.md5'" ]
4986ae85 »
2008-12-31 * run-tests.py: Adapted to the above change.
260 if have_encoding:
3894a49a »
2009-01-21 * run-tests.py: Updated paths for the new sync
261 must_find.append(u"File 's3://s3cmd-autotest-1/xyz/encodings/%(encoding)s/%(pattern)s' stored as 'testsuite-out/xyz/encodings/%(encoding)s/%(pattern)s' " % { 'encoding' : encoding, 'pattern' : enc_pattern })
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
262 test_s3cmd("Sync from S3", ['sync', 's3://s3cmd-autotest-1/xyz', 'testsuite-out'],
263 must_find = must_find)
f11319be »
2008-11-30 * run-tests.py: Added a lot of new tests.
264
265
3894a49a »
2009-01-21 * run-tests.py: Updated paths for the new sync
266 ## ====== Clean up local destination dir
267 test_flushdir("Clean testsuite-out/", "testsuite-out")
268
269
e3244a8c »
2009-01-07 * S3/ACL.py: Move attributes from class to instance.
270 ## ====== Put public, guess MIME
271 test_s3cmd("Put public, guess MIME", ['put', '--guess-mime-type', '--acl-public', 'testsuite/etc/logo.png', 's3://s3cmd-autotest-1/xyz/etc/logo.png'],
3894a49a »
2009-01-21 * run-tests.py: Updated paths for the new sync
272 must_find = [ "stored as 's3://s3cmd-autotest-1/xyz/etc/logo.png'" ])
e3244a8c »
2009-01-07 * S3/ACL.py: Move attributes from class to instance.
273
274
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
275 ## ====== Retrieve from URL
276 if have_wget:
e3244a8c »
2009-01-07 * S3/ACL.py: Move attributes from class to instance.
277 test("Retrieve from URL", ['wget', '-O', 'testsuite-out/logo.png', 'http://s3cmd-autotest-1.s3.amazonaws.com/xyz/etc/logo.png'],
278 must_find_re = [ 'logo.png.*saved \[22059/22059\]' ])
279
280
281 ## ====== Change ACL to Private
282 test_s3cmd("Change ACL to Private", ['setacl', '--acl-private', 's3://s3cmd-autotest-1/xyz/etc/l*.png'],
283 must_find = [ "logo.png: ACL set to Private" ])
284
285
286 ## ====== Verify Private ACL
287 if have_wget:
288 test("Verify Private ACL", ['wget', '-O', 'testsuite-out/logo.png', 'http://s3cmd-autotest-1.s3.amazonaws.com/xyz/etc/logo.png'],
289 retcode = 1,
290 must_find_re = [ 'ERROR 403: Forbidden' ])
291
292
293 ## ====== Change ACL to Public
294 test_s3cmd("Change ACL to Public", ['setacl', '--acl-public', '--recursive', 's3://s3cmd-autotest-1/xyz/etc/', '-v'],
295 must_find = [ "logo.png: ACL set to Public" ])
296
297
298 ## ====== Verify Public ACL
299 if have_wget:
300 test("Verify Public ACL", ['wget', '-O', 'testsuite-out/logo.png', 'http://s3cmd-autotest-1.s3.amazonaws.com/xyz/etc/logo.png'],
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
301 must_find_re = [ 'logo.png.*saved \[22059/22059\]' ])
302
f11319be »
2008-11-30 * run-tests.py: Added a lot of new tests.
303
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
304 ## ====== Sync more to S3
3894a49a »
2009-01-21 * run-tests.py: Updated paths for the new sync
305 test_s3cmd("Sync more to S3", ['sync', 'testsuite/', 's3://s3cmd-autotest-1/xyz/', '--no-encrypt' ],
306 must_find = [ "File 'testsuite/.svn/format' stored as 's3://s3cmd-autotest-1/xyz/.svn/format' " ])
f11319be »
2008-11-30 * run-tests.py: Added a lot of new tests.
307
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
308
309 ## ====== Rename within S3
f11319be »
2008-11-30 * run-tests.py: Added a lot of new tests.
310 test_s3cmd("Rename within S3", ['mv', 's3://s3cmd-autotest-1/xyz/etc/logo.png', 's3://s3cmd-autotest-1/xyz/etc2/Logo.PNG'],
e5b4705c »
2009-02-14 * run-tests.py: Fixed for new messages.
311 must_find = [ 'File s3://s3cmd-autotest-1/xyz/etc/logo.png moved to s3://s3cmd-autotest-1/xyz/etc2/Logo.PNG' ])
f11319be »
2008-11-30 * run-tests.py: Added a lot of new tests.
312
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
313
314 ## ====== Rename (NoSuchKey)
f11319be »
2008-11-30 * run-tests.py: Added a lot of new tests.
315 test_s3cmd("Rename (NoSuchKey)", ['mv', 's3://s3cmd-autotest-1/xyz/etc/logo.png', 's3://s3cmd-autotest-1/xyz/etc2/Logo.PNG'],
316 retcode = 1,
317 must_find_re = [ 'ERROR:.*NoSuchKey' ],
e5b4705c »
2009-02-14 * run-tests.py: Fixed for new messages.
318 must_not_find = [ 'File s3://s3cmd-autotest-1/xyz/etc/logo.png moved to s3://s3cmd-autotest-1/xyz/etc2/Logo.PNG' ])
f11319be »
2008-11-30 * run-tests.py: Added a lot of new tests.
319
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
320
257d6321 »
2008-12-29 * run-tests.py: Exit on failed test. Fixed order of tests.
321 ## ====== Sync more from S3
322 test_s3cmd("Sync more from S3", ['sync', '--delete-removed', 's3://s3cmd-autotest-1/xyz', 'testsuite-out'],
3894a49a »
2009-01-21 * run-tests.py: Updated paths for the new sync
323 must_find = [ "deleted: testsuite-out/logo.png",
324 "File 's3://s3cmd-autotest-1/xyz/etc2/Logo.PNG' stored as 'testsuite-out/xyz/etc2/Logo.PNG' (22059 bytes",
325 "File 's3://s3cmd-autotest-1/xyz/.svn/format' stored as 'testsuite-out/xyz/.svn/format' " ],
257d6321 »
2008-12-29 * run-tests.py: Exit on failed test. Fixed order of tests.
326 must_not_find_re = [ "not-deleted.*etc/logo.png" ])
327
328
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
329 ## ====== Make dst dir for get
330 test_rmdir("Remove dst dir for get", "testsuite-out")
331
332
333 ## ====== Get multiple files
334 test_s3cmd("Get multiple files", ['get', 's3://s3cmd-autotest-1/xyz/etc2/Logo.PNG', 's3://s3cmd-autotest-1/xyz/etc/AtomicClockRadio.ttf', 'testsuite-out'],
335 retcode = 1,
336 must_find = [ 'Destination must be a directory when downloading multiple sources.' ])
337
338
339 ## ====== Make dst dir for get
340 test_mkdir("Make dst dir for get", "testsuite-out")
341
342
343 ## ====== Get multiple files
344 test_s3cmd("Get multiple files", ['get', 's3://s3cmd-autotest-1/xyz/etc2/Logo.PNG', 's3://s3cmd-autotest-1/xyz/etc/AtomicClockRadio.ttf', 'testsuite-out'],
345 must_find = [ u"saved as 'testsuite-out/Logo.PNG'", u"saved as 'testsuite-out/AtomicClockRadio.ttf'" ])
346
dc1c96cf »
2009-05-27 2009-05-27 Michal Ludvig <michal@logix.cz>
347 ## ====== Upload files differing in capitalisation
348 test_s3cmd("blah.txt / Blah.txt", ['put', '-r', 'testsuite/blahBlah', 's3://s3cmd-autotest-1/'],
349 must_find = [ 's3://s3cmd-autotest-1/blahBlah/Blah.txt', 's3://s3cmd-autotest-1/blahBlah/blah.txt' ])
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
350
e0b946c0 »
2009-05-27 * s3cmd: Support for recursive [cp] and [mv], including
351 ## ====== Copy between buckets
352 test_s3cmd("Copy between buckets", ['cp', 's3://s3cmd-autotest-1/xyz/etc2/Logo.PNG', 's3://s3cmd-Autotest-3/xyz/etc2/logo.png'],
353 must_find = [ "File s3://s3cmd-autotest-1/xyz/etc2/Logo.PNG copied to s3://s3cmd-Autotest-3/xyz/etc2/logo.png" ])
354
355 ## ====== Recursive copy
356 test_s3cmd("Recursive copy, set ACL", ['cp', '-r', '--acl-public', 's3://s3cmd-autotest-1/xyz/', 's3://s3cmd-autotest-2/copy', '--exclude', '.svn/*'],
357 must_find = [ "File s3://s3cmd-autotest-1/xyz/etc2/Logo.PNG copied to s3://s3cmd-autotest-2/copy/etc2/Logo.PNG",
358 "File s3://s3cmd-autotest-1/xyz/blahBlah/Blah.txt copied to s3://s3cmd-autotest-2/copy/blahBlah/Blah.txt",
359 "File s3://s3cmd-autotest-1/xyz/blahBlah/blah.txt copied to s3://s3cmd-autotest-2/copy/blahBlah/blah.txt" ],
360 must_not_find = [ ".svn" ])
361
362 ## ====== Verify ACL and MIME type
363 test_s3cmd("Verify ACL and MIME type", ['info', 's3://s3cmd-autotest-2/copy/etc2/Logo.PNG' ],
364 must_find_re = [ "MIME type:.*image/png",
365 "ACL:.*\*anon\*: READ",
366 "URL:.*http://s3cmd-autotest-2.s3.amazonaws.com/copy/etc2/Logo.PNG" ])
367
368 ## ====== Multi source move
369 test_s3cmd("Multi-source move", ['mv', '-r', 's3://s3cmd-autotest-2/copy/blahBlah/Blah.txt', 's3://s3cmd-autotest-2/copy/etc/', 's3://s3cmd-autotest-2/moved/'],
370 must_find = [ "File s3://s3cmd-autotest-2/copy/blahBlah/Blah.txt moved to s3://s3cmd-autotest-2/moved/Blah.txt",
371 "File s3://s3cmd-autotest-2/copy/etc/AtomicClockRadio.ttf moved to s3://s3cmd-autotest-2/moved/AtomicClockRadio.ttf",
372 "File s3://s3cmd-autotest-2/copy/etc/TypeRa.ttf moved to s3://s3cmd-autotest-2/moved/TypeRa.ttf" ],
373 must_not_find = [ "blah.txt" ])
374
375 ## ====== Verify move
376 test_s3cmd("Verify move", ['ls', '-r', 's3://s3cmd-autotest-2'],
377 must_find = [ "s3://s3cmd-autotest-2/moved/Blah.txt",
378 "s3://s3cmd-autotest-2/moved/AtomicClockRadio.ttf",
379 "s3://s3cmd-autotest-2/moved/TypeRa.ttf",
380 "s3://s3cmd-autotest-2/copy/blahBlah/blah.txt" ],
381 must_not_find = [ "s3://s3cmd-autotest-2/copy/blahBlah/Blah.txt",
382 "s3://s3cmd-autotest-2/copy/etc/AtomicClockRadio.ttf",
383 "s3://s3cmd-autotest-2/copy/etc/TypeRa.ttf" ])
384
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
385 ## ====== Simple delete
f11319be »
2008-11-30 * run-tests.py: Added a lot of new tests.
386 test_s3cmd("Simple delete", ['del', 's3://s3cmd-autotest-1/xyz/etc2/Logo.PNG'],
e5b4705c »
2009-02-14 * run-tests.py: Fixed for new messages.
387 must_find = [ "File s3://s3cmd-autotest-1/xyz/etc2/Logo.PNG deleted" ])
f11319be »
2008-11-30 * run-tests.py: Added a lot of new tests.
388
389
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
390 ## ====== Recursive delete
4986ae85 »
2008-12-31 * run-tests.py: Adapted to the above change.
391 test_s3cmd("Recursive delete", ['del', '--recursive', 's3://s3cmd-autotest-1/xyz/etc'],
e5b4705c »
2009-02-14 * run-tests.py: Fixed for new messages.
392 must_find_re = [ "File .*\.svn/format deleted" ])
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
393
394
395 ## ====== Recursive delete all
f11319be »
2008-11-30 * run-tests.py: Added a lot of new tests.
396 test_s3cmd("Recursive delete all", ['del', '--recursive', '--force', 's3://s3cmd-autotest-1'],
e5b4705c »
2009-02-14 * run-tests.py: Fixed for new messages.
397 must_find_re = [ "File .*binary/random-crap deleted" ])
f11319be »
2008-11-30 * run-tests.py: Added a lot of new tests.
398
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
399
400 ## ====== Remove empty bucket
f11319be »
2008-11-30 * run-tests.py: Added a lot of new tests.
401 test_s3cmd("Remove empty bucket", ['rb', 's3://s3cmd-autotest-1'],
402 must_find = [ "Bucket 's3://s3cmd-autotest-1/' removed" ])
330c51eb »
2008-09-09 * testsuite, run-tests.py: Added testsuite with first few tests.
403
ca86524c »
2008-12-29 * run-tests.py: Improved testsuite, added parameters support
404
405 ## ====== Remove remaining buckets
f11319be »
2008-11-30 * run-tests.py: Added a lot of new tests.
406 test_s3cmd("Remove remaining buckets", ['rb', '--recursive', 's3://s3cmd-autotest-2', 's3://s3cmd-Autotest-3'],
407 must_find = [ "Bucket 's3://s3cmd-autotest-2/' removed",
408 "Bucket 's3://s3cmd-Autotest-3/' removed" ])
Something went wrong with that request. Please try again.