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

« back to all changes in this revision

Viewing changes to pigeonhole/src/testsuite/cmd-test-fail.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) 2002-2012 Pigeonhole authors, see the included COPYING file
 
1
/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file
2
2
 */
3
3
 
4
4
#include "sieve-common.h"
12
12
 
13
13
#include "testsuite-common.h"
14
14
 
15
 
/* 
 
15
/*
16
16
 * Test_fail command
17
17
 *
18
 
 * Syntax:   
 
18
 * Syntax:
19
19
 *   test_fail <reason: string>
20
20
 */
21
21
 
24
24
static bool cmd_test_fail_generate
25
25
        (const struct sieve_codegen_env *cgenv, struct sieve_command *ctx);
26
26
 
27
 
const struct sieve_command_def cmd_test_fail = { 
28
 
        "test_fail", 
29
 
        SCT_COMMAND, 
 
27
const struct sieve_command_def cmd_test_fail = {
 
28
        "test_fail",
 
29
        SCT_COMMAND,
30
30
        1, 0, FALSE, FALSE,
31
31
        NULL, NULL,
32
32
        cmd_test_fail_validate,
33
 
        NULL, 
34
 
        cmd_test_fail_generate, 
35
 
        NULL 
 
33
        NULL,
 
34
        cmd_test_fail_generate,
 
35
        NULL
36
36
};
37
37
 
38
 
/* 
39
 
 * Test operation 
 
38
/*
 
39
 * Test operation
40
40
 */
41
41
 
42
42
static bool cmd_test_fail_operation_dump
44
44
static int cmd_test_fail_operation_execute
45
45
        (const struct sieve_runtime_env *renv, sieve_size_t *address);
46
46
 
47
 
const struct sieve_operation_def test_fail_operation = { 
 
47
const struct sieve_operation_def test_fail_operation = {
48
48
        "TEST_FAIL",
49
 
        &testsuite_extension, 
 
49
        &testsuite_extension,
50
50
        TESTSUITE_OPERATION_TEST_FAIL,
51
 
        cmd_test_fail_operation_dump, 
52
 
        cmd_test_fail_operation_execute 
 
51
        cmd_test_fail_operation_dump,
 
52
        cmd_test_fail_operation_execute
53
53
};
54
54
 
55
 
/* 
56
 
 * Validation 
 
55
/*
 
56
 * Validation
57
57
 */
58
58
 
59
59
static bool cmd_test_fail_validate
60
 
(struct sieve_validator *valdtr ATTR_UNUSED, struct sieve_command *cmd) 
 
60
(struct sieve_validator *valdtr ATTR_UNUSED, struct sieve_command *cmd)
61
61
{
62
62
        struct sieve_ast_argument *arg = cmd->first_positional;
63
 
        
 
63
 
64
64
        if ( !sieve_validate_positional_argument
65
65
                (valdtr, cmd, arg, "reason", 1, SAAT_STRING) ) {
66
66
                return FALSE;
67
67
        }
68
 
        
 
68
 
69
69
        return sieve_validator_argument_activate(valdtr, cmd, arg, FALSE);
70
70
}
71
71
 
72
 
/* 
73
 
 * Code generation 
 
72
/*
 
73
 * Code generation
74
74
 */
75
75
 
76
76
static inline struct testsuite_generator_context *
77
77
        _get_generator_context(struct sieve_generator *gentr)
78
78
{
79
 
        return (struct testsuite_generator_context *) 
 
79
        return (struct testsuite_generator_context *)
80
80
                sieve_generator_extension_get_context(gentr, testsuite_ext);
81
81
}
82
82
 
83
83
static bool cmd_test_fail_generate
84
84
(const struct sieve_codegen_env *cgenv, struct sieve_command *cmd)
85
85
{
86
 
        struct testsuite_generator_context *genctx = 
 
86
        struct testsuite_generator_context *genctx =
87
87
                _get_generator_context(cgenv->gentr);
88
 
        
 
88
 
89
89
        sieve_operation_emit(cgenv->sblock, cmd->ext, &test_fail_operation);
90
90
 
91
91
        /* Generate arguments */
92
92
        if ( !sieve_generate_arguments(cgenv, cmd, NULL) )
93
93
                return FALSE;
94
 
                
95
 
        sieve_jumplist_add(genctx->exit_jumps, 
96
 
                sieve_binary_emit_offset(cgenv->sblock, 0));                    
97
 
        
 
94
 
 
95
        sieve_jumplist_add(genctx->exit_jumps,
 
96
                sieve_binary_emit_offset(cgenv->sblock, 0));
 
97
 
98
98
        return TRUE;
99
99
}
100
100
 
101
 
/* 
 
101
/*
102
102
 * Code dump
103
103
 */
104
 
 
 
104
 
105
105
static bool cmd_test_fail_operation_dump
106
106
(const struct sieve_dumptime_env *denv, sieve_size_t *address)
107
107
{
108
108
        unsigned int pc;
109
109
        sieve_offset_t offset;
110
 
    
 
110
 
111
111
        sieve_code_dumpf(denv, "TEST_FAIL:");
112
112
        sieve_code_descend(denv);
113
113
 
114
 
        if ( !sieve_opr_string_dump(denv, address, "reason") ) 
 
114
        if ( !sieve_opr_string_dump(denv, address, "reason") )
115
115
                return FALSE;
116
116
 
117
117
        sieve_code_mark(denv);
141
141
                "testsuite: test_fail command; FAIL current test");
142
142
 
143
143
        testsuite_test_fail(reason);
144
 
        
 
144
 
145
145
        return sieve_interpreter_program_jump(renv->interp, TRUE);
146
146
}
147
147