~ubuntu-branches/ubuntu/quantal/dovecot/quantal

« back to all changes in this revision

Viewing changes to sieve/src/testsuite/testsuite-common.c

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short, Scott Kitterman
  • Date: 2010-06-22 10:33:51 UTC
  • mfrom: (1.13.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20100622103351-ifbmnklp8kxrhb30
Tags: 1:1.2.12-0ubuntu1
* New upstream release:
  - deliver: Don't crash when a message with Auto-submitted: header gets
   rejected.
  - lib-storage: Fixed header searches to work correctly when there are
    multiple headers with same name.
  - dict client: Disconnect from dict server after 1 second of idling.
  - dict: If process crashed, it wasn't automatically restarted
  - dict file: If dict file's group permissions equal world permissions,
    don't try to change its gid.
  - maildir: Fixed a memory leak when copying with hardlinks.
  - maildir: Expunging last messages may have assert-crashed if their
    filenames had just changed.
 * Update sieve patch to 0.1.17
 * debian/dovecot-common.postinst: Add warning about expired certificate.
   (Debian Bug: #576455)
 * Silence lintian warnings.

 [Scott Kitterman]
 * Rename dovecot-postfix to mail-stack-delivery per server-maverick-mail-
   integration spec.
   - Update debian/rules
   - Convert existing package to a dummy package and add new binary in debian/control
   - Update maintainer scripts.
   - Move previously installed backups and config files to new package name
     space in preinst
   - Add new debian/mail-stack-delivery.prerm to handle downgrades
   - Rename debian/dovecot-postfix.* to debian/mail-stack-delivery.*

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
 
55
55
const struct sieve_extension *testsuite_ext;
56
56
 
57
 
/*
58
 
 * Validator context
 
57
/* 
 
58
 * Validator context 
59
59
 */
60
60
 
61
61
bool testsuite_validator_context_initialize(struct sieve_validator *valdtr)
62
62
{
63
63
        pool_t pool = sieve_validator_pool(valdtr);
64
 
        struct testsuite_validator_context *ctx =
 
64
        struct testsuite_validator_context *ctx = 
65
65
                p_new(pool, struct testsuite_validator_context, 1);
66
 
 
 
66
        
67
67
        /* Setup object registry */
68
68
        ctx->object_registrations = sieve_validator_object_registry_create(valdtr);
69
69
        testsuite_register_core_objects(ctx);
70
 
 
 
70
        
71
71
        sieve_validator_extension_set_context(valdtr, testsuite_ext, ctx);
72
72
 
73
73
        return TRUE;
80
80
                sieve_validator_extension_get_context(valdtr, testsuite_ext);
81
81
}
82
82
 
83
 
/*
84
 
 * Generator context
 
83
/* 
 
84
 * Generator context 
85
85
 */
86
86
 
87
87
bool testsuite_generator_context_initialize
89
89
{
90
90
        pool_t pool = sieve_generator_pool(gentr);
91
91
        struct sieve_binary *sbin = sieve_generator_get_binary(gentr);
92
 
        struct testsuite_generator_context *ctx =
 
92
        struct testsuite_generator_context *ctx = 
93
93
                p_new(pool, struct testsuite_generator_context, 1);
94
 
 
 
94
        
95
95
        /* Setup exit jumplist */
96
96
        ctx->exit_jumps = sieve_jumplist_create(pool, sbin);
97
 
 
 
97
        
98
98
        sieve_generator_extension_set_context(gentr, this_ext, ctx);
99
99
 
100
100
        return TRUE;
103
103
/*
104
104
 * Test context
105
105
 */
106
 
 
 
106
 
107
107
static void testsuite_test_context_init(void)
108
108
{
109
109
        test_name = str_new(default_pool, 128);
110
 
        test_index = 0;
 
110
        test_index = 0; 
111
111
        test_failures = 0;
112
112
}
113
113
 
135
135
}
136
136
 
137
137
void testsuite_test_fail_cstr(const char *reason)
138
 
{
 
138
{       
139
139
        if ( str_len(test_name) == 0 ) {
140
140
                if ( reason == NULL || *reason == '\0' )
141
141
                        printf("%2d: Test FAILED\n", test_index);
145
145
                if ( reason == NULL || *reason == '\0' )
146
146
                        printf("%2d: Test '%s' FAILED\n", test_index, str_c(test_name));
147
147
                else
148
 
                        printf("%2d: Test '%s' FAILED: %s\n", test_index,
 
148
                        printf("%2d: Test '%s' FAILED: %s\n", test_index, 
149
149
                                str_c(test_name), reason);
150
150
        }
151
151
 
155
155
}
156
156
 
157
157
void testsuite_testcase_fail(const char *reason)
158
 
{
 
158
{       
159
159
        if ( reason == NULL || *reason == '\0' )
160
160
                printf("XX: Test CASE FAILED\n");
161
161
        else
175
175
                if ( reason == NULL || str_len(reason) == 0 )
176
176
                        printf("%2d: Test '%s' SUCCEEDED\n", test_index, str_c(test_name));
177
177
                else
178
 
                        printf("%2d: Test '%s' SUCCEEDED: %s\n", test_index,
 
178
                        printf("%2d: Test '%s' SUCCEEDED: %s\n", test_index, 
179
179
                                str_c(test_name), str_c(reason));
180
180
        }
181
181
        str_truncate(test_name, 0);
186
186
        str_free(&test_name);
187
187
}
188
188
 
189
 
int testsuite_testcase_result(void)
 
189
bool testsuite_testcase_result(void)
190
190
{
191
191
        if ( test_failures > 0 ) {
192
192
                printf("\nFAIL: %d of %d tests failed.\n\n", test_failures, test_index);
193
 
                return 1;
 
193
                return FALSE;
194
194
        }
195
195
 
196
196
        printf("\nPASS: %d tests succeeded.\n\n", test_index);
197
 
        return 0;
 
197
        return TRUE;
198
198
}
199
199
 
200
200
/*
209
209
                ("/tmp/dsieve-testsuite.%s.%s", dec2str(time(NULL)), dec2str(getpid()));
210
210
 
211
211
        if ( mkdir(testsuite_tmp_dir, 0700) < 0 ) {
212
 
                i_fatal("failed to create temporary directory '%s': %m.",
213
 
                        testsuite_tmp_dir);
 
212
                i_fatal("failed to create temporary directory '%s': %m.", 
 
213
                        testsuite_tmp_dir);             
214
214
        }
215
215
}
216
216
 
237
237
        testsuite_test_context_init();
238
238
        testsuite_log_init(log_stdout);
239
239
        testsuite_tmp_dir_init();
240
 
 
 
240
        
241
241
        testsuite_script_init();
242
242
        testsuite_binary_init();
243
243
        testsuite_smtp_init();
251
251
        testsuite_smtp_deinit();
252
252
        testsuite_binary_deinit();
253
253
        testsuite_script_deinit();
254
 
 
 
254
        
255
255
        testsuite_tmp_dir_deinit();
256
256
        testsuite_log_deinit();
257
257
        testsuite_test_context_deinit();