]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
use %file.tail()
authorAlan T. DeKok <aland@freeradius.org>
Mon, 16 Oct 2023 15:17:06 +0000 (11:17 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 16 Oct 2023 15:17:06 +0000 (11:17 -0400)
we haven't implemented "-n2" yet

src/tests/modules/linelog/linelog-delim.unlang
src/tests/modules/linelog/linelog-escapes.unlang
src/tests/modules/linelog/linelog-multi.unlang
src/tests/modules/linelog/linelog.unlang
src/tests/modules/linelog/linelog_xlat.unlang

index fd447d70333cc8191268e16a92c7258e6a88e6d3..de280f46d32e6054709d36006870c40a5e9661c2 100644 (file)
@@ -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
index 04079fd41509d935c17447d378382101ad06472f..2ce3be0d00d538e7996f489f9db57b89fe2a5a29 100644 (file)
@@ -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
index 60ace6bd6657b1b38bd9fac81cbac8811c6febc1..f8f9e2227f3c4737852ba4f4141146d7cbb89fb2 100644 (file)
@@ -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
index ec0bd84465c576819a28cd16d91f5b71b2c4e829..925f97a8ef2853b6e6b972948ae48488ec97cdb3 100644 (file)
@@ -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
index ae256f666eba70a1e230e11007e6a318a3d1f917..36a5a3446840b6563aeeabc2bce8b0aa9f147230 100644 (file)
@@ -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