+string test_string
+
&control.Exec-Export := 'PATH="$ENV{PATH}:/bin:/usr/bin:/opt/bin:/usr/local/bin"'
#
%file.rm("$ENV{MODULE_TEST_DIR}/test_delim.log")
linelog_fmt_delim
-&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_delim.log")
+&test_string := %file.tail("$ENV{MODULE_TEST_DIR}/test_delim.log")
-if (&Tmp-String-0 == 'bob, ') {
+if (&test_string == 'bob, ') {
test_pass
}
else {
# Check strings are appended
linelog_fmt_delim
-&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_delim.log")
+&test_string := %file.tail("$ENV{MODULE_TEST_DIR}/test_delim.log")
-if (&Tmp-String-0 == 'bob, bob, ') {
+if (&test_string == 'bob, bob, ') {
test_pass
}
else {
+string test_string1
+string test_string2
+
&control.Exec-Export := 'PATH="$ENV{PATH}:/bin:/usr/bin:/opt/bin:/usr/local/bin"'
#
# Raw attribute value should be written out without further molestation.
# Because the value is wrapped in '' the \n is left as \n.
-&control.Tmp-String-0 := 'test_attr'
-&control.Tmp-String-1 := 'foo\nbar'
+&control.Filter-Id := 'test_attr'
+&control.Callback-Id := 'foo\nbar'
linelog_escapes
-&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_escapes.log")
-&Tmp-String-1 := "%hex(%{Tmp-String-0})"
+&test_string1 := %file.tail("$ENV{MODULE_TEST_DIR}/test_escapes.log")
+&test_string2 := "%hex(%{test_string1})"
#
# Note that there's a '5f6e' here, which is "\n"
# And we don't have a '0a', which is the unescaped "\n"
#
-if (&Tmp-String-1 == '666f6f5c6e626172') {
+if (&test_string2 == '666f6f5c6e626172') {
test_pass
}
else {
test_fail
}
-&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_escapes.log")
+&test_string1 := %file.tail("$ENV{MODULE_TEST_DIR}/test_escapes.log")
#
# This is left alone, and not "\n" --> 0x0a, too.
#
-if (&Tmp-String-0 == 'foo\nbar') {
+if (&test_string1 == 'foo\nbar') {
test_pass
}
else {
# Raw attribute value should be written out without further molestation.
# Because the value is wrapped in "" the \n is converted to 0x0a (binary).
-&control.Tmp-String-0 := 'test_attr'
-&control.Tmp-String-1 := "foo\nbar"
+&control.Filter-Id := 'test_attr'
+&control.Callback-Id := "foo\nbar"
linelog_escapes
-&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_escapes.log", 2)
-&Tmp-String-1 := "%hex(%{Tmp-String-0})"
+&test_string1 := %file.tail("$ENV{MODULE_TEST_DIR}/test_escapes.log", 2)
+&test_string2 := "%hex(%{test_string1})"
-if (&Tmp-String-1 == '666f6f0a626172') {
+if (&test_string2 == '666f6f0a626172') {
test_pass
}
else {
test_fail
}
-&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_escapes.log")
+&test_string1 := %file.tail("$ENV{MODULE_TEST_DIR}/test_escapes.log")
-if (&Tmp-String-0 == "bar") {
+if (&test_string1 == "bar") {
test_pass
}
else {
+string test_string
+
&control.Exec-Export := 'PATH="$ENV{PATH}:/bin:/usr/bin:/opt/bin:/usr/local/bin"'
#
%file.rm("$ENV{MODULE_TEST_DIR}/test_multi.log")
# Check multiple string type attributes are logged correctly
-&control.Tmp-String-0 := 'test_multi_str'
+&control.Filter-Id := 'test_multi_str'
&control += {
&Reply-Message = '0'
}
linelog_ref_multi
-&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_multi.log")
+&test_string := %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
-}
-else {
+if !(&test_string == '0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ') {
test_fail
}
# Check octet type attributes are logged in raw form
&control += {
- &Tmp-Octets-0 = 0x686970706f # Hippo
- &Tmp-Octets-0 = 0x0a # new line
- &Tmp-Octets-0 = 0x626c6970706f # Blippo
+ &Class = 0x686970706f # Hippo
+ &Class = 0x0a # new line
+ &Class = 0x626c6970706f # Blippo
}
-&control.Tmp-String-0 := 'test_multi_octets'
+&control.Filter-Id := 'test_multi_octets'
linelog_ref_multi
-&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_multi.log")
+&test_string := %file.tail("$ENV{MODULE_TEST_DIR}/test_multi.log")
-if (&Tmp-String-0 == ', blippo, ') {
- test_pass
-}
-else {
+if !(&test_string == ', blippo, ') {
test_fail
}
# When no attributes that match are available, linelog should return noop
-&control.Tmp-String-0 := 'test_empty'
+&control.Filter-Id := 'test_empty'
linelog_ref_multi
-if (noop) {
- test_pass
-}
-else {
+if !(noop) {
test_fail
}
# Remove the file
%file.rm("$ENV{MODULE_TEST_DIR}/test_multi.log")
+
+test_pass
+string test_string
+uint32 test_integer
+
&control.Exec-Export := 'PATH="$ENV{PATH}:/bin:/usr/bin:/opt/bin:/usr/local/bin"'
#
%file.rm("$ENV{MODULE_TEST_DIR}/test_a.log")
# Check linelog fails over to the default message (an xlat expansion)
-&control.Tmp-String-0 := 'test_default'
+&control.Filter-Id := 'test_default'
linelog_fmt_and_ref
-&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_a.log")
+&test_string := %file.tail("$ENV{MODULE_TEST_DIR}/test_a.log")
-if (&Tmp-String-0 == 'bob default') {
- test_pass
-}
-else {
+if !(&test_string == 'bob default') {
test_fail
}
# Check linelog adds a newline at the end of each message (also tests if execs pointed to by refs work)
-&control.Tmp-String-0 := 'test_exec'
+&control.Filter-Id := 'test_exec'
linelog_fmt_and_ref
-&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_a.log")
+&test_string := %file.tail("$ENV{MODULE_TEST_DIR}/test_a.log")
-if (&Tmp-String-0 == 'bob exec') {
- test_pass
-}
-else {
+if !(&test_string == 'bob exec') {
test_fail
}
# Check it's not overwriting the same line repeatedly
-&Tmp-String-0 := %file.head("$ENV{MODULE_TEST_DIR}/test_a.log");
+&test_string := %file.head("$ENV{MODULE_TEST_DIR}/test_a.log");
-if (&Tmp-String-0 == 'bob default') {
- test_pass
-}
-else {
+if !(&test_string == 'bob default') {
test_fail
}
# Check linelog can use attrs pointed to by refs
-&control.Tmp-String-0 := 'test_attr'
+&control.Filter-Id := 'test_attr'
linelog_fmt_and_ref
-&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_a.log")
+&test_string := %file.tail("$ENV{MODULE_TEST_DIR}/test_a.log")
-if (&Tmp-String-0 == 'bob') {
- test_pass
-}
-else {
+if !(&test_string == 'bob') {
test_fail
}
# Check linelog can use xlats pointed to by refs
-&control.Tmp-String-0 := 'test_xlat'
+&control.Filter-Id := 'test_xlat'
linelog_fmt_and_ref
-&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_a.log")
+&test_string := %file.tail("$ENV{MODULE_TEST_DIR}/test_a.log")
-if (&Tmp-String-0 == 'bob xlat') {
- test_pass
-}
-else {
+if !(&test_string == 'bob xlat') {
test_fail
}
# Check linelog can use literals pointed to by refs
-&control.Tmp-String-0 := 'test_literal'
+&control.Filter-Id := 'test_literal'
linelog_fmt_and_ref
-&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_a.log")
+&test_string := %file.tail("$ENV{MODULE_TEST_DIR}/test_a.log")
-if (&Tmp-String-0 == '%{User-Name} literal') {
- test_pass
-}
-else {
+if !(&test_string == '%{User-Name} literal') {
test_fail
}
# Check linelog can use empty conf pairs
-&control.Tmp-String-0 := 'test_empty'
+&control.Filter-Id := 'test_empty'
linelog_fmt_and_ref
-&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_a.log")
+&test_string := %file.tail("$ENV{MODULE_TEST_DIR}/test_a.log")
-if (&Tmp-String-0 == '') {
- test_pass
-}
-else {
+if !(&test_string == '') {
test_fail
}
%file.rm("$ENV{MODULE_TEST_DIR}/test_b.log")
# Check behaviour when we don't have a default configured (should not create new file)
-&control.Tmp-String-0 := 'test_default'
+&control.Filter-Id := 'test_default'
linelog_ref
-if (noop) {
- test_pass
-}
-else {
+if !(noop) {
test_fail
}
}
ok
-&control.Tmp-String-0 := 'test_exec'
+&control.Filter-Id := 'test_exec'
linelog_ref
-&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_b.log")
+&test_string := %file.tail("$ENV{MODULE_TEST_DIR}/test_b.log")
-if (&Tmp-String-0 == 'bob exec') {
- test_pass
-}
-else {
+if !(&test_string == 'bob exec') {
test_fail
}
%file.rm("$ENV{MODULE_TEST_DIR}/test_c.log")
# Check behaviour using an attribute ref as a path
-&control.Tmp-String-0 := '.messages.test_xlat'
+&control.Filter-Id := '.messages.test_xlat'
linelog_fmt_and_ref_attr
-&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_c.log")
+&test_string := %file.tail("$ENV{MODULE_TEST_DIR}/test_c.log")
-if (&Tmp-String-0 == 'bob xlat') {
- test_pass
-}
-else {
+if !(&test_string == 'bob xlat') {
test_fail
}
# Check behaviour using an attribute ref (non existent path, with default also an attribute ref)
-&control.Tmp-String-0 := 'test_xlat'
+&control.Filter-Id := 'test_xlat'
linelog_fmt_and_ref_attr
-&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_c.log")
+&test_string := %file.tail("$ENV{MODULE_TEST_DIR}/test_c.log")
-if (&Tmp-String-0 == 'bob') {
- test_pass
-}
-else {
+if !(&test_string == 'bob') {
test_fail
}
# Check '.' is always prefixed to the path
-&control.Tmp-String-0 := 'messages.test_xlat'
+&control.Filter-Id := 'messages.test_xlat'
linelog_fmt_and_ref_attr
-&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_c.log")
+&test_string := %file.tail("$ENV{MODULE_TEST_DIR}/test_c.log")
-if (&Tmp-String-0 == 'bob xlat') {
- test_pass
-}
-else {
+if !(&test_string == 'bob xlat') {
test_fail
}
# Check '..' results in a 'fail' (can't go up one level)
-&control.Tmp-String-0 := '..messages.test_attr'
+&control.Filter-Id := '..messages.test_attr'
linelog_fmt_and_ref_attr {
fail = 1
}
-if (fail) {
- test_pass
-}
-else {
+if !(fail) {
test_fail
}
-&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_c.log")
+&test_string := %file.tail("$ENV{MODULE_TEST_DIR}/test_c.log")
-if (&Tmp-String-0 == 'bob xlat') {
- test_pass
-}
-else {
+if !(&test_string == 'bob xlat') {
test_fail
}
# Check '.messages' results in a 'fail' (messages is a section)
-&control.Tmp-String-0 := '.messages'
+&control.Filter-Id := '.messages'
linelog_fmt_and_ref_attr {
fail = 1
}
-if (fail) {
- test_pass
-}
-else {
+if !(fail) {
test_fail
}
linelog_fmt
-&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_d.log")
+&test_string := %file.tail("$ENV{MODULE_TEST_DIR}/test_d.log")
-if (&Tmp-String-0 == 'bob') {
- test_pass
-}
-else {
+if !(&test_string == 'bob') {
test_fail
}
%file.rm("$ENV{MODULE_TEST_DIR}/test_e.log")
# Set attribute used in header line
-&control.Tmp-String-1 := "%t"
+&control.Callback-Id := "%t"
linelog_header
-&Tmp-String-0 := %file.head("$ENV{MODULE_TEST_DIR}/test_e.log")
+&test_string := %file.head("$ENV{MODULE_TEST_DIR}/test_e.log")
-if (&Tmp-String-0 == "Log started %{control.Tmp-String-1}") {
- test_pass
-}
-else {
+if !(&test_string == "Log started %{control.Callback-Id}") {
test_fail
}
-&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_e.log")
+&test_string := %file.tail("$ENV{MODULE_TEST_DIR}/test_e.log")
-if (&Tmp-String-0 == 'bob,olobobob') {
- test_pass
-}
-else {
+if !(&test_string == 'bob,olobobob') {
test_fail
}
linelog_header
-&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_e.log")
+&test_string := %file.tail("$ENV{MODULE_TEST_DIR}/test_e.log")
-if (&Tmp-String-0 == 'bob,olobobob') {
- test_pass
-}
-else {
+if !(&test_string == 'bob,olobobob') {
test_fail
}
-&Tmp-Integer-0 := %exec('/bin/sh', '-c', "wc -l < $ENV{MODULE_TEST_DIR}/test_e.log")
+&test_integer := %exec('/bin/sh', '-c', "wc -l < $ENV{MODULE_TEST_DIR}/test_e.log")
-if (&Tmp-Integer-0 == 3) {
- test_pass
-}
-else {
+if !(&test_integer == 3) {
test_fail
}
+string test_string1
+string test_string2
+string test_string3
+
&control.Exec-Export := 'PATH="$ENV{PATH}:/bin:/usr/bin:/opt/bin:/usr/local/bin"'
#
if (%linelog_fmt_delim_xlat('bob') != 5) {
test_fail
}
-&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_xlat.log")
+&test_string1 := %file.tail("$ENV{MODULE_TEST_DIR}/test_xlat.log")
-if (&Tmp-String-0 == 'bob, ') {
+if (&test_string1 == 'bob, ') {
test_pass
}
else {
test_fail
}
-&Tmp-String-1 := 'more'
-&Tmp-String-2 := 'bob'
+&test_string2 := 'more'
+&test_string3 := 'bob'
-if (%linelog_fmt_delim_xlat("%{Tmp-String-1}%{Tmp-String-2}") != 9) {
+if (%linelog_fmt_delim_xlat("%{test_string2}%{test_string3}") != 9) {
test_fail
}
-&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_xlat.log")
-if (&Tmp-String-0 == 'bob, morebob, ') {
+&test_string1 := %file.tail("$ENV{MODULE_TEST_DIR}/test_xlat.log")
+if (&test_string1 == 'bob, morebob, ') {
test_pass
}
else {
test_fail
}
-&Tmp-String-0 := %file.tail("$ENV{MODULE_TEST_DIR}/test_xlat.log")
+&test_string1 := %file.tail("$ENV{MODULE_TEST_DIR}/test_xlat.log")
-if (&Tmp-String-0 == '{ "foo" : "bar", "baz" : "boink" }, ') {
+if (&test_string1 == '{ "foo" : "bar", "baz" : "boink" }, ') {
test_pass
}
else {
format = "%{User-Name} default"
- reference = ".messages.%{control.Tmp-String-0}"
+ reference = ".messages.%{control.Filter-Id}"
messages {
test_exec = `/bin/echo "%{User-Name} exec"`
filename = $ENV{MODULE_TEST_DIR}/test_b.log
}
- reference = ".messages.%{control.Tmp-String-0}"
+ reference = ".messages.%{control.Filter-Id}"
messages {
test_exec = `/bin/echo "%{User-Name} exec"`
format = &User-Name
- reference = &control.Tmp-String-0
+ reference = &control.Filter-Id
messages {
test_exec = `/bin/echo "%{User-Name} exec"`
filename = $ENV{MODULE_TEST_DIR}/test_e.log
}
- header = "Log started %{control.Tmp-String-1}"
+ header = "Log started %{control.Callback-Id}"
format = "%{User-Name},%{User-Password}"
}
filename = $ENV{MODULE_TEST_DIR}/test_escapes.log
}
- reference = ".messages.%{control.Tmp-String-0}"
+ reference = ".messages.%{control.Filter-Id}"
messages {
- test_attr = &control.Tmp-String-1
+ test_attr = &control.Callback-Id
test_xlat = "%{User-Name}\n\tbar"
test_literal = 'foo\nbar'
}
delimiter = ", "
- reference = ".messages.%{control.Tmp-String-0}"
+ reference = ".messages.%{control.Filter-Id}"
messages {
test_multi_str = &control.Reply-Message[*]
- test_multi_octets = &control.Tmp-Octets-0[*]
+ test_multi_octets = &control.Class[*]
test_empty = &control.User-Name[*]
}
}