int sieve_test (struct sieve_binary *sbin, const struct sieve_message_data *msgdata, const struct sieve_script_env *senv, struct sieve_error_handler *ehandler, struct ostream *stream, enum sieve_runtime_flags flags, bool *keep) { struct sieve_result *result = NULL; int ret; if ( keep != NULL ) *keep = FALSE; /* Run the script */ ret = sieve_run(sbin, &result, msgdata, senv, ehandler, flags); /* Print result if successful */ if ( ret > 0 ) { ret = sieve_result_print(result, senv, stream, keep); } else if ( ret == 0 ) { if ( keep != NULL ) *keep = TRUE; } /* Cleanup */ if ( result != NULL ) sieve_result_unref(&result); return ret; }
void testsuite_result_print (const struct sieve_runtime_env *renv) { struct ostream *out; out = o_stream_create_fd(1, 0, FALSE); o_stream_send_str(out, "\n--"); sieve_result_print(_testsuite_result, renv->scriptenv, out, NULL); o_stream_send_str(out, "--\n\n"); o_stream_destroy(&out); }
static void sieve_multiscript_test (struct sieve_multiscript *mscript, bool *keep) { if ( mscript->status > 0 ) { mscript->status = ( sieve_result_print(mscript->result, mscript->scriptenv, mscript->teststream, keep) ? SIEVE_EXEC_OK : SIEVE_EXEC_FAILURE ); } else { if ( keep != NULL ) *keep = TRUE; } sieve_result_mark_executed(mscript->result); }