From: Nick Porter Date: Mon, 8 Jan 2024 11:46:24 +0000 (+0000) Subject: Remove Tmp- attributes from exec module tests X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=75aee764968cb8fec19e62c7f191c31ff414a6e4;p=thirdparty%2Ffreeradius-server.git Remove Tmp- attributes from exec module tests --- diff --git a/src/tests/modules/exec/async.unlang b/src/tests/modules/exec/async.unlang index 72d248aa7ad..299f82f69e9 100644 --- a/src/tests/modules/exec/async.unlang +++ b/src/tests/modules/exec/async.unlang @@ -1,9 +1,11 @@ +string test_string + # # Async calls should always return a zero length string # because we don't wait for the response. # -&Tmp-String-0 := %exec_async('/bin/sh','-c',"'echo -n hello'") -if &Tmp-String-0 { +&test_string := %exec_async('/bin/sh','-c',"'echo -n hello'") +if &test_string { test_fail } @@ -25,7 +27,7 @@ if (&reply.Reply-Message == 'hello') { # Smoke test - Setup an async process that'll keep running after # after the test exits. # -&Tmp-String-0 := %exec_async('/bin/sh','-c',"'sleep 1'") -if &Tmp-String-0 { +&test_string := %exec_async('/bin/sh','-c',"'sleep 1'") +if &test_string { test_fail } diff --git a/src/tests/modules/exec/attrs.sh b/src/tests/modules/exec/attrs.sh index 089cf0e110b..727c9726712 100755 --- a/src/tests/modules/exec/attrs.sh +++ b/src/tests/modules/exec/attrs.sh @@ -1,6 +1,6 @@ #!/bin/sh -echo Tmp-String-1 := $1 -echo Tmp-String-2 := \"${CALLED_STATION_ID}\" +echo Filter-Id := $1 +echo Callback-Id := \"${CALLED_STATION_ID}\" exit 0; diff --git a/src/tests/modules/exec/backticks_list.unlang b/src/tests/modules/exec/backticks_list.unlang index bb1261718fd..8095bd1a7ef 100644 --- a/src/tests/modules/exec/backticks_list.unlang +++ b/src/tests/modules/exec/backticks_list.unlang @@ -1,12 +1,12 @@ +string test_string + # # Sync calls should always return a zero length string # because we don't wait for the response. # -&Tmp-String-0 := %exec('/bin/sh', '-c', 'echo hello') -if (&Tmp-String-0 != 'hello') { +&test_string := %exec('/bin/sh', '-c', 'echo hello') +if (&test_string != 'hello') { test_fail -} else { - test_pass } # diff --git a/src/tests/modules/exec/fail.sh b/src/tests/modules/exec/fail.sh index 6999952d6a8..2a576d74d96 100644 --- a/src/tests/modules/exec/fail.sh +++ b/src/tests/modules/exec/fail.sh @@ -1,6 +1,6 @@ #!/bin/sh -echo Tmp-String-3 := Failure +echo NAS-Identifier := Failure # exit status 7 maps to module exit code "notfound" exit 7 diff --git a/src/tests/modules/exec/module.conf b/src/tests/modules/exec/module.conf index 9e4382b9958..06d17a8225e 100644 --- a/src/tests/modules/exec/module.conf +++ b/src/tests/modules/exec/module.conf @@ -17,7 +17,7 @@ exec exec_async_mod { input_pairs = &request shell_escape = yes timeout = 10 - program = "/bin/sh -c 'echo \'Tmp-String-0 = welcome\''" + program = "/bin/sh -c 'echo \'Called-Station-Id = welcome\''" } exec exec_sync { @@ -33,7 +33,7 @@ exec exec_sync_mod { output_pairs = &control shell_escape = yes timeout = 10 - program = "/bin/sh -c 'echo \'Tmp-String-0 = welcome\''" + program = "/bin/sh -c 'echo \'Called-Station-Id = welcome\''" } exec exec_sync_attrs { diff --git a/src/tests/modules/exec/sync.unlang b/src/tests/modules/exec/sync.unlang index 1fa17147fb0..f00219d19e6 100644 --- a/src/tests/modules/exec/sync.unlang +++ b/src/tests/modules/exec/sync.unlang @@ -1,33 +1,33 @@ +string test_string + # # Sync calls return the response # -&Tmp-String-0 := %exec_sync('/bin/sh', '-c', "echo 'hello'") -if (&Tmp-String-0 != 'hello') { +&test_string := %exec_sync('/bin/sh', '-c', "echo 'hello'") +if (&test_string != 'hello') { test_fail } # # Call something which will take longer than the timeout # -&request -= &Tmp-String-0 &request -= &Module-Failure-Message -&Tmp-String-0 := %exec_sync('/bin/sleep', '10') +&test_string := %exec_sync('/bin/sleep', '10') if (&Module-Failure-Message != "Execution of external program failed: Timeout running program") { test_fail } -if &Tmp-String-0 { +if &test_string { test_fail } -&request -= &Tmp-String-0 &request -= &Module-Failure-Message -&Tmp-String-0 := %exec_sync('/bin/sh', "$ENV{MODULE_TEST_DIR}/fail.sh") +&test_string := %exec_sync('/bin/sh', "$ENV{MODULE_TEST_DIR}/fail.sh") -if &Tmp-String-0 { +if &test_string { test_fail } @@ -40,7 +40,7 @@ if (&Module-Failure-Message != "Execution of external program returned 7") { # exec_sync_mod -if ((!&control.Tmp-String-0) || (&control.Tmp-String-0 != 'welcome')) { +if ((!&control.Called-Station-Id) || (&control.Called-Station-Id != 'welcome')) { test_fail } @@ -51,11 +51,11 @@ if ((!&control.Tmp-String-0) || (&control.Tmp-String-0 != 'welcome')) { # exec_sync_attrs -if ((!&control.Tmp-String-1) || (&control.Tmp-String-1 != 'tony')) { +if ((!&control.Filter-Id) || (&control.Filter-Id != 'tony')) { test_fail } -if ((!&control.Tmp-String-2) || (&control.Tmp-String-2 != 'aabbccddeeff')) { +if ((!&control.Callback-Id) || (&control.Callback-Id != 'aabbccddeeff')) { test_fail } @@ -71,17 +71,17 @@ if (notfound) { test_fail } -if (&control.Tmp-String-3 == "Failure") { +if (&control.NAS-Identifier == "Failure") { test_fail } -&control -= &Tmp-String-1[*] +&control -= &Filter-Id[*] # # Call a module which uses an xlat function in its arguments # exec_sync_xlat_args -if !(&control.Tmp-String-1 == 'TONY') { +if !(&control.Filter-Id == 'TONY') { test_fail }