]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Add simple tests for exec module calls
authorNick Porter <nick@portercomputing.co.uk>
Tue, 1 Jun 2021 10:33:38 +0000 (11:33 +0100)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 1 Jun 2021 13:15:48 +0000 (09:15 -0400)
src/tests/modules/exec/async.unlang
src/tests/modules/exec/module.conf
src/tests/modules/exec/sync.unlang

index fe0959c3cdda16556695d2c431e432708af75f26..67775b9eb5c30c617cfb19621f2dcffe1e6c0904 100644 (file)
@@ -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
 }
index 56a255cac717c7753b51c69ea12a1092d4d2ce1e..4dd8cb701d2b10e31bfda4a711c46256f3679c62 100644 (file)
@@ -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\''"
+}
index a62a725978cc18b1fd6eafeea08942fb24fd9a38..18cb317588907a12a521928327967df3400598fb 100644 (file)
@@ -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