From: Nick Porter Date: Tue, 1 Jun 2021 10:33:38 +0000 (+0100) Subject: Add simple tests for exec module calls X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f756c31986fa76211339df4c5f3c2145649696f;p=thirdparty%2Ffreeradius-server.git Add simple tests for exec module calls --- diff --git a/src/tests/modules/exec/async.unlang b/src/tests/modules/exec/async.unlang index fe0959c3cdd..67775b9eb5c 100644 --- a/src/tests/modules/exec/async.unlang +++ b/src/tests/modules/exec/async.unlang @@ -7,8 +7,6 @@ update request { } if (&Tmp-String-0 != '') { test_fail -} else { - test_pass } # @@ -20,6 +18,10 @@ update request { if (&reply.Reply-Message == 'hello') { test_fail -} else { +} + +exec_async_inline + +if (ok) { test_pass } diff --git a/src/tests/modules/exec/module.conf b/src/tests/modules/exec/module.conf index 56a255cac71..4dd8cb701d2 100644 --- a/src/tests/modules/exec/module.conf +++ b/src/tests/modules/exec/module.conf @@ -5,6 +5,14 @@ exec exec_async { timeout = 10 } +exec exec_async_inline { + wait = no + input_pairs = request + shell_escape = yes + timeout = 10 + program = "/bin/sh -c 'echo goodbye'" +} + exec exec_sync { wait = yes input_pairs = control @@ -12,3 +20,11 @@ exec exec_sync { timeout = 10 } +exec exec_sync_inline { + wait = yes + input_pairs = control + output_pairs = control + shell_escape = yes + timeout = 10 + program = "/bin/sh -c 'echo \'Tmp-String-0 = welcome\''" +} diff --git a/src/tests/modules/exec/sync.unlang b/src/tests/modules/exec/sync.unlang index a62a725978c..18cb3175889 100644 --- a/src/tests/modules/exec/sync.unlang +++ b/src/tests/modules/exec/sync.unlang @@ -7,8 +7,6 @@ update request { } if (&Tmp-String-0 != 'hello') { test_fail -} else { - test_pass } # @@ -20,6 +18,12 @@ update request { if (&reply.Reply-Message != 'hello') { test_fail -} else { - test_pass } + +exec_sync_inline + +if (&control.Tmp-String-0 != 'welcome') { + test_fail +} + +test_pass