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

« back to all changes in this revision

Viewing changes to subversion/tests/libsvn_subr/compat-test.c

  • Committer: Package Import Robot
  • Author(s): James McCoy, Peter Samuelson, James McCoy
  • Date: 2014-01-12 19:48:33 UTC
  • mfrom: (0.2.10)
  • Revision ID: package-import@ubuntu.com-20140112194833-w3axfwksn296jn5x
Tags: 1.8.5-1
[ Peter Samuelson ]
* New upstream release.  (Closes: #725787) Rediff patches:
  - Remove apr-abi1 (applied upstream), rename apr-abi2 to apr-abi
  - Remove loosen-sqlite-version-check (shouldn't be needed)
  - Remove java-osgi-metadata (applied upstream)
  - svnmucc prompts for a changelog if none is provided. (Closes: #507430)
  - Remove fix-bdb-version-detection, upstream uses "apu-config --dbm-libs"
  - Remove ruby-test-wc (applied upstream)
  - Fix “svn diff -r N file” when file has svn:mime-type set.
    (Closes: #734163)
  - Support specifying an encoding for mod_dav_svn's environment in which
    hooks are run.  (Closes: #601544)
  - Fix ordering of “svnadmin dump” paths with certain APR versions.
    (Closes: #687291)
  - Provide a better error message when authentication fails with an
    svn+ssh:// URL.  (Closes: #273874)
  - Updated Polish translations.  (Closes: #690815)

[ James McCoy ]
* Remove all traces of libneon, replaced by libserf.
* patches/sqlite_3.8.x_workaround: Upstream fix for wc-queries-test test
  failurse.
* Run configure with --with-apache-libexecdir, which allows removing part of
  patches/rpath.
* Re-enable auth-test as upstream has fixed the problem of picking up
  libraries from the environment rather than the build tree.
  (Closes: #654172)
* Point LD_LIBRARY_PATH at the built auth libraries when running the svn
  command during the build.  (Closes: #678224)
* Add a NEWS entry describing how to configure mod_dav_svn to understand
  UTF-8.  (Closes: #566148)
* Remove ancient transitional package, libsvn-ruby.
* Enable compatibility with Sqlite3 versions back to Wheezy.
* Enable hardening flags.  (Closes: #734918)
* patches/build-fixes: Enable verbose build logs.
* Build against the default ruby version.  (Closes: #722393)

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include <apr_pools.h>
25
25
 
26
26
#include "svn_error.h"
 
27
#include "svn_pools.h"
27
28
#include "svn_version.h"
28
29
 
29
30
#include "../svn_test.h"
30
31
#include "svn_private_config.h"
 
32
#include "private/svn_subr_private.h"
31
33
 
32
34
#ifndef SVN_DISABLE_FULL_VERSION_MATCH
33
35
#define FALSE_IF_FULL FALSE
100
102
  return SVN_NO_ERROR;
101
103
}
102
104
 
 
105
 
 
106
static svn_error_t *
 
107
test_version_parsing(apr_pool_t *pool)
 
108
{
 
109
  unsigned int i;
 
110
  apr_pool_t *iterpool;
 
111
 
 
112
  struct version_pair {
 
113
    const char *str;
 
114
    svn_boolean_t malformed;
 
115
    svn_version_t version;
 
116
  } versions[] = {
 
117
    /*  str          malformed        version   */
 
118
    { "1.8",           FALSE,     { 1,  8,  0, ""} },
 
119
    { "1.8-dev",        TRUE,     { 0,  0,  0, ""} },
 
120
    { "1.1.0",         FALSE,     { 1,  1,  0, ""} },
 
121
    { "1.1.3",         FALSE,     { 1,  1,  3, ""} },
 
122
    { "2.10.0",        FALSE,     { 2, 10,  0, ""} },
 
123
    { "1.8.0-dev",     FALSE,     { 1,  8,  0, "dev"} },
 
124
    { "1.7.0-beta1",   FALSE,     { 1,  7,  0, "beta1"} },
 
125
    { "1a.8.0",         TRUE,     { 0,  0,  0, ""} },
 
126
    { "1a.8.0",         TRUE,     { 0,  0,  0, ""} },
 
127
    { "1.a8.0",         TRUE,     { 0,  0,  0, ""} },
 
128
    { "1.8.0a",         TRUE,     { 0,  0,  0, ""} },
 
129
    { "1.8.0.1",        TRUE,     { 0,  0,  0, ""} },
 
130
  };
 
131
 
 
132
  iterpool = svn_pool_create(pool);
 
133
  for (i = 0; i < sizeof(versions)/sizeof(versions[0]); ++i)
 
134
    {
 
135
      svn_version_t *version;
 
136
      svn_error_t *err;
 
137
 
 
138
      svn_pool_clear(iterpool);
 
139
 
 
140
      err = svn_version__parse_version_string(&version, versions[i].str,
 
141
                                              iterpool);
 
142
      if (err && (err->apr_err != SVN_ERR_MALFORMED_VERSION_STRING))
 
143
        return svn_error_create(SVN_ERR_TEST_FAILED, err,
 
144
                                "Unexpected error code");
 
145
      if (err)
 
146
        {
 
147
          if (! versions[i].malformed)
 
148
            return svn_error_create(SVN_ERR_TEST_FAILED, err,
 
149
                                    "Unexpected parsing error returned");
 
150
          else
 
151
            svn_error_clear(err);
 
152
        }
 
153
      else
 
154
        {
 
155
          if (versions[i].malformed)
 
156
            return svn_error_create(SVN_ERR_TEST_FAILED, NULL,
 
157
                                    "Parsing error expected; none returned");
 
158
          if (! svn_ver_equal(version, &(versions[i].version)))
 
159
            return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
 
160
                                     "Parsed version of '%s' doesn't match "
 
161
                                     "expected", versions[i].str);
 
162
        }
 
163
    }
 
164
  svn_pool_destroy(iterpool);
 
165
 
 
166
  return SVN_NO_ERROR;
 
167
}
 
168
 
 
169
static svn_error_t *
 
170
test_version_at_least(apr_pool_t *pool)
 
171
{
 
172
  unsigned int i;
 
173
 
 
174
  struct version_pair {
 
175
    svn_version_t version;
 
176
    int major;
 
177
    int minor;
 
178
    int patch;
 
179
    svn_boolean_t at_least;
 
180
  } versions[] = {
 
181
    /* maj  min  pat     version   at_least */
 
182
    { { 1, 3, 3, ""},    1, 3, 3,    TRUE },
 
183
    { { 1, 3, 3, ""},    1, 3, 4,    FALSE },
 
184
    { { 1, 3, 3, ""},    1, 4, 3,    FALSE },
 
185
    { { 1, 3, 3, ""},    0, 4, 3,    TRUE },
 
186
    { { 1, 3, 3, ""},    2, 0, 0,    FALSE },
 
187
    { { 1, 3, 3, ""},    1, 3, 2,    TRUE },
 
188
    { { 1, 3, 3, ""},    1, 2, 4,    TRUE },
 
189
    { { 1, 3, 3, "dev"}, 1, 3, 2,    TRUE },
 
190
    { { 1, 3, 3, "dev"}, 1, 3, 3,    FALSE },
 
191
    { { 1, 3, 3, ""},    0, 4, 3,    TRUE },
 
192
  };
 
193
 
 
194
  for (i = 0; i < sizeof(versions)/sizeof(versions[0]); ++i)
 
195
    {
 
196
      svn_boolean_t at_least = svn_version__at_least(&(versions[i].version),
 
197
                                                     versions[i].major,
 
198
                                                     versions[i].minor,
 
199
                                                     versions[i].patch);
 
200
      if (at_least && (! versions[i].at_least))
 
201
        return svn_error_create(SVN_ERR_TEST_FAILED, NULL,
 
202
                                "Expected at-least to be FALSE; got TRUE");
 
203
      if ((! at_least) && versions[i].at_least)
 
204
        return svn_error_create(SVN_ERR_TEST_FAILED, NULL,
 
205
                                "Expected at-least to be TRUE; got FALSE");
 
206
    }
 
207
 
 
208
  return SVN_NO_ERROR;
 
209
}
 
210
 
103
211
/* An array of all test functions */
104
212
struct svn_test_descriptor_t test_funcs[] =
105
213
  {
106
214
    SVN_TEST_NULL,
107
215
    SVN_TEST_PASS2(test_version_compatibility,
108
216
                   "svn_ver_compatible"),
 
217
    SVN_TEST_PASS2(test_version_parsing,
 
218
                   "svn_version__parse_version_string"),
 
219
    SVN_TEST_PASS2(test_version_at_least,
 
220
                   "svn_version__at_least"),
109
221
    SVN_TEST_NULL
110
222
  };