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

« back to all changes in this revision

Viewing changes to subversion/tests/libsvn_delta/vdelta-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:
28
28
 
29
29
#include "../svn_test.h"
30
30
 
 
31
#include "svn_ctype.h"
31
32
#include "svn_delta.h"
32
33
#include "svn_error.h"
33
34
#include "svn_pools.h"
59
60
 
60
61
  *count = 0;
61
62
  *len = 0;
62
 
  svn_txdelta(&delta_stream,
63
 
              svn_stream_from_aprfile(source_file, fpool),
64
 
              svn_stream_from_aprfile(target_file, fpool),
65
 
              fpool);
 
63
  svn_txdelta2(&delta_stream,
 
64
               svn_stream_from_aprfile(source_file, fpool),
 
65
               svn_stream_from_aprfile(target_file, fpool),
 
66
               FALSE,
 
67
               fpool);
66
68
  do {
67
69
    svn_error_t *err;
68
70
    err = svn_txdelta_next_window(&delta_window, delta_stream, wpool);
82
84
}
83
85
 
84
86
 
85
 
static apr_file_t *
86
 
open_binary_read(const char *path, apr_pool_t *pool)
87
 
{
88
 
  apr_status_t apr_err;
89
 
  apr_file_t *fp;
90
 
 
91
 
  apr_err = apr_file_open(&fp, path, (APR_READ | APR_BINARY),
92
 
                          APR_OS_DEFAULT, pool);
93
 
 
94
 
  if (apr_err)
95
 
    {
96
 
      fprintf(stderr, "unable to open \"%s\" for reading\n", path);
97
 
      exit(1);
98
 
    }
99
 
 
100
 
  return fp;
101
 
}
102
 
 
103
 
 
104
 
int
105
 
main(int argc, char **argv)
106
 
{
107
 
  apr_file_t *source_file_A = NULL;
108
 
  apr_file_t *target_file_A = NULL;
 
87
static void
 
88
do_one_test_cycle(apr_file_t *source_file_A, apr_file_t *target_file_A,
 
89
                  apr_file_t *source_file_B, apr_file_t *target_file_B,
 
90
                  int quiet, apr_pool_t *pool)
 
91
{
109
92
  int count_A = 0;
110
93
  apr_off_t len_A = 0;
111
94
 
112
 
  apr_file_t *source_file_B = NULL;
113
 
  apr_file_t *target_file_B = NULL;
114
95
  int count_B = 0;
115
96
  apr_off_t len_B = 0;
116
97
 
117
 
  apr_pool_t *pool;
118
 
  int quiet = 0;
119
 
 
120
 
  if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'q')
121
 
    {
122
 
      quiet = 1;
123
 
      --argc; ++argv;
124
 
    }
125
 
 
126
 
  apr_initialize();
127
 
  pool = svn_pool_create(NULL);
128
 
 
129
 
  if (argc == 2)
130
 
    {
131
 
      target_file_A = open_binary_read(argv[1], pool);
132
 
    }
133
 
  else if (argc == 3)
134
 
    {
135
 
      source_file_A = open_binary_read(argv[1], pool);
136
 
      target_file_A = open_binary_read(argv[2], pool);
137
 
    }
138
 
  else if (argc == 4)
139
 
    {
140
 
      source_file_A = open_binary_read(argv[1], pool);
141
 
      target_file_A = open_binary_read(argv[2], pool);
142
 
      source_file_B = open_binary_read(argv[2], pool);
143
 
      target_file_B = open_binary_read(argv[3], pool);
144
 
    }
145
 
  else
146
 
    {
147
 
      fprintf(stderr,
148
 
              "Usage: vdelta-test [-q] <target>\n"
149
 
              "   or: vdelta-test [-q] <source> <target>\n"
150
 
              "   or: vdelta-test [-q] <source> <intermediate> <target>\n");
151
 
      exit(1);
152
 
    }
153
 
 
154
98
  do_one_diff(source_file_A, target_file_A,
155
99
              &count_A, &len_A, quiet, pool, "A ", stdout);
156
100
 
181
125
        apr_file_seek(target_file_B, APR_SET, &offset);
182
126
      }
183
127
 
184
 
      svn_txdelta(&stream_A,
185
 
                  svn_stream_from_aprfile(source_file_A, fpool),
186
 
                  svn_stream_from_aprfile(target_file_A, fpool),
187
 
                  fpool);
188
 
      svn_txdelta(&stream_B,
189
 
                  svn_stream_from_aprfile(source_file_B, fpool),
190
 
                  svn_stream_from_aprfile(target_file_B, fpool),
191
 
                  fpool);
 
128
      svn_txdelta2(&stream_A,
 
129
                   svn_stream_from_aprfile(source_file_A, fpool),
 
130
                   svn_stream_from_aprfile(target_file_A, fpool),
 
131
                   FALSE,
 
132
                   fpool);
 
133
      svn_txdelta2(&stream_B,
 
134
                   svn_stream_from_aprfile(source_file_B, fpool),
 
135
                   svn_stream_from_aprfile(target_file_B, fpool),
 
136
                   FALSE,
 
137
                   fpool);
192
138
 
193
139
      for (count_AB = 0; count_AB < count_B; ++count_AB)
194
140
        {
219
165
      fprintf(stdout, "AB: (LENGTH %" APR_OFF_T_FMT " +%d)\n",
220
166
              len_AB, count_AB);
221
167
    }
 
168
}
 
169
 
 
170
 
 
171
static apr_file_t *
 
172
open_binary_read(const char *path, apr_pool_t *pool)
 
173
{
 
174
  apr_status_t apr_err;
 
175
  apr_file_t *fp;
 
176
 
 
177
  apr_err = apr_file_open(&fp, path, (APR_READ | APR_BINARY),
 
178
                          APR_OS_DEFAULT, pool);
 
179
 
 
180
  if (apr_err)
 
181
    {
 
182
      fprintf(stderr, "unable to open \"%s\" for reading\n", path);
 
183
      exit(1);
 
184
    }
 
185
 
 
186
  return fp;
 
187
}
 
188
 
 
189
 
 
190
int
 
191
main(int argc, char **argv)
 
192
{
 
193
  apr_file_t *source_file_A = NULL;
 
194
  apr_file_t *target_file_A = NULL;
 
195
 
 
196
  apr_file_t *source_file_B = NULL;
 
197
  apr_file_t *target_file_B = NULL;
 
198
 
 
199
  apr_pool_t *pool;
 
200
  int quiet = 0;
 
201
  int repeat = 1;
 
202
 
 
203
  while (argc > 1)
 
204
    {
 
205
      const char *const arg = argv[1];
 
206
      if (arg[0] != '-')
 
207
        break;
 
208
 
 
209
      if (arg[1] == 'q')
 
210
        quiet = 1;
 
211
      else if (svn_ctype_isdigit(arg[1]))
 
212
        repeat = atoi(arg + 1);
 
213
      else
 
214
        break;
 
215
      --argc; ++argv;
 
216
    }
 
217
 
 
218
  apr_initialize();
 
219
  pool = svn_pool_create(NULL);
 
220
 
 
221
  if (argc == 2)
 
222
    {
 
223
      target_file_A = open_binary_read(argv[1], pool);
 
224
    }
 
225
  else if (argc == 3)
 
226
    {
 
227
      source_file_A = open_binary_read(argv[1], pool);
 
228
      target_file_A = open_binary_read(argv[2], pool);
 
229
    }
 
230
  else if (argc == 4)
 
231
    {
 
232
      source_file_A = open_binary_read(argv[1], pool);
 
233
      target_file_A = open_binary_read(argv[2], pool);
 
234
      source_file_B = open_binary_read(argv[2], pool);
 
235
      target_file_B = open_binary_read(argv[3], pool);
 
236
    }
 
237
  else
 
238
    {
 
239
      fprintf(stderr,
 
240
              "Usage: vdelta-test [-q] [-<repeat>] <target>\n"
 
241
              "   or: vdelta-test [-q] [-<repeat>] <source> <target>\n"
 
242
              "   or: vdelta-test [-q] [-<repeat>] "
 
243
              "<source> <intermediate> <target>\n");
 
244
      exit(1);
 
245
    }
 
246
 
 
247
  while (0 < repeat--)
 
248
    {
 
249
      apr_off_t offset = 0;
 
250
 
 
251
      do_one_test_cycle(source_file_A, target_file_A,
 
252
                        source_file_B, target_file_B,
 
253
                        quiet, pool);
 
254
 
 
255
      if (source_file_A) apr_file_seek(source_file_A, APR_SET, &offset);
 
256
      if (target_file_A) apr_file_seek(target_file_A, APR_SET, &offset);
 
257
      if (source_file_B) apr_file_seek(source_file_B, APR_SET, &offset);
 
258
      if (target_file_B) apr_file_seek(target_file_B, APR_SET, &offset);
 
259
    }
222
260
 
223
261
  if (source_file_A) apr_file_close(source_file_A);
224
262
  if (target_file_A) apr_file_close(target_file_A);