]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
add basic "test.detail"
authorAlan T. DeKok <aland@freeradius.org>
Wed, 19 Apr 2023 17:13:13 +0000 (13:13 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 19 Apr 2023 17:13:13 +0000 (13:13 -0400)
src/tests/detail/all.mk [new file with mode: 0644]
src/tests/detail/config/radiusd.conf [new file with mode: 0644]
src/tests/detail/one.txt [new file with mode: 0644]

diff --git a/src/tests/detail/all.mk b/src/tests/detail/all.mk
new file mode 100644 (file)
index 0000000..1fd90fa
--- /dev/null
@@ -0,0 +1,28 @@
+#
+#      Unit tests for the detail file reader.
+#
+
+#
+#      Test name
+#
+TEST  := test.detail
+FILES := $(subst $(DIR)/,,$(wildcard $(DIR)/*.txt))
+
+$(eval $(call TEST_BOOTSTRAP))
+
+#
+#      Run the radclient commands against the radiusd.
+#
+$(OUTPUT)/%: $(DIR)/%
+       $(eval DIR := $(dir $<))
+       ${Q}echo "DETAIL $(notdir $<)"
+       ${Q}cp $< $(dir $@)/detail.txt
+       ${Q}if ! $(TEST_BIN)/radiusd -d $(DIR)/config -D ${top_srcdir}/share/dictionary -X > $@; then \
+               tail $@; \
+               echo "cp $< $(dir $@)/detail.txt; $(TEST_BIN)/radiusd -d $(DIR)/config -D ${top_srcdir}/share/dictionary -X "; \
+               exit 1; \
+       fi
+
+.NO_PARALLEL: $(TEST)
+$(TEST):
+       @touch $(BUILD_DIR)/tests/$@
diff --git a/src/tests/detail/config/radiusd.conf b/src/tests/detail/config/radiusd.conf
new file mode 100644 (file)
index 0000000..7522602
--- /dev/null
@@ -0,0 +1,89 @@
+#  -*- text -*-
+#
+#  test configuration file.  Do not install.
+#
+#  $Id$
+#
+
+#
+#  Minimal radiusd.conf for testing
+#
+
+output       = build/tests/detail
+
+run_dir      = ${output}
+raddb        = raddb
+pidfile      = ${run_dir}/radiusd.pid
+panic_action = "gdb -batch -x src/tests/panic.gdb %e %p > ${run_dir}/gdb.log 2>&1; cat ${run_dir}/gdb.log"
+
+maindir      = ${raddb}
+radacctdir   = ${run_dir}/radacct
+modconfdir   = ${maindir}/mods-config
+certdir      = ${maindir}/certs
+cadir        = ${maindir}/certs
+
+client localhost {
+       ipaddr = 127.0.0.1
+       secret = testing123
+}
+
+modules {
+       always reject {
+               rcode = reject
+       }
+       always fail {
+               rcode = fail
+       }
+       always ok {
+               rcode = ok
+       }
+       always handled {
+               rcode = handled
+       }
+       always invalid {
+               rcode = invalid
+       }
+       always disallow {
+               rcode = disallow
+       }
+       always notfound {
+               rcode = notfound
+       }
+       always noop {
+               rcode = noop
+       }
+       always updated {
+               rcode = updated
+       }
+}
+
+server default {
+       namespace = radius
+
+       listen detail {
+               type = Accounting-Request
+
+               proto = detail
+
+               exit_when_done = yes
+
+               file {
+                       filename = ${output}/detail*
+                       immediate = yes
+               }
+
+               work {
+                       filename = ${output}/detail.work
+                       track = yes
+               }
+
+       }
+
+       recv Accounting-Request {
+               ok
+       }
+
+       send Accounting-Response {
+       }
+
+}
diff --git a/src/tests/detail/one.txt b/src/tests/detail/one.txt
new file mode 100644 (file)
index 0000000..ab1f25f
--- /dev/null
@@ -0,0 +1,8 @@
+Tue Sep 13 16:24:27 2011
+       User-Name = "bob"
+       NAS-IP-Address = 10.10.0.179
+       NAS-Port = 0
+       NAS-Port-Type = Wireless-802.16
+       Calling-Station-Id = "0123456789"
+       Acct-Unique-Session-Id = "ed8119f6919c6f6f"
+       Timestamp = 1554226681