if (-123 != rev)
        return svn_error_createf
          (SVN_ERR_TEST_FAILED,
           NULL,
           "svn_revnum_parse('%s') should not change the revision "
           "for a bad string",
           *t);

      if (endptr != *t)
        return svn_error_createf
          (SVN_ERR_TEST_FAILED,
           NULL,
           "End pointer for svn_revnum_parse('%s') does not "
           "point to the start of the string",
           *t);
    }

  return SVN_NO_ERROR;
}


/* The test table.  */

struct svn_test_descriptor_t test_funcs[] =
  {
    SVN_TEST_NULL,
    SVN_TEST_PASS2(test_revnum_parse,
                   "test svn_revnum_parse"),
    SVN_TEST_NULL
  };
Ejemplo n.º 2
0
    if (!provider)
        return svn_error_createf
               (SVN_ERR_TEST_FAILED, NULL,
                "svn_auth_get_platform_specific_provider('kwallet', " \
                "'ssl_client_cert_pw') should not return NULL");

    /* Make sure you do not get a Windows auth provider */
    svn_auth_get_platform_specific_provider(&provider, "windows",
                                            "simple", pool);

    if (provider)
        return svn_error_createf
               (SVN_ERR_TEST_FAILED, NULL,
                "svn_auth_get_platform_specific_provider('windows', 'simple') should " \
                "return NULL");
#endif

    return SVN_NO_ERROR;
}


/* The test table.  */

struct svn_test_descriptor_t test_funcs[] =
{
    SVN_TEST_NULL,
    SVN_TEST_PASS2(test_platform_specific_auth_providers,
    "test retrieving platform-specific auth providers"),
    SVN_TEST_NULL
};
Ejemplo n.º 3
0
      struct err_defn e2 = error_table[i];

      /* Don't fail the test if there is an odd number of errors.
       * The error array's sentinel has an error code of zero. */
      if (i == NUM_ERRORS - 1 && e2.errcode == 0)
        break;

      /* SVN_ERR_WC_NOT_DIRECTORY is an alias for SVN_ERR_WC_NOT_WORKING_COPY
       * and shares the same error code. */
      if (e.errcode != SVN_ERR_WC_NOT_DIRECTORY &&
          e.errcode >= e2.errcode)
        return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
                                 "Error 0x%x (%s) is not < 0x%x (%s)\n",
                                 e.errcode, e.errdesc, e2.errcode, e2.errdesc);
      e = e2;
    }

  return SVN_NO_ERROR;
}


/* The test table.  */

struct svn_test_descriptor_t test_funcs[] =
  {
    SVN_TEST_NULL,
    SVN_TEST_PASS2(check_error_codes_unique,
                   "check that error codes are unique"),
    SVN_TEST_NULL
  };
Ejemplo n.º 4
0
static struct svn_test_descriptor_t test_funcs[] =
  {
    SVN_TEST_NULL,
    SVN_TEST_OPTS_PASS(test_text_retrieval,
                       "test svn_config"),
    SVN_TEST_OPTS_PASS(test_boolean_retrieval,
                       "test svn_config boolean conversion"),
    SVN_TEST_OPTS_PASS(test_has_section_case_insensitive,
                       "test svn_config_has_section (case insensitive)"),
    SVN_TEST_OPTS_PASS(test_has_section_case_sensitive,
                       "test svn_config_has_section (case sensitive)"),
    SVN_TEST_OPTS_PASS(test_has_option_case_sensitive,
                       "test case-sensitive option name lookup"),
    SVN_TEST_OPTS_PASS(test_stream_interface,
                       "test svn_config_parse"),
    SVN_TEST_PASS2(test_ignore_bom,
                   "test parsing config file with BOM"),
    SVN_TEST_OPTS_PASS(test_read_only_mode,
                       "test r/o mode"),
    SVN_TEST_OPTS_PASS(test_expand,
                       "test variable expansion"),
    SVN_TEST_PASS2(test_invalid_bom,
                   "test parsing config file with invalid BOM"),
    SVN_TEST_PASS2(test_serialization,
                   "test writing a config"),
    SVN_TEST_NULL
  };

SVN_TEST_MAIN
Ejemplo n.º 5
0
                                apr_psprintf(pool, "$%s$", keyword_m5),
                                pool));

  SVN_ERR(test_one_long_keyword(keyword_m6,
                                apr_psprintf(pool, "$%s$", keyword_m6),
                                pool));

  return SVN_NO_ERROR;
}

static int max_threads = 1;

static struct svn_test_descriptor_t test_funcs[] =
  {
    SVN_TEST_NULL,
    SVN_TEST_PASS2(test_svn_subst_translate_string2,
                   "test svn_subst_translate_string2()"),
    SVN_TEST_PASS2(test_svn_subst_translate_string2_null_encoding,
                   "test svn_subst_translate_string2(encoding = NULL)"),
    SVN_TEST_PASS2(test_repairing_svn_subst_translate_string2,
                   "test repairing svn_subst_translate_string2()"),
    SVN_TEST_PASS2(test_svn_subst_translate_cstring2,
                   "test svn_subst_translate_cstring2()"),
    SVN_TEST_PASS2(test_svn_subst_build_keywords3,
                   "test svn_subst_build_keywords3()"),
    SVN_TEST_PASS2(test_svn_subst_truncated_keywords,
                   "test truncated keywords (issue 4349)"),
    SVN_TEST_PASS2(test_svn_subst_long_keywords,
                   "test long keywords (issue 4350)"),
    SVN_TEST_NULL
  };
Ejemplo n.º 6
0
                          4 /* blocksize */,
                          10 /* maxsize */,
                          TRUE /* delte on close */,
                          TRUE /* spill all data */,
                          NULL, pool);
  return test_spillbuf__file_attrs(pool, TRUE, buf);
}

/* The test table.  */

static int max_threads = 1;

static struct svn_test_descriptor_t test_funcs[] =
  {
    SVN_TEST_NULL,
    SVN_TEST_PASS2(test_spillbuf_basic, "basic spill buffer test"),
    SVN_TEST_PASS2(test_spillbuf_basic_spill_all,
                   "basic spill buffer test (spill-all-data)"),
    SVN_TEST_PASS2(test_spillbuf_callback, "spill buffer read callback"),
    SVN_TEST_PASS2(test_spillbuf_callback_spill_all,
                   "spill buffer read callback (spill-all-data)"),
    SVN_TEST_PASS2(test_spillbuf_file, "spill buffer file test"),
    SVN_TEST_PASS2(test_spillbuf_file_spill_all,
                   "spill buffer file test (spill-all-data)"),
    SVN_TEST_PASS2(test_spillbuf_interleaving,
                   "interleaving reads and writes"),
    SVN_TEST_PASS2(test_spillbuf_interleaving_spill_all,
                   "interleaving reads and writes (spill-all-data)"),
    SVN_TEST_PASS2(test_spillbuf_reader, "spill buffer reader test"),
    SVN_TEST_PASS2(test_spillbuf_stream, "spill buffer stream test"),
    SVN_TEST_PASS2(test_spillbuf_rwfile, "read/write spill file"),
Ejemplo n.º 7
0
     be gone.  */

  /* Verify the forgotten spill file.  */
  SVN_ERR(svn_spillbuf__write(buf, "abcdef", 6, pool));
  SVN_ERR(svn_spillbuf__write(buf, "ghijkl", 6, pool));
  CHECK_READ(buf, 12, "abcd", pool);
  CHECK_READ(buf, 8, "ef", pool);
  CHECK_READ(buf, 6, "ghij", pool);
  /* Two unread bytes remaining in the spill file.  */
  SVN_TEST_ASSERT(svn_spillbuf__get_size(buf) == 2);

  return SVN_NO_ERROR;
}


/* The test table.  */
struct svn_test_descriptor_t test_funcs[] =
  {
    SVN_TEST_NULL,
    SVN_TEST_PASS2(test_spillbuf_basic, "basic spill buffer test"),
    SVN_TEST_PASS2(test_spillbuf_callback, "spill buffer read callback"),
    SVN_TEST_PASS2(test_spillbuf_file, "spill buffer file test"),
    SVN_TEST_PASS2(test_spillbuf_interleaving,
                   "interleaving reads and writes"),
    SVN_TEST_PASS2(test_spillbuf_reader, "spill buffer reader test"),
    SVN_TEST_PASS2(test_spillbuf_stream, "spill buffer stream test"),
    SVN_TEST_PASS2(test_spillbuf_rwfile, "read/write spill file"),
    SVN_TEST_PASS2(test_spillbuf_eof, "validate reaching EOF of spill file"),
    SVN_TEST_NULL
  };
Ejemplo n.º 8
0
                            "some more bytes to 'gamma'",
                            pool));

      reverse = !reverse;
      SVN_ERR(svn_diff_close_patch_file(patch_file, pool));
    }
  svn_pool_destroy(iterpool);
  return SVN_NO_ERROR;
}

/* ========================================================================== */

struct svn_test_descriptor_t test_funcs[] =
  {
    SVN_TEST_NULL,
    SVN_TEST_PASS2(test_parse_unidiff,
                   "test unidiff parsing"),
    SVN_TEST_PASS2(test_parse_git_diff,
                    "test git unidiff parsing"),
    SVN_TEST_PASS2(test_parse_git_tree_and_text_diff,
                   "test git unidiff parsing of tree and text changes"),
    SVN_TEST_PASS2(test_bad_git_diff_headers,
                    "test badly formatted git diff headers"),
    SVN_TEST_PASS2(test_parse_property_diff,
                   "test property unidiff parsing"),
    SVN_TEST_PASS2(test_parse_property_and_text_diff,
                   "test property and text unidiff parsing"),
    SVN_TEST_PASS2(test_parse_diff_symbols_in_prop_unidiff,
                   "test property diffs with odd symbols"),
    SVN_TEST_PASS2(test_git_diffs_with_spaces_diff,
                   "test git diffs with spaces in paths"),
    SVN_TEST_PASS2(test_parse_unidiff_lacking_trailing_eol,
Ejemplo n.º 9
0
static int max_threads = 1;

static struct svn_test_descriptor_t test_funcs[] =
  {
    SVN_TEST_NULL,
    SVN_TEST_OPTS_PASS(test_text_retrieval,
                       "test svn_config"),
    SVN_TEST_OPTS_PASS(test_boolean_retrieval,
                       "test svn_config boolean conversion"),
    SVN_TEST_OPTS_PASS(test_has_section_case_insensitive,
                       "test svn_config_has_section (case insensitive)"),
    SVN_TEST_OPTS_PASS(test_has_section_case_sensitive,
                       "test svn_config_has_section (case sensitive)"),
    SVN_TEST_OPTS_PASS(test_has_option_case_sensitive,
                       "test case-sensitive option name lookup"),
    SVN_TEST_OPTS_PASS(test_stream_interface,
                       "test svn_config_parse"),
    SVN_TEST_PASS2(test_ignore_bom,
                   "test parsing config file with BOM"),
    SVN_TEST_OPTS_PASS(test_read_only_mode,
                       "test r/o mode"),
    SVN_TEST_OPTS_PASS(test_expand,
                       "test variable expansion"),
    SVN_TEST_PASS2(test_invalid_bom,
                   "test parsing config file with invalid BOM"),
    SVN_TEST_NULL
  };

SVN_TEST_MAIN
Ejemplo n.º 10
0
store_load_many_strings_table(apr_pool_t *pool)
{
    return svn_error_trace(many_strings_table_body(TRUE, pool));
}


/* ------------------------------------------------------------------------ */

/* The test table.  */

static int max_threads = 4;

static struct svn_test_descriptor_t test_funcs[] =
{
    SVN_TEST_NULL,
    SVN_TEST_PASS2(create_empty_table,
    "create an empty string table"),
    SVN_TEST_PASS2(short_string_table,
    "string table with short strings only"),
    SVN_TEST_PASS2(large_string_table,
    "string table with large strings only"),
    SVN_TEST_PASS2(many_strings_table,
    "string table with many strings"),
    SVN_TEST_PASS2(store_load_empty_table,
    "store and load an empty string table"),
    SVN_TEST_PASS2(store_load_short_string_table,
    "store and load table with short strings only"),
    SVN_TEST_PASS2(store_load_large_string_table,
    "store and load table with large strings only"),
    SVN_TEST_PASS2(store_load_many_strings_table,
    "store and load string table with many strings"),
    SVN_TEST_NULL
Ejemplo n.º 11
0
  /* Zero matches anything of the same kind. */
  SVN_TEST_ASSERT(svn_checksum_match(A_md5, zero_md5));
  SVN_TEST_ASSERT(svn_checksum_match(zero_md5, B_md5));
  SVN_TEST_ASSERT(svn_checksum_match(A_sha1, zero_sha1));
  SVN_TEST_ASSERT(svn_checksum_match(zero_sha1, B_sha1));

  /* Zero doesn't match anything of a different kind... */
  SVN_TEST_ASSERT(!svn_checksum_match(zero_md5, A_sha1));
  SVN_TEST_ASSERT(!svn_checksum_match(zero_sha1, A_md5));
  /* ...even another zero. */
  SVN_TEST_ASSERT(!svn_checksum_match(zero_md5, zero_sha1));

  return SVN_NO_ERROR;
}

/* An array of all test functions */
struct svn_test_descriptor_t test_funcs[] =
  {
    SVN_TEST_NULL,
    SVN_TEST_PASS2(test_checksum_parse,
                   "checksum parse"),
    SVN_TEST_PASS2(test_checksum_empty,
                   "checksum emptiness"),
    SVN_TEST_PASS2(test_pseudo_md5,
                   "pseudo-md5 compatibility"),
    SVN_TEST_PASS2(zero_match,
                   "zero checksum matching"),
    SVN_TEST_NULL
  };
Ejemplo n.º 12
0
  SVN_ERR(svn_cache__set(cache, long_key, &fifty, pool));
  SVN_ERR(svn_cache__get((void **) &answer, &found, cache, long_key, pool));

  if (! found)
    return svn_error_create(SVN_ERR_TEST_FAILED, NULL,
                            "cache failed to find entry for 'fifty'");
  if (*answer != 50)
    return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
                             "expected 50 but found '%ld'", *answer);

  return SVN_NO_ERROR;
}


/* The test table.  */

struct svn_test_descriptor_t test_funcs[] =
  {
    SVN_TEST_NULL,
    SVN_TEST_PASS2(test_inprocess_cache_basic,
                   "basic inprocess svn_cache test"),
    SVN_TEST_OPTS_PASS(test_memcache_basic,
                       "basic memcache svn_cache test"),
    SVN_TEST_OPTS_PASS(test_memcache_long_key,
                       "memcache svn_cache with very long keys"),
    SVN_TEST_PASS2(test_membuffer_cache_basic,
                   "basic membuffer svn_cache test"),
    SVN_TEST_NULL
  };
Ejemplo n.º 13
0
        {
          return svn_error_createf
            (SVN_ERR_TEST_FAILED, NULL,
             "svn_utf_cstring_from_utf8_ex2 ('%s', '%s') returned ('%s') "
             "instead of ('%s')",
             tests[i].string, tests[i].to_page,
             dest,
             tests[i].expected_result);
        }
    }
  svn_pool_destroy(subpool);
  return SVN_NO_ERROR;
}


/* The test table.  */

struct svn_test_descriptor_t test_funcs[] =
  {
    SVN_TEST_NULL,
    SVN_TEST_PASS2(utf_validate,
                   "test is_valid/last_valid"),
    SVN_TEST_PASS2(utf_validate2,
                   "test last_valid/last_valid2"),
    SVN_TEST_PASS2(test_utf_cstring_to_utf8_ex2,
                   "test svn_utf_cstring_to_utf8_ex2"),
    SVN_TEST_PASS2(test_utf_cstring_from_utf8_ex2,
                   "test svn_utf_cstring_from_utf8_ex2"),
    SVN_TEST_NULL
  };
Ejemplo n.º 14
0
  SVN_TEST_ASSERT(found);
  SVN_ERR(svn_cache__has_key(&found, cache, "key C", pool));
  SVN_TEST_ASSERT(!found);

  return SVN_NO_ERROR;
}


/* The test table.  */

static int max_threads = 1;

static struct svn_test_descriptor_t test_funcs[] =
  {
    SVN_TEST_NULL,
    SVN_TEST_PASS2(test_inprocess_cache_basic,
                   "basic inprocess svn_cache test"),
    SVN_TEST_OPTS_PASS(test_memcache_basic,
                       "basic memcache svn_cache test"),
    SVN_TEST_OPTS_PASS(test_memcache_long_key,
                       "memcache svn_cache with very long keys"),
    SVN_TEST_PASS2(test_membuffer_cache_basic,
                   "basic membuffer svn_cache test"),
    SVN_TEST_PASS2(test_membuffer_serializer_error_handling,
                   "test for error handling in membuffer svn_cache"),
    SVN_TEST_PASS2(test_membuffer_cache_clearing,
                   "test clearing a membuffer svn_cache"),
    SVN_TEST_NULL
  };

SVN_TEST_MAIN
Ejemplo n.º 15
0
    return svn_error_create(SVN_ERR_TEST_FAILED, NULL,
                            "Got unexpected result.");

  SVN_ERR(svn_stream_close(stream));

  return SVN_NO_ERROR;
}

/* The test table.  */

static int max_threads = 1;

static struct svn_test_descriptor_t test_funcs[] =
  {
    SVN_TEST_NULL,
    SVN_TEST_PASS2(test_stream_from_string,
                   "test svn_stream_from_string"),
    SVN_TEST_PASS2(test_stream_compressed,
                   "test compressed streams"),
    SVN_TEST_PASS2(test_stream_tee,
                   "test 'tee' streams"),
    SVN_TEST_PASS2(test_stream_seek_file,
                   "test stream seeking for files"),
    SVN_TEST_PASS2(test_stream_seek_stringbuf,
                   "test stream seeking for stringbufs"),
    SVN_TEST_PASS2(test_stream_seek_translated,
                   "test stream seeking for translated streams"),
    SVN_TEST_PASS2(test_readonly,
                   "test setting a file readonly"),
    SVN_TEST_PASS2(test_stream_compressed_empty_file,
                   "test compressed streams with empty files"),
    SVN_TEST_PASS2(test_stream_base64,
      SVN_ERR(svn_stream_write(stream, strings[i], &len));
    }

  SVN_ERR(svn_stream_close(stream));

  SVN_TEST_STRING_ASSERT(actual->data, expected->data);

  return SVN_NO_ERROR;
}

/* The test table.  */

struct svn_test_descriptor_t test_funcs[] =
  {
    SVN_TEST_NULL,
    SVN_TEST_PASS2(test_stream_from_string,
                   "test svn_stream_from_string"),
    SVN_TEST_PASS2(test_stream_compressed,
                   "test compressed streams"),
    SVN_TEST_PASS2(test_stream_tee,
                   "test 'tee' streams"),
    SVN_TEST_PASS2(test_stream_seek_file,
                   "test stream seeking for files"),
    SVN_TEST_PASS2(test_stream_seek_stringbuf,
                   "test stream seeking for stringbufs"),
    SVN_TEST_PASS2(test_stream_seek_translated,
                   "test stream seeking for translated streams"),
    SVN_TEST_PASS2(test_readonly,
                   "test setting a file readonly"),
    SVN_TEST_PASS2(test_stream_compressed_empty_file,
                   "test compressed streams with empty files"),
    SVN_TEST_PASS2(test_stream_base64,
Ejemplo n.º 17
0
static svn_error_t *
test_compress_lz4_empty(apr_pool_t *pool)
{
  svn_stringbuf_t *compressed = svn_stringbuf_create_empty(pool);
  svn_stringbuf_t *decompressed = svn_stringbuf_create_empty(pool);

  SVN_ERR(svn__compress_lz4("", 0, compressed));
  SVN_ERR(svn__decompress_lz4(compressed->data, compressed->len,
                              decompressed, 100));
  SVN_TEST_STRING_ASSERT(decompressed->data, "");

  return SVN_NO_ERROR;
}

static int max_threads = -1;

static struct svn_test_descriptor_t test_funcs[] =
{
  SVN_TEST_NULL,
  SVN_TEST_PASS2(test_decompress_lz4,
                 "test svn__decompress_lz4()"),
  SVN_TEST_PASS2(test_compress_lz4,
                 "test svn__compress_lz4()"),
  SVN_TEST_PASS2(test_compress_lz4_empty,
                 "test svn__compress_lz4() with empty input"),
  SVN_TEST_NULL
};

SVN_TEST_MAIN
                                  pool));

    SVN_TEST_ASSERT(is_root);

    SVN_ERR(svn_wc__check_wc_root(&is_root, NULL, NULL, wc_ctx2->db, subdir,
                                  pool));

    /* This test was added to show a regression where the next check failed,
       but the check above this succeeded */
    SVN_TEST_ASSERT(is_root);

    SVN_ERR(svn_wc_locked2(&locked_here, &locked, wc_ctx2, subdir, pool));
    SVN_TEST_ASSERT(!locked_here && !locked);
  }

  return SVN_NO_ERROR;
}


struct svn_test_descriptor_t test_funcs[] =
  {
    SVN_TEST_NULL,
    SVN_TEST_PASS2(test_entries_alloc,
                   "entries are allocated in access baton"),
    SVN_TEST_PASS2(test_stubs,
                   "access baton mojo can return stubs"),
    SVN_TEST_PASS2(test_access_baton_like_locking,
                   "access baton like locks must work with wc-ng"),
    SVN_TEST_NULL
  };
Ejemplo n.º 19
0
  /* Verify pattern */
  for (i = 0; i < 15; ++i)
    for (k = i * SCALE + min; k < i * SCALE +  max; ++k)
      {
        if (k % 2)
          SVN_TEST_ASSERT(svn_bit_array__get(array, k) == TRUE);
        else
          SVN_TEST_ASSERT(svn_bit_array__get(array, k) == FALSE);
      }

  return SVN_NO_ERROR;
}

/* An array of all test functions */

static int max_threads = 1;

static struct svn_test_descriptor_t test_funcs[] =
  {
    SVN_TEST_NULL,
    SVN_TEST_PASS2(test_zero_defaults,
                   "check entries to default to zero"),
    SVN_TEST_PASS2(test_get_set,
                   "get / set entries"),
    SVN_TEST_PASS2(test_sparse,
                   "get / set sparse entries"),
    SVN_TEST_NULL
  };

SVN_TEST_MAIN
Ejemplo n.º 20
0
random_combine_test(apr_pool_t *pool)
{
  apr_uint32_t seed;
  svn_error_t *err = do_random_combine_test(pool, &seed);
  return err;
}


/* Change to 1 to enable the unit test for the delta combiner's range index: */
#if 0
#include "range-index-test.h"
#endif



/* The test table.  */

struct svn_test_descriptor_t test_funcs[] =
  {
    SVN_TEST_NULL,
    SVN_TEST_PASS2(random_test,
                   "random delta test"),
    SVN_TEST_PASS2(random_combine_test,
                   "random combine delta test"),
#ifdef SVN_RANGE_INDEX_TEST_H
    SVN_TEST_PASS2(random_range_index_test,
                   "random range index test"),
#endif
    SVN_TEST_NULL
  };