Coverage Report

Created: 2026-07-16 07:09

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/pigeonhole/src/testsuite/tst-test-result-execute.c
Line
Count
Source
1
/* Copyright (c) Pigeonhole authors, see top-level COPYING file */
2
3
#include "sieve-common.h"
4
#include "sieve-script.h"
5
#include "sieve-commands.h"
6
#include "sieve-validator.h"
7
#include "sieve-generator.h"
8
#include "sieve-interpreter.h"
9
#include "sieve-code.h"
10
#include "sieve-binary.h"
11
#include "sieve-dump.h"
12
#include "sieve.h"
13
14
#include "testsuite-common.h"
15
#include "testsuite-result.h"
16
17
/*
18
 * Test_result_execute command
19
 *
20
 * Syntax:
21
 *   test_result_execute
22
 */
23
24
static bool tst_test_result_execute_generate
25
  (const struct sieve_codegen_env *cgenv, struct sieve_command *cmd);
26
27
const struct sieve_command_def tst_test_result_execute = {
28
  .identifier = "test_result_execute",
29
  .type = SCT_TEST,
30
  .positional_args = 0,
31
  .subtests = 0,
32
  .block_allowed = FALSE,
33
  .block_required = FALSE,
34
  .generate = tst_test_result_execute_generate
35
};
36
37
/*
38
 * Operation
39
 */
40
41
static int tst_test_result_execute_operation_execute
42
  (const struct sieve_runtime_env *renv, sieve_size_t *address);
43
44
const struct sieve_operation_def test_result_execute_operation = {
45
  .mnemonic = "TEST_RESULT_EXECUTE",
46
  .ext_def = &testsuite_extension,
47
  .code = TESTSUITE_OPERATION_TEST_RESULT_EXECUTE,
48
  .execute = tst_test_result_execute_operation_execute
49
};
50
51
/*
52
 * Code generation
53
 */
54
55
static bool tst_test_result_execute_generate
56
(const struct sieve_codegen_env *cgenv, struct sieve_command *tst)
57
0
{
58
0
  sieve_operation_emit(cgenv->sblock, tst->ext, &test_result_execute_operation);
59
60
0
  return TRUE;
61
0
}
62
63
/*
64
 * Intepretation
65
 */
66
67
static int tst_test_result_execute_operation_execute
68
(const struct sieve_runtime_env *renv, sieve_size_t *address ATTR_UNUSED)
69
0
{
70
0
  bool result = TRUE;
71
72
  /*
73
   * Perform operation
74
   */
75
76
0
  sieve_runtime_trace(renv, SIEVE_TRLVL_TESTS,
77
0
    "testsuite: test_result_execute test");
78
79
0
  result = testsuite_result_execute(renv);
80
81
0
  if ( sieve_runtime_trace_active(renv, SIEVE_TRLVL_TESTS) ) {
82
0
    sieve_runtime_trace_descend(renv);
83
0
    sieve_runtime_trace(renv, 0, "execution of result %s",
84
0
      ( result ? "succeeded" : "failed" ));
85
0
  }
86
87
  /* Set result */
88
0
  sieve_interpreter_set_test_result(renv->interp, result);
89
90
0
  return SIEVE_EXEC_OK;
91
0
}
92
93
94
95