From: Alan T. DeKok Date: Wed, 19 Apr 2023 17:13:13 +0000 (-0400) Subject: add basic "test.detail" X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fee6b9dea5bee65f7248886ba54cb5290a8b248e;p=thirdparty%2Ffreeradius-server.git add basic "test.detail" --- diff --git a/src/tests/detail/all.mk b/src/tests/detail/all.mk new file mode 100644 index 00000000000..1fd90faeae9 --- /dev/null +++ b/src/tests/detail/all.mk @@ -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 index 00000000000..7522602f22a --- /dev/null +++ b/src/tests/detail/config/radiusd.conf @@ -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 index 00000000000..ab1f25f693d --- /dev/null +++ b/src/tests/detail/one.txt @@ -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