From: Alan T. DeKok Date: Mon, 16 Oct 2023 15:17:06 +0000 (-0400) Subject: use %file.tail() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=01a4a5849e1503d053a8da2d00ad0e0ca0f3cef3;p=thirdparty%2Ffreeradius-server.git use %file.tail() we haven't implemented "-n2" yet --- diff --git a/src/tests/modules/linelog/linelog-delim.unlang b/src/tests/modules/linelog/linelog-delim.unlang index fd447d70333..de280f46d32 100644 --- a/src/tests/modules/linelog/linelog-delim.unlang +++ b/src/tests/modules/linelog/linelog-delim.unlang @@ -6,7 +6,7 @@ %file.rm("$ENV{MODULE_TEST_DIR}/test_delim.log") linelog_fmt_delim -&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_delim.log"` +&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_delim.log") if (&Tmp-String-0 == 'bob, ') { test_pass @@ -17,7 +17,7 @@ else { # Check strings are appended linelog_fmt_delim -&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_delim.log"` +&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_delim.log") if (&Tmp-String-0 == 'bob, bob, ') { test_pass diff --git a/src/tests/modules/linelog/linelog-escapes.unlang b/src/tests/modules/linelog/linelog-escapes.unlang index 04079fd4150..2ce3be0d00d 100644 --- a/src/tests/modules/linelog/linelog-escapes.unlang +++ b/src/tests/modules/linelog/linelog-escapes.unlang @@ -11,7 +11,7 @@ &control.Tmp-String-1 := 'foo\nbar' linelog_escapes -&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_escapes.log"` +&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_escapes.log") &Tmp-String-1 := "%hex(%{Tmp-String-0})" # @@ -25,7 +25,7 @@ else { test_fail } -&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_escapes.log"` +&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_escapes.log") # # This is left alone, and not "\n" --> 0x0a, too. @@ -53,7 +53,7 @@ else { test_fail } -&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_escapes.log"` +&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_escapes.log") if (&Tmp-String-0 == "bar") { test_pass diff --git a/src/tests/modules/linelog/linelog-multi.unlang b/src/tests/modules/linelog/linelog-multi.unlang index 60ace6bd665..f8f9e2227f3 100644 --- a/src/tests/modules/linelog/linelog-multi.unlang +++ b/src/tests/modules/linelog/linelog-multi.unlang @@ -23,7 +23,7 @@ } linelog_ref_multi -&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_multi.log"` +&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_multi.log") if (&Tmp-String-0 == '0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ') { test_pass @@ -43,7 +43,7 @@ else { linelog_ref_multi -&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_multi.log"` +&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_multi.log") if (&Tmp-String-0 == ', blippo, ') { test_pass diff --git a/src/tests/modules/linelog/linelog.unlang b/src/tests/modules/linelog/linelog.unlang index ec0bd84465c..925f97a8ef2 100644 --- a/src/tests/modules/linelog/linelog.unlang +++ b/src/tests/modules/linelog/linelog.unlang @@ -9,7 +9,7 @@ &control.Tmp-String-0 := 'test_default' linelog_fmt_and_ref -&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_a.log"` +&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_a.log") if (&Tmp-String-0 == 'bob default') { test_pass @@ -23,7 +23,7 @@ else { linelog_fmt_and_ref -&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_a.log"` +&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_a.log") if (&Tmp-String-0 == 'bob exec') { test_pass @@ -47,7 +47,7 @@ else { linelog_fmt_and_ref -&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_a.log"` +&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_a.log") if (&Tmp-String-0 == 'bob') { test_pass @@ -61,7 +61,7 @@ else { linelog_fmt_and_ref -&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_a.log"` +&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_a.log") if (&Tmp-String-0 == 'bob xlat') { test_pass @@ -75,7 +75,7 @@ else { linelog_fmt_and_ref -&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_a.log"` +&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_a.log") if (&Tmp-String-0 == '%{User-Name} literal') { test_pass @@ -89,7 +89,7 @@ else { linelog_fmt_and_ref -&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_a.log"` +&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_a.log") if (&Tmp-String-0 == '') { test_pass @@ -134,7 +134,7 @@ else { linelog_ref -&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_b.log"` +&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_b.log") if (&Tmp-String-0 == 'bob exec') { test_pass @@ -153,7 +153,7 @@ else { &control.Tmp-String-0 := '.messages.test_xlat' linelog_fmt_and_ref_attr -&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_c.log"` +&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_c.log") if (&Tmp-String-0 == 'bob xlat') { test_pass @@ -166,7 +166,7 @@ else { &control.Tmp-String-0 := 'test_xlat' linelog_fmt_and_ref_attr -&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_c.log"` +&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_c.log") if (&Tmp-String-0 == 'bob') { test_pass @@ -179,7 +179,7 @@ else { &control.Tmp-String-0 := 'messages.test_xlat' linelog_fmt_and_ref_attr -&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_c.log"` +&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_c.log") if (&Tmp-String-0 == 'bob xlat') { test_pass @@ -201,7 +201,7 @@ else { test_fail } -&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_c.log"` +&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_c.log") if (&Tmp-String-0 == 'bob xlat') { test_pass @@ -231,7 +231,7 @@ else { linelog_fmt -&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_d.log"` +&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_d.log") if (&Tmp-String-0 == 'bob') { test_pass @@ -260,7 +260,7 @@ else { test_fail } -&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_e.log"` +&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_e.log") if (&Tmp-String-0 == 'bob,olobobob') { test_pass @@ -271,7 +271,7 @@ else { linelog_header -&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_e.log"` +&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_e.log") if (&Tmp-String-0 == 'bob,olobobob') { test_pass diff --git a/src/tests/modules/linelog/linelog_xlat.unlang b/src/tests/modules/linelog/linelog_xlat.unlang index ae256f666eb..36a5a344684 100644 --- a/src/tests/modules/linelog/linelog_xlat.unlang +++ b/src/tests/modules/linelog/linelog_xlat.unlang @@ -8,7 +8,7 @@ if (%{linelog_fmt_delim_xlat:bob} != 5) { test_fail } -&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_xlat.log"` +&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_xlat.log") if (&Tmp-String-0 == 'bob, ') { test_pass @@ -23,7 +23,7 @@ else { if (%{linelog_fmt_delim_xlat:%{Tmp-String-1}%{Tmp-String-2}} != 9) { test_fail } -&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_xlat.log"` +&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_xlat.log") if (&Tmp-String-0 == 'bob, morebob, ') { test_pass } @@ -42,7 +42,7 @@ if (%{linelog_fmt_delim_xlat:"{ \"foo\" : \"bar\", \"baz\" : \"boink\" }"} == 36 test_fail } -&Tmp-String-0 := `/bin/sh -c "tail -n1 $ENV{MODULE_TEST_DIR}/test_xlat.log"` +&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_xlat.log") if (&Tmp-String-0 == '{ "foo" : "bar", "baz" : "boink" }, ') { test_pass