~ubuntu-branches/ubuntu/utopic/dovecot/utopic-proposed

« back to all changes in this revision

Viewing changes to src/lib-index/test-mail-index-transaction-update.c

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-01-08 09:35:49 UTC
  • mfrom: (4.1.35 sid)
  • Revision ID: package-import@ubuntu.com-20140108093549-i72o93pux8p0dlaf
Tags: 1:2.2.9-1ubuntu1
* Merge from Debian unstable, remaining changes:
  + Add mail-stack-delivery package:
    - Update d/rules
    - d/control: convert existing dovecot-postfix package to a dummy
      package and add new mail-stack-delivery package.
    - Update maintainer scripts.
    - Rename d/dovecot-postfix.* to debian/mail-stack-delivery.*
    - d/mail-stack-delivery.preinst: Move previously installed backups and
      config files to a new package namespace.
    - d/mail-stack-delivery.prerm: Added to handle downgrades.
  + Use Snakeoil SSL certificates by default:
    - d/control: Depend on ssl-cert.
    - d/dovecot-core.postinst: Relax grep for SSL_* a bit.
  + Add autopkgtest to debian/tests/*.
  + Add ufw integration:
    - d/dovecot-core.ufw.profile: new ufw profile.
    - d/rules: install profile in dovecot-core.
    - d/control: dovecot-core - suggest ufw.
  + d/dovecot-core.dirs: Added usr/share/doc/dovecot-core
  + Add apport hook:
    - d/rules, d/source_dovecot.py
  + Add upstart job:
    - d/rules, d/dovecot-core.dovecot.upstart, d/control,
      d/dovecot-core.dirs, dovecot-imapd.{postrm, postinst, prerm},
      d/dovecot-pop3d.{postinst, postrm, prerm}.
      d/mail-stack-deliver.postinst: Convert init script to upstart.
  + Use the autotools-dev dh addon to update config.guess/config.sub for
    arm64.
* Dropped changes, included in Debian:
  - Update Dovecot name to reflect distribution in login greeting.
  - Update Drac plugin for >= 2.0.0 support.
* d/control: Drop dovecot-postfix package as its no longer required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2009-2012 Dovecot authors, see the included COPYING file */
 
1
/* Copyright (c) 2009-2013 Dovecot authors, see the included COPYING file */
2
2
 
3
3
#include "lib.h"
4
4
#include "array.h"
49
49
{
50
50
}
51
51
 
 
52
struct mail_keywords *
 
53
mail_index_keywords_create_from_indexes(struct mail_index *index ATTR_UNUSED,
 
54
                                        const ARRAY_TYPE(keyword_indexes)
 
55
                                                *keyword_indexes ATTR_UNUSED)
 
56
{
 
57
        return NULL;
 
58
}
 
59
 
 
60
void mail_index_keywords_unref(struct mail_keywords **keywords ATTR_UNUSED)
 
61
{
 
62
}
 
63
 
52
64
static struct mail_index_transaction *
53
65
mail_index_transaction_new(void)
54
66
{
131
143
static void test_mail_index_flag_update_fastpath(void)
132
144
{
133
145
        struct mail_index_transaction *t;
134
 
        const struct mail_transaction_flag_update *updates;
 
146
        const struct mail_index_flag_update *updates;
135
147
        unsigned int count;
136
148
 
137
149
        hdr.messages_count = 20;
160
172
        test_assert(updates[0].add_flags == MAIL_DELETED);
161
173
        test_assert(updates[0].remove_flags ==
162
174
                    (MAIL_ANSWERED | MAIL_FLAGGED | MAIL_SEEN | MAIL_DRAFT));
163
 
        test_assert(updates[0].padding == 0);
164
175
        test_assert(updates[1].uid1 == 16);
165
176
        test_assert(updates[1].uid2 == 16);
166
177
        test_assert(updates[1].add_flags == MAIL_DELETED);
167
178
        test_assert(updates[1].remove_flags == 0);
168
 
        test_assert(updates[1].padding == 0);
169
179
        test_assert(!t->log_updates);
170
180
        test_end();
171
181
}
173
183
static void test_mail_index_flag_update_simple_merges(void)
174
184
{
175
185
        struct mail_index_transaction *t;
176
 
        const struct mail_transaction_flag_update *updates;
 
186
        const struct mail_index_flag_update *updates;
177
187
        unsigned int count;
178
188
 
179
189
        hdr.messages_count = 20;
216
226
static void test_mail_index_flag_update_complex_merges(void)
217
227
{
218
228
        struct mail_index_transaction *t;
219
 
        const struct mail_transaction_flag_update *updates;
 
229
        const struct mail_index_flag_update *updates;
220
230
        unsigned int count;
221
231
 
222
232
        hdr.messages_count = 20;
271
281
        test_end();
272
282
}
273
283
 
274
 
static bool
 
284
static void
275
285
flags_array_check(struct mail_index_transaction *t,
276
286
                  const enum mail_flags *flags, unsigned int msg_count)
277
287
{
278
 
        const struct mail_transaction_flag_update *updates;
 
288
        const struct mail_index_flag_update *updates;
279
289
        unsigned int i, count, seq;
280
290
 
281
291
        if (array_is_created(&t->updates))
298
308
        }
299
309
        for (; seq <= msg_count; seq++)
300
310
                test_assert(flags[seq] == 0);
301
 
        return TRUE;
302
311
}
303
312
 
304
313
static void test_mail_index_flag_update_random(void)
349
358
static void test_mail_index_cancel_flag_updates(void)
350
359
{
351
360
        struct mail_index_transaction *t;
352
 
        const struct mail_transaction_flag_update *updates;
 
361
        const struct mail_index_flag_update *updates;
353
362
        unsigned int count;
354
363
 
355
364
        hdr.messages_count = 20;
361
370
        updates = array_get(&t->updates, &count);
362
371
        test_assert(count == 1);
363
372
        test_assert(updates[0].uid1 == 5 && updates[0].uid2 == 7);
364
 
        mail_index_cancel_flag_updates(t, 5);
 
373
        test_assert(mail_index_cancel_flag_updates(t, 5));
365
374
        test_assert(updates[0].uid1 == 6 && updates[0].uid2 == 7);
366
 
        mail_index_cancel_flag_updates(t, 7);
 
375
        test_assert(mail_index_cancel_flag_updates(t, 7));
367
376
        test_assert(updates[0].uid1 == 6 && updates[0].uid2 == 6);
368
 
        mail_index_cancel_flag_updates(t, 6);
 
377
        test_assert(mail_index_cancel_flag_updates(t, 6));
369
378
        test_assert(!array_is_created(&t->updates));
370
379
 
371
380
        mail_index_update_flags_range(t, 5, 7, MODIFY_REPLACE, 0);
372
 
        mail_index_cancel_flag_updates(t, 6);
 
381
        test_assert(mail_index_cancel_flag_updates(t, 6));
373
382
        updates = array_get(&t->updates, &count);
374
383
        test_assert(count == 2);
375
384
        test_assert(updates[0].uid1 == 5 && updates[0].uid2 == 5);
382
391
{
383
392
        struct mail_index_transaction *t;
384
393
        const struct mail_index_record *appends;
385
 
        const struct mail_transaction_flag_update *updates;
 
394
        const struct mail_index_flag_update *updates;
386
395
        unsigned int count;
387
396
        uint32_t seq;
388
397