Coverage Report

Created: 2026-03-15 06:40

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/pigeonhole/src/testsuite/cmd-test-result.c
Line
Count
Source
1
/* Copyright (c) 2002-2018 Pigeonhole authors, see the included COPYING file
2
 */
3
4
#include "sieve-common.h"
5
#include "sieve-script.h"
6
#include "sieve-commands.h"
7
#include "sieve-validator.h"
8
#include "sieve-generator.h"
9
#include "sieve-interpreter.h"
10
#include "sieve-code.h"
11
#include "sieve-binary.h"
12
#include "sieve-dump.h"
13
#include "sieve.h"
14
15
#include "testsuite-common.h"
16
#include "testsuite-result.h"
17
#include "testsuite-message.h"
18
#include "testsuite-smtp.h"
19
20
/*
21
 * Commands
22
 */
23
24
static bool
25
cmd_test_result_generate(const struct sieve_codegen_env *cgenv,
26
       struct sieve_command *cmd);
27
28
/* Test_result_reset command
29
 *
30
 * Syntax:
31
 *   test_result_reset
32
 */
33
34
const struct sieve_command_def cmd_test_result_reset = {
35
  .identifier = "test_result_reset",
36
  .type = SCT_COMMAND,
37
  .positional_args = 0,
38
  .subtests = 0,
39
  .block_allowed = FALSE,
40
  .block_required = FALSE,
41
  .generate = cmd_test_result_generate,
42
};
43
44
/* Test_result_print command
45
 *
46
 * Syntax:
47
 *   test_result_print
48
 */
49
50
const struct sieve_command_def cmd_test_result_print = {
51
  .identifier = "test_result_print",
52
  .type = SCT_COMMAND,
53
  .positional_args = 0,
54
  .subtests = 0,
55
  .block_allowed = FALSE,
56
  .block_required = FALSE,
57
  .generate = cmd_test_result_generate,
58
};
59
60
/*
61
 * Operations
62
 */
63
64
/* test_result_reset */
65
66
static int
67
cmd_test_result_reset_operation_execute(const struct sieve_runtime_env *renv,
68
          sieve_size_t *address);
69
70
const struct sieve_operation_def test_result_reset_operation = {
71
  .mnemonic = "TEST_RESULT_RESET",
72
  .ext_def = &testsuite_extension,
73
  .code = TESTSUITE_OPERATION_TEST_RESULT_RESET,
74
  .execute = cmd_test_result_reset_operation_execute,
75
};
76
77
/* test_result_print */
78
79
static int
80
cmd_test_result_print_operation_execute(const struct sieve_runtime_env *renv,
81
          sieve_size_t *address);
82
83
const struct sieve_operation_def test_result_print_operation = {
84
  .mnemonic = "TEST_RESULT_PRINT",
85
  .ext_def = &testsuite_extension,
86
  .code = TESTSUITE_OPERATION_TEST_RESULT_PRINT,
87
  .execute = cmd_test_result_print_operation_execute,
88
};
89
90
/*
91
 * Code generation
92
 */
93
94
static bool
95
cmd_test_result_generate(const struct sieve_codegen_env *cgenv,
96
       struct sieve_command *cmd)
97
0
{
98
0
  if (sieve_command_is(cmd, cmd_test_result_reset)) {
99
0
    sieve_operation_emit(cgenv->sblock, cmd->ext,
100
0
             &test_result_reset_operation);
101
0
  } else if (sieve_command_is(cmd, cmd_test_result_print)) {
102
0
    sieve_operation_emit(cgenv->sblock, cmd->ext,
103
0
             &test_result_print_operation);
104
0
  } else {
105
0
    i_unreached();
106
0
  }
107
108
0
  return TRUE;
109
0
}
110
111
/*
112
 * Intepretation
113
 */
114
115
static int
116
cmd_test_result_reset_operation_execute(const struct sieve_runtime_env *renv,
117
          sieve_size_t *address ATTR_UNUSED)
118
0
{
119
0
  sieve_runtime_trace(renv, SIEVE_TRLVL_COMMANDS, "testsuite: "
120
0
          "test_result_reset command; reset script result");
121
122
0
  testsuite_result_reset(renv);
123
0
  testsuite_smtp_reset();
124
125
0
  return SIEVE_EXEC_OK;
126
0
}
127
128
static int
129
cmd_test_result_print_operation_execute(const struct sieve_runtime_env *renv,
130
          sieve_size_t *address ATTR_UNUSED)
131
0
{
132
0
  sieve_runtime_trace(renv, SIEVE_TRLVL_COMMANDS, "testsuite: "
133
0
          "test_result_print command; print script result ");
134
135
0
  testsuite_result_print(renv);
136
137
0
  return SIEVE_EXEC_OK;
138
0
}