~ubuntu-branches/debian/sid/subversion/sid

« back to all changes in this revision

Viewing changes to subversion/tests/cmdline/wc_tests.py

  • Committer: Package Import Robot
  • Author(s): James McCoy
  • Date: 2015-08-07 21:32:47 UTC
  • mfrom: (0.2.15) (4.1.7 experimental)
  • Revision ID: package-import@ubuntu.com-20150807213247-ozyewtmgsr6tkewl
Tags: 1.9.0-1
* Upload to unstable
* New upstream release.
  + Security fixes
    - CVE-2015-3184: Mixed anonymous/authenticated path-based authz with
      httpd 2.4
    - CVE-2015-3187: svn_repos_trace_node_locations() reveals paths hidden
      by authz
* Add >= 2.7 requirement for python-all-dev Build-Depends, needed to run
  tests.
* Remove Build-Conflicts against ruby-test-unit.  (Closes: #791844)
* Remove patches/apache_module_dependency in favor of expressing the
  dependencies in authz_svn.load/dav_svn.load.
* Build-Depend on apache2-dev (>= 2.4.16) to ensure ap_some_authn_required()
  is available when building mod_authz_svn and Depend on apache2-bin (>=
  2.4.16) for runtime support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
Issue = svntest.testcase.Issue_deco
43
43
Wimp = svntest.testcase.Wimp_deco
44
44
Item = wc.StateItem
 
45
UnorderedOutput = svntest.verify.UnorderedOutput
45
46
 
46
47
######################################################################
47
48
# Tests
131
132
  sbox.build(read_only = True)
132
133
  os.chmod(sbox.ospath(".svn/wc.db"), 0)
133
134
  svntest.actions.run_and_verify_svn(
134
 
    "Status when wc.db is not accessible", None,
 
135
    None,
135
136
    r"[^ ]+ E155016: The working copy database at '.*' is corrupt",
136
137
    "st", sbox.wc_dir)
137
138
 
143
144
  with open(sbox.ospath(".svn/wc.db"), 'wb') as fd:
144
145
    fd.write('\0' * 17)
145
146
  svntest.actions.run_and_verify_svn(
146
 
    "Status when wc.db is corrupt", None,
 
147
    None,
147
148
    r"[^ ]+ E155016: The working copy database at '.*' is corrupt",
148
149
    "st", sbox.wc_dir)
149
150
 
154
155
  sbox.build(read_only = True)
155
156
  os.close(os.open(sbox.ospath(".svn/wc.db"), os.O_RDWR | os.O_TRUNC))
156
157
  svntest.actions.run_and_verify_svn(
157
 
    "Status when wc.db has zero length", None,
 
158
    None,
158
159
    r"[^ ]+ E200030:",                    # SVN_ERR_SQLITE_ERROR
159
160
    "st", sbox.wc_dir)
160
161
 
165
166
  sbox.build(read_only = True)
166
167
  os.remove(sbox.ospath(".svn/wc.db"))
167
168
  svntest.actions.run_and_verify_svn(
168
 
    "Status when wc.db is missing", None,
 
169
    None,
169
170
    r"[^ ]+ E155016: The working copy database at '.*' is missing",
170
171
    "st", sbox.wc_dir)
171
172
 
178
179
  os.remove(sbox.ospath(".svn/wc.db"))
179
180
  os.remove(sbox.ospath(".svn/entries"))
180
181
  svntest.actions.run_and_verify_svn2(
181
 
    "Status when wc.db and entries are missing", None,
 
182
    None,
182
183
    r"[^ ]+ warning: W155007: '.*' is not a working copy",
183
184
    0, "st", sbox.wc_dir)
184
185
 
191
192
    fd.write('something\n')
192
193
    os.remove(sbox.ospath(".svn/wc.db"))
193
194
  svntest.actions.run_and_verify_svn(
194
 
    "Status when wc.db is missing and .svn/entries might be valid", None,
 
195
    None,
195
196
    r"[^ ]+ E155036:",                    # SVN_ERR_WC_UPGRADE_REQUIRED
196
197
    "st", sbox.wc_dir)
197
198
 
202
203
 
203
204
  sbox.build(read_only = True)
204
205
  svntest.actions.lock_admin_dir(sbox.ospath(""), True)
205
 
  svntest.actions.run_and_verify_svn("Cleanup below wc root", None, [],
 
206
  svntest.actions.run_and_verify_svn(None, [],
206
207
                                     "cleanup", sbox.ospath("A"))
207
208
 
208
209
@SkipUnless(svntest.main.is_posix_os)
221
222
  # Subversion 1.8.0 crashes when updating a working copy through a symlink
222
223
  svntest.actions.run_and_verify_update(wc_dir, expected_output,
223
224
                                        expected_disk, expected_status,
224
 
                                        None, None, None, None, None, 1,
225
 
                                        symlink)
 
225
                                        [], True, symlink)
 
226
 
 
227
@Issue(3549)
 
228
def cleanup_unversioned_items(sbox):
 
229
  """cleanup --remove-unversioned / --remove-ignored"""
 
230
 
 
231
  sbox.build(read_only = True)
 
232
  wc_dir = sbox.wc_dir
 
233
 
 
234
  # create some unversioned items
 
235
  os.mkdir(sbox.ospath('dir1'))
 
236
  os.mkdir(sbox.ospath('dir2'))
 
237
  contents = "This is an unversioned file\n."
 
238
  svntest.main.file_write(sbox.ospath('dir1/dir1_child1'), contents)
 
239
  svntest.main.file_write(sbox.ospath('dir2/dir2_child1'), contents)
 
240
  os.mkdir(sbox.ospath('dir2/foo_child2'))
 
241
  svntest.main.file_write(sbox.ospath('file_foo'), contents),
 
242
  os.mkdir(sbox.ospath('dir_foo'))
 
243
  svntest.main.file_write(sbox.ospath('dir_foo/foo_child1'), contents)
 
244
  os.mkdir(sbox.ospath('dir_foo/foo_child2'))
 
245
  # a file that matches a default ignore pattern
 
246
  svntest.main.file_write(sbox.ospath('foo.o'), contents)
 
247
 
 
248
  # ignore some of the unversioned items
 
249
  sbox.simple_propset('svn:ignore', '*_foo', '.')
 
250
 
 
251
  os.chdir(wc_dir)
 
252
 
 
253
  expected_output = [
 
254
        ' M      .\n',
 
255
        '?       dir1\n',
 
256
        '?       dir2\n',
 
257
  ]
 
258
  svntest.actions.run_and_verify_svn(UnorderedOutput(expected_output),
 
259
                                     [], 'status')
 
260
  expected_output += [
 
261
        'I       dir_foo\n',
 
262
        'I       file_foo\n',
 
263
        'I       foo.o\n',
 
264
  ]
 
265
  svntest.actions.run_and_verify_svn(UnorderedOutput(expected_output),
 
266
                                     [], 'status', '--no-ignore')
 
267
 
 
268
  expected_output = [
 
269
        'D         dir1\n',
 
270
        'D         dir2\n',
 
271
  ]
 
272
  svntest.actions.run_and_verify_svn(UnorderedOutput(expected_output),
 
273
                                     [], 'cleanup', '--remove-unversioned')
 
274
  expected_output = [
 
275
        ' M      .\n',
 
276
        'I       dir_foo\n',
 
277
        'I       file_foo\n',
 
278
        'I       foo.o\n',
 
279
  ]
 
280
  svntest.actions.run_and_verify_svn(UnorderedOutput(expected_output),
 
281
                                     [], 'status', '--no-ignore')
 
282
 
 
283
  # remove ignored items, with an empty global-ignores list
 
284
  expected_output = [
 
285
        'D         dir_foo\n',
 
286
        'D         file_foo\n',
 
287
  ]
 
288
  svntest.actions.run_and_verify_svn(UnorderedOutput(expected_output),
 
289
                                     [], 'cleanup', '--remove-ignored',
 
290
                                     '--config-option',
 
291
                                     'config:miscellany:global-ignores=')
 
292
 
 
293
  # the file matching global-ignores should still be present
 
294
  expected_output = [
 
295
        ' M      .\n',
 
296
        'I       foo.o\n',
 
297
  ]
 
298
  svntest.actions.run_and_verify_svn(UnorderedOutput(expected_output),
 
299
                                     [], 'status', '--no-ignore')
 
300
 
 
301
  # un-ignore the file matching global ignores, making it unversioned,
 
302
  # and remove it with --remove-unversioned
 
303
  expected_output = [
 
304
        'D         foo.o\n',
 
305
  ]
 
306
  svntest.actions.run_and_verify_svn(UnorderedOutput(expected_output),
 
307
                                     [], 'cleanup', '--remove-unversioned',
 
308
                                     '--config-option',
 
309
                                     'config:miscellany:global-ignores=')
 
310
  expected_output = [
 
311
        ' M      .\n',
 
312
  ]
 
313
  svntest.actions.run_and_verify_svn(expected_output,
 
314
                                     [], 'status', '--no-ignore')
 
315
 
 
316
def cleanup_unversioned_items_in_locked_wc(sbox):
 
317
  """cleanup unversioned items in locked WC should fail"""
 
318
 
 
319
  sbox.build(read_only = True)
 
320
 
 
321
  contents = "This is an unversioned file\n."
 
322
  svntest.main.file_write(sbox.ospath('unversioned_file'), contents)
 
323
 
 
324
  svntest.actions.lock_admin_dir(sbox.ospath(""), True)
 
325
  for option in ['--remove-unversioned', '--remove-ignored']:
 
326
    svntest.actions.run_and_verify_svn(None,
 
327
                                       "svn: E155004: Working copy locked;.*",
 
328
                                       "cleanup", option,
 
329
                                       sbox.ospath(""))
 
330
 
 
331
def cleanup_dir_external(sbox):
 
332
  """cleanup --include-externals"""
 
333
 
 
334
  sbox.build(read_only = True)
 
335
 
 
336
  # configure a directory external
 
337
  sbox.simple_propset("svn:externals", "^/A A_ext", ".")
 
338
  sbox.simple_update()
 
339
 
 
340
  svntest.actions.lock_admin_dir(sbox.ospath("A_ext"), True)
 
341
  svntest.actions.run_and_verify_svn(["Performing cleanup on external " +
 
342
                                     "item at '%s'.\n" % sbox.ospath("A_ext")],
 
343
                                     [], "cleanup", '--include-externals',
 
344
                                     sbox.ospath(""))
 
345
 
 
346
@Issue(4390)
 
347
def checkout_within_locked_wc(sbox):
 
348
  """checkout within a locked working copy"""
 
349
 
 
350
  sbox.build(read_only = True)
 
351
 
 
352
  # lock working copy and create outstanding work queue items
 
353
  svntest.actions.lock_admin_dir(sbox.ospath(""), True, True)
 
354
  expected_output = [
 
355
  "A    %s\n" % sbox.ospath("nested-wc/alpha"),
 
356
  "A    %s\n" % sbox.ospath("nested-wc/beta"),
 
357
  "Checked out revision 1.\n"
 
358
  ]
 
359
  svntest.actions.run_and_verify_svn(UnorderedOutput(expected_output),
 
360
                                     [], "checkout", sbox.repo_url + '/A/B/E',
 
361
                                     sbox.ospath("nested-wc"))
 
362
 
226
363
 
227
364
########################################################################
228
365
# Run the tests
243
380
              status_with_missing_wc_db_and_maybe_valid_entries,
244
381
              cleanup_below_wc_root,
245
382
              update_through_unversioned_symlink,
 
383
              cleanup_unversioned_items,
 
384
              cleanup_unversioned_items_in_locked_wc,
 
385
              cleanup_dir_external,
 
386
              checkout_within_locked_wc,
246
387
             ]
247
388
 
248
389
if __name__ == '__main__':