diff --git a/tests/plugins/extprograms/execute/errors.svtest b/tests/plugins/extprograms/execute/errors.svtest index b08e77ce0811a9896001c73b79c5324081af4dbb..3dd2d5f68b7866f84e1761629bcd2ce9b2e5d16e 100644 --- a/tests/plugins/extprograms/execute/errors.svtest +++ b/tests/plugins/extprograms/execute/errors.svtest @@ -33,3 +33,21 @@ test "Variables" { test_fail "wrong number of errors reported"; } } + +/* + * Unknown program + */ + +test "Unknown program" { + if not test_script_compile "errors/unknown-program.sieve" { + test_fail "compile should have succeeded"; + } + + if test_script_run { + test_fail "execution should have failed"; + } + + if not test_error :count "eq" :comparator "i;ascii-numeric" "1" { + test_fail "wrong number of errors reported"; + } +} diff --git a/tests/plugins/extprograms/execute/errors/unknown-program.sieve b/tests/plugins/extprograms/execute/errors/unknown-program.sieve new file mode 100644 index 0000000000000000000000000000000000000000..3a79bb67b6e472df31c6d82b7b3f7f077c025adb --- /dev/null +++ b/tests/plugins/extprograms/execute/errors/unknown-program.sieve @@ -0,0 +1,3 @@ +require "vnd.dovecot.execute"; + +execute "unknown"; diff --git a/tests/plugins/extprograms/filter/errors.svtest b/tests/plugins/extprograms/filter/errors.svtest index 3461c019229ed27e5737feb42f2da1fbc4a3d5cc..1d04ba1ba23138b96b80bdd5252436b2d44bd954 100644 --- a/tests/plugins/extprograms/filter/errors.svtest +++ b/tests/plugins/extprograms/filter/errors.svtest @@ -19,3 +19,21 @@ test "Command syntax" { test_fail "wrong number of errors reported"; } } + +/* + * Unknown program + */ + +test "Unknown program" { + if not test_script_compile "errors/unknown-program.sieve" { + test_fail "compile should have succeeded"; + } + + if test_script_run { + test_fail "execution should have failed"; + } + + if not test_error :count "eq" :comparator "i;ascii-numeric" "1" { + test_fail "wrong number of errors reported"; + } +} diff --git a/tests/plugins/extprograms/filter/errors/unknown-program.sieve b/tests/plugins/extprograms/filter/errors/unknown-program.sieve new file mode 100644 index 0000000000000000000000000000000000000000..7e530ee208450dc45694cf93dd56725abf722e9c --- /dev/null +++ b/tests/plugins/extprograms/filter/errors/unknown-program.sieve @@ -0,0 +1,3 @@ +require "vnd.dovecot.filter"; + +filter "unknown"; diff --git a/tests/plugins/extprograms/pipe/errors.svtest b/tests/plugins/extprograms/pipe/errors.svtest index 4987fbc1914ed32fac66789c172eb5bf22497b79..802caeed1fbc3ae7ed6e9bc6a12276bc69788680 100644 --- a/tests/plugins/extprograms/pipe/errors.svtest +++ b/tests/plugins/extprograms/pipe/errors.svtest @@ -18,6 +18,43 @@ test "Command syntax" { } } +/* Unknown program */ + +test_set "message" text: +From: stephan@example.com +To: pipe@example.net +Subject: Frop! + +Frop! +. +; + +test_config_set "sieve_pipe_bin_dir" "${tst.path}/../bin"; +test_config_reload :extension "vnd.dovecot.pipe"; +test_result_reset; + +test "Unknown program" { + if not test_script_compile "errors/unknown-program.sieve" { + test_fail "compile failed"; + } + + if not test_script_run { + test_fail "execute failed"; + } + + if test_result_execute { + test_fail "pipe should have failed"; + } + + if not test_error :count "eq" :comparator "i;ascii-numeric" "1" { + test_fail "wrong number of errors reported"; + } + + if not test_error :index 1 :contains "failed to pipe" { + test_fail "wrong error reported"; + } +} + /* Timeout */ test_set "message" text: diff --git a/tests/plugins/extprograms/pipe/errors/unknown-program.sieve b/tests/plugins/extprograms/pipe/errors/unknown-program.sieve new file mode 100644 index 0000000000000000000000000000000000000000..fd6338bfd14fba0f088ee298f604b274cabe564b --- /dev/null +++ b/tests/plugins/extprograms/pipe/errors/unknown-program.sieve @@ -0,0 +1,3 @@ +require "vnd.dovecot.pipe"; + +pipe "unknown";