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

« back to all changes in this revision

Viewing changes to subversion/tests/libsvn_repos/repos-test.c

  • Committer: Package Import Robot
  • Author(s): James McCoy
  • Date: 2014-05-20 22:45:32 UTC
  • mfrom: (0.2.12)
  • Revision ID: package-import@ubuntu.com-20140520224532-4fec3gohdzyy692g
Tags: 1.8.9-1
* New upstream release
* Merge changes from Ubuntu:
  - Add DEB-8 test for Apache functionality
  - debian/rules: Create pot file on build.
  - debian/rules: Ensure the doxygen output directory exists
  - Move svn2cl to subversion-tools' Suggests on Ubuntu.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3261
3261
}
3262
3262
 
3263
3263
 
 
3264
/* Notification receiver for test_dump_bad_mergeinfo(). This does not
 
3265
   need to do anything, it just needs to exist.
 
3266
 */
 
3267
static void
 
3268
dump_r0_mergeinfo_notifier(void *baton,
 
3269
                           const svn_repos_notify_t *notify,
 
3270
                           apr_pool_t *scratch_pool)
 
3271
{
 
3272
}
 
3273
 
 
3274
/* Regression test for part the 'dump' part of issue #4476 "Mergeinfo
 
3275
   containing r0 makes svnsync and svnadmin dump fail". */
 
3276
static svn_error_t *
 
3277
test_dump_r0_mergeinfo(const svn_test_opts_t *opts,
 
3278
                       apr_pool_t *pool)
 
3279
{
 
3280
  svn_repos_t *repos;
 
3281
  svn_fs_t *fs;
 
3282
  svn_fs_txn_t *txn;
 
3283
  svn_fs_root_t *txn_root;
 
3284
  svn_revnum_t youngest_rev = 0;
 
3285
  const svn_string_t *bad_mergeinfo = svn_string_create("/foo:0", pool);
 
3286
 
 
3287
  SVN_ERR(svn_test__create_repos(&repos, "test-repo-dump-r0-mergeinfo",
 
3288
                                 opts, pool));
 
3289
  fs = svn_repos_fs(repos);
 
3290
 
 
3291
  /* Revision 1:  Any commit will do, here  */
 
3292
  SVN_ERR(svn_fs_begin_txn(&txn, fs, youngest_rev, pool));
 
3293
  SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));
 
3294
  SVN_ERR(svn_fs_make_dir(txn_root, "/bar", pool));
 
3295
  SVN_ERR(svn_repos_fs_commit_txn(NULL, repos, &youngest_rev, txn, pool));
 
3296
  SVN_TEST_ASSERT(SVN_IS_VALID_REVNUM(youngest_rev));
 
3297
 
 
3298
  /* Revision 2:  Add bad mergeinfo */
 
3299
  SVN_ERR(svn_fs_begin_txn(&txn, fs, youngest_rev, pool));
 
3300
  SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));
 
3301
  SVN_ERR(svn_fs_change_node_prop(txn_root, "/bar", "svn:mergeinfo", bad_mergeinfo, pool));
 
3302
  SVN_ERR(svn_repos_fs_commit_txn(NULL, repos, &youngest_rev, txn, pool));
 
3303
  SVN_TEST_ASSERT(SVN_IS_VALID_REVNUM(youngest_rev));
 
3304
 
 
3305
  /* Test that a dump completes without error. In order to exercise the
 
3306
     functionality under test -- that is, in order for the dump to try to
 
3307
     parse the mergeinfo it is dumping -- the dump must start from a
 
3308
     revision greater than 1 and must take a notification callback. */
 
3309
  {
 
3310
    svn_stringbuf_t *stringbuf = svn_stringbuf_create_empty(pool);
 
3311
    svn_stream_t *stream = svn_stream_from_stringbuf(stringbuf, pool);
 
3312
 
 
3313
    SVN_ERR(svn_repos_dump_fs3(repos, stream, 2, SVN_INVALID_REVNUM,
 
3314
                               FALSE, FALSE,
 
3315
                               dump_r0_mergeinfo_notifier, NULL,
 
3316
                               NULL, NULL,
 
3317
                               pool));
 
3318
  }
 
3319
 
 
3320
  return SVN_NO_ERROR;
 
3321
}
 
3322
 
3264
3323
/* The test table.  */
3265
3324
 
3266
3325
struct svn_test_descriptor_t test_funcs[] =
3306
3365
                       "test svn_repos_delete"),
3307
3366
    SVN_TEST_OPTS_PASS(filename_with_control_chars,
3308
3367
                       "test filenames with control characters"),
 
3368
    SVN_TEST_OPTS_PASS(test_dump_r0_mergeinfo,
 
3369
                       "test dumping with r0 mergeinfo"),
3309
3370
    SVN_TEST_NULL
3310
3371
  };