From: Alan T. DeKok Date: Thu, 17 Apr 2025 19:53:41 +0000 (-0400) Subject: remove backticks from tests X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bc0efd3eaa1dab72f494fda92ebe4a6e4d7f7609;p=thirdparty%2Ffreeradius-server.git remove backticks from tests And clean up corresponding use of exec module. We hoist it to unit_test_module.conf, and then replace any module-specific configuration with a module-specific instant of exec --- diff --git a/src/tests/modules/cache_htrie/module.conf b/src/tests/modules/cache_htrie/module.conf index 87bc486e82d..646349afb1b 100644 --- a/src/tests/modules/cache_htrie/module.conf +++ b/src/tests/modules/cache_htrie/module.conf @@ -34,7 +34,7 @@ cache cache_update { Filter-Id += NAS-Port[*] # Cache the result of an exec - Callback-Id := `/bin/echo 'echo test'` + Callback-Id := %exec('/bin/echo', 'echo test') # Create three string values and overwrite the middle one Login-LAT-Service += 'foo' diff --git a/src/tests/modules/cache_memcached/module.conf b/src/tests/modules/cache_memcached/module.conf index 880e2ab6223..c910ae972c3 100644 --- a/src/tests/modules/cache_memcached/module.conf +++ b/src/tests/modules/cache_memcached/module.conf @@ -42,7 +42,7 @@ cache cache_update { Filter-Id += NAS-Port[*] # Cache the result of an exec - Callback-Id := `/bin/echo 'echo test'` + Callback-Id := %exec('/bin/echo', 'echo test') # Create three string values and overwrite the middle one Login-LAT-Service += 'foo' diff --git a/src/tests/modules/cache_rbtree/module.conf b/src/tests/modules/cache_rbtree/module.conf index 32e4a6ddedd..32242edbf55 100644 --- a/src/tests/modules/cache_rbtree/module.conf +++ b/src/tests/modules/cache_rbtree/module.conf @@ -34,7 +34,7 @@ cache cache_update { Filter-Id += NAS-Port[*] # Cache the result of an exec - Callback-Id := `/bin/echo 'echo test'` + Callback-Id := %exec('/bin/echo', 'echo test') # Create three string values and overwrite the middle one Login-LAT-Service += 'foo' diff --git a/src/tests/modules/cache_redis/module.conf b/src/tests/modules/cache_redis/module.conf index 0ef527ab5ad..7e1c58dc58b 100644 --- a/src/tests/modules/cache_redis/module.conf +++ b/src/tests/modules/cache_redis/module.conf @@ -52,7 +52,7 @@ cache cache_update { Filter-Id += NAS-Port[*] # Cache the result of an exec - Callback-Id := `/bin/echo 'echo test'` + Callback-Id := %exec('/bin/echo', 'echo test') # Create three string values and overwrite the middle one Login-LAT-Service += 'foo' diff --git a/src/tests/modules/detail/module.conf b/src/tests/modules/detail/module.conf index 1154d18f7c6..10d3ee6ad76 100644 --- a/src/tests/modules/detail/module.conf +++ b/src/tests/modules/detail/module.conf @@ -28,6 +28,3 @@ detail detail_escape { filename = "$ENV{MODULE_TEST_DIR}/%{Net.Src.IP}-%{Calling-Station-Id}" escape_filenames = yes } - -exec { -} diff --git a/src/tests/modules/exec/backticks_list.unlang b/src/tests/modules/exec/backticks_list.unlang index e4e60107d7d..8f9efd0d997 100644 --- a/src/tests/modules/exec/backticks_list.unlang +++ b/src/tests/modules/exec/backticks_list.unlang @@ -4,7 +4,7 @@ string test_string # Sync calls should always return a zero length string # because we don't wait for the response. # -test_string := %exec('/bin/sh', '-c', 'echo hello') +test_string := %exec_wait('/bin/sh', '-c', 'echo hello') if (test_string != 'hello') { test_fail } @@ -12,7 +12,7 @@ if (test_string != 'hello') { # # @todo - list over-rides are not allowed! # -control += %exec('/bin/sh', '-c', "echo Reply-Message := \'hello\'") +control += %exec_wait('/bin/sh', '-c', "echo Reply-Message := \'hello\'") if (control.Reply-Message != 'hello') { test_fail diff --git a/src/tests/modules/exec/module.conf b/src/tests/modules/exec/module.conf index 13789d8556a..faaf8a77960 100644 --- a/src/tests/modules/exec/module.conf +++ b/src/tests/modules/exec/module.conf @@ -1,4 +1,4 @@ -exec { +exec exec_wait { wait = yes input_pairs = request shell_escape = yes diff --git a/src/tests/modules/linelog/linelog.unlang b/src/tests/modules/linelog/linelog.unlang index 59df34ef5ea..6a707c6bf3c 100644 --- a/src/tests/modules/linelog/linelog.unlang +++ b/src/tests/modules/linelog/linelog.unlang @@ -219,7 +219,7 @@ if !(test_string == 'bob,olobobob') { test_fail } -test_integer := %exec('/bin/sh', '-c', "wc -l < $ENV{MODULE_TEST_DIR}/test_e.log") +test_integer := %exec_wait('/bin/sh', '-c', "wc -l < $ENV{MODULE_TEST_DIR}/test_e.log") if !(test_integer == 3) { test_fail diff --git a/src/tests/modules/linelog/module.conf b/src/tests/modules/linelog/module.conf index 120b328d6d2..fe959ffb7cd 100644 --- a/src/tests/modules/linelog/module.conf +++ b/src/tests/modules/linelog/module.conf @@ -165,7 +165,7 @@ linelog linelog_missingref { } } -exec { +exec exec_wait { wait = yes input_pairs = request shell_escape = yes diff --git a/src/tests/modules/mschap/module.conf b/src/tests/modules/mschap/module.conf index 5f0f17932d7..9dc494856d5 100644 --- a/src/tests/modules/mschap/module.conf +++ b/src/tests/modules/mschap/module.conf @@ -73,6 +73,3 @@ mschap mschap_ntlm { chap_nt_enc_pw = Vendor-Specific.Microsoft.CHAP-NT-Enc-PW } } - -exec { -} diff --git a/src/tests/modules/redis/module.conf b/src/tests/modules/redis/module.conf index d1165caa89c..50cf94fe0f6 100644 --- a/src/tests/modules/redis/module.conf +++ b/src/tests/modules/redis/module.conf @@ -115,7 +115,3 @@ redis { delay { } -exec { - # Pass through path - env_inherit = yes -} diff --git a/src/tests/modules/redis_ippool/module.conf b/src/tests/modules/redis_ippool/module.conf index 03225e84d05..0d2f0746921 100644 --- a/src/tests/modules/redis_ippool/module.conf +++ b/src/tests/modules/redis_ippool/module.conf @@ -109,8 +109,3 @@ redis = ${modules.redis_ippool.redis} delay { } - -exec { - # Pass through path - env_inherit = yes -} diff --git a/src/tests/modules/smtp/module.conf b/src/tests/modules/smtp/module.conf index 3e6fdeff3c6..d5adc3a5e05 100644 --- a/src/tests/modules/smtp/module.conf +++ b/src/tests/modules/smtp/module.conf @@ -50,6 +50,3 @@ smtp { delay { } - -exec { -} diff --git a/src/tests/modules/smtp/smtp_attachment/module.conf b/src/tests/modules/smtp/smtp_attachment/module.conf index 085a7884c0d..13036f3bdca 100644 --- a/src/tests/modules/smtp/smtp_attachment/module.conf +++ b/src/tests/modules/smtp/smtp_attachment/module.conf @@ -45,6 +45,3 @@ smtp { delay { } - -exec { -} diff --git a/src/tests/modules/smtp/smtp_authenticate/module.conf b/src/tests/modules/smtp/smtp_authenticate/module.conf index a155618778f..4c979259290 100644 --- a/src/tests/modules/smtp/smtp_authenticate/module.conf +++ b/src/tests/modules/smtp/smtp_authenticate/module.conf @@ -26,6 +26,3 @@ smtp { delay { } - -exec { -} diff --git a/src/tests/modules/smtp/smtp_crln/module.conf b/src/tests/modules/smtp/smtp_crln/module.conf index 224f6dbfb9c..a603eee97eb 100644 --- a/src/tests/modules/smtp/smtp_crln/module.conf +++ b/src/tests/modules/smtp/smtp_crln/module.conf @@ -36,6 +36,3 @@ smtp { delay { } - -exec { -} diff --git a/src/tests/modules/smtp/smtp_stringparse/module.conf b/src/tests/modules/smtp/smtp_stringparse/module.conf index 33ce8e412d9..fb3d0245388 100644 --- a/src/tests/modules/smtp/smtp_stringparse/module.conf +++ b/src/tests/modules/smtp/smtp_stringparse/module.conf @@ -38,6 +38,3 @@ smtp { delay { } - -exec { -} diff --git a/src/tests/modules/sql/map.unlang b/src/tests/modules/sql/map.unlang index 62f0e5f8d22..c10a8a89440 100644 --- a/src/tests/modules/sql/map.unlang +++ b/src/tests/modules/sql/map.unlang @@ -267,7 +267,7 @@ groupfield := 'name' map sql 'SELECT * FROM radusergroup WHERE priority = 0' { control.User-Name = userfield control.Filter-Id = "group%{groupfield}" - control.NAS-Port = `/bin/echo priority` + control.NAS-Port = %exec('/bin/echo', 'priority') } if (!updated) { diff --git a/src/tests/modules/totp/module.conf b/src/tests/modules/totp/module.conf index a554e54f204..7d93db8c2ee 100644 --- a/src/tests/modules/totp/module.conf +++ b/src/tests/modules/totp/module.conf @@ -3,9 +3,6 @@ totp { time_offset = time_offset } -exec { -} - date { utc = yes } diff --git a/src/tests/modules/unit_test_module.conf b/src/tests/modules/unit_test_module.conf index 57d1d1986d4..64503f4410b 100644 --- a/src/tests/modules/unit_test_module.conf +++ b/src/tests/modules/unit_test_module.conf @@ -21,6 +21,10 @@ insert_into_radreply = "INSERT INTO radreply (username, attribute, op, value) VA modules { $INCLUDE ${raddb}/mods-enabled/always + exec { + env_inherit = yes # needed by redis_ippool + } + $INCLUDE ${raddb}/mods-enabled/pap $INCLUDE $ENV{MODULE_TEST_DIR}/module.conf