From nobody Wed Nov 27 22:27:19 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XzDZv3MNJz5fs8b; Wed, 27 Nov 2024 22:27:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XzDZv1njcz4VFH; Wed, 27 Nov 2024 22:27:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732746439; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=u9G4BVf8gKm+7LipYlI+Wt4xNrXgXIeil0NM/2lDGYM=; b=La4O/tEY4o0wSmuvWHtlNQ2/E8oNFNhY+QiObr+xmjXt1LkkznZx+sUDT7vsNPVlabtlF6 +jTn94aeZNyFchXEeyYkjAvEifJy2JHaUmACNkWOYgvkPYqkcQBKvv8yr6LqKrpkQ4coa4 wyoUNEOExQFtQNnzkRMzTWmn4tb0ngaRsQEKg+E9WfK5w0t9wM7co7ZChcAjf6YVRg61Ze iGcJ5PEcyRhvA+X0BHVRK5/uCzIYHaKi3oMpyj+ihvr83d5ll/Gwo/WSdhI1jhJccNju+4 x2AQxTgY8rLb+dK5llEB6g/paOIrCybeBsCQ8t5Ho/dmKo8Xb0Z//mj6GiNcjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732746439; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=u9G4BVf8gKm+7LipYlI+Wt4xNrXgXIeil0NM/2lDGYM=; b=EcdjJrAVfaPEWFXETQRZm0sbPAT7nfFrtffRWyB+K8GSM9XAkBSGFd6tBHNbfGoPr7uRA/ RcUCPu3dCKoVUfOHfIm8njjlyzaNBLPoMo4Z2/8z8mncIaQ19PTQPtZ2/GDqb0IYXRd09z q63APad9Mk3/oJRKoGGCGtdbx+FII8/WrwIEtnax559gbDtR6gNbqEhxzMbvalAXLwpGmb BXLUDpLA097DJCfHeQet9MYy5juMxTGaHiRtqxgqVUmJbRVto1YCBp5leGJLCYhOwubHKW 46AXMn9RHEkE1uHJTIXRv+X559lUdknOW+9wXacIIs9TkGozpPLovsM6p4qxRA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1732746439; a=rsa-sha256; cv=none; b=SqMdggLeWn85iakp+nPxn904hh+CHNOGBYfHlDyWLPQFAxOACGOgbLeoWpWpmgw4A5Cehf 2YMmGcdvIjuvYM9uB2Wt8bp/3uiYKaV33PTNVCxESoCL5QsIa2UsPtTAAC72fQGY8BTLX0 xvY0eZW/o7iWc+jd9YgDj0u56GslBuoUiVq7c/V1QcKsCBCZmP3JQV8YlKcxxzWorm5QaW EXD13IniYDtGLEKvDUdzKBOVK2NsuLmbb8VfxR+5t0YbQvRkaK7leIy7jA94HjauVN79p8 K/hq4wBDX6oRVCRbkBc2QDbavDRwcsv0lqlWcrrKTvEG/74+zgYwKeVrC7dHtg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XzDZv10m7z1Rl5; Wed, 27 Nov 2024 22:27:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4ARMRJni026955; Wed, 27 Nov 2024 22:27:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4ARMRJq3026952; Wed, 27 Nov 2024 22:27:19 GMT (envelope-from git) Date: Wed, 27 Nov 2024 22:27:19 GMT Message-Id: <202411272227.4ARMRJq3026952@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jake Freeland Subject: git: b872bb720630 - main - syslogd: Split up basic test case List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jfree X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b872bb7206300dea5d02313985704da75ae87598 Auto-Submitted: auto-generated The branch main has been updated by jfree: URL: https://cgit.FreeBSD.org/src/commit/?id=b872bb7206300dea5d02313985704da75ae87598 commit b872bb7206300dea5d02313985704da75ae87598 Author: Jake Freeland AuthorDate: 2024-11-27 22:26:16 +0000 Commit: Jake Freeland CommitDate: 2024-11-27 22:26:16 +0000 syslogd: Split up basic test case The basic case previously tested if messages are correctly logged over UNIX, INET, and INET6 transport. This single case can be split up into three separate cases to decrease code complexity and offer more granular results. Both INET and INET6 cases will be skipped if the kernel does not support the corresponding transport. Reviewed by: zlei, markj Differential Revision: https://reviews.freebsd.org/D47650 --- usr.sbin/syslogd/tests/syslogd_test.sh | 83 ++++++++++++++++++++++++---------- 1 file changed, 60 insertions(+), 23 deletions(-) diff --git a/usr.sbin/syslogd/tests/syslogd_test.sh b/usr.sbin/syslogd/tests/syslogd_test.sh index aa8d48e64f5c..e75c85d5995a 100644 --- a/usr.sbin/syslogd/tests/syslogd_test.sh +++ b/usr.sbin/syslogd/tests/syslogd_test.sh @@ -118,41 +118,76 @@ syslogd_stop() fi } -atf_test_case "basic" "cleanup" -basic_head() +atf_test_case "unix" "cleanup" +unix_head() { - atf_set descr "Messages are logged via supported transports" + atf_set descr "Messages are logged over UNIX transport" } -basic_body() +unix_body() { - logfile="${PWD}/basic.log" + local logfile="${PWD}/unix.log" + printf "user.debug\t${logfile}\n" > "${SYSLOGD_CONFIG}" syslogd_start - syslogd_log -p user.debug -t basic -h "${SYSLOGD_LOCAL_SOCKET}" \ + syslogd_log -p user.debug -t unix -h "${SYSLOGD_LOCAL_SOCKET}" \ "hello, world (unix)" - atf_check -s exit:0 -o match:"basic: hello, world \(unix\)" \ + atf_check -s exit:0 -o match:"unix: hello, world \(unix\)" \ tail -n 1 "${logfile}" +} +unix_cleanup() +{ + syslogd_stop +} - # Grab kernel configuration file. - sysctl kern.conftxt > conf.txt +atf_test_case "inet" "cleanup" +inet_head() +{ + atf_set descr "Messages are logged over INET transport" +} +inet_body() +{ + local logfile="${PWD}/inet.log" + + [ "$(sysctl -n kern.features.inet)" != "1" ] && + atf_skip "Kernel does not support INET" + + printf "user.debug\t${logfile}\n" > "${SYSLOGD_CONFIG}" + syslogd_start # We have INET transport; make sure we can use it. - if grep -qw "INET" conf.txt; then - syslogd_log -4 -p user.debug -t basic -h 127.0.0.1 -P "${SYSLOGD_UDP_PORT}" \ - "hello, world (v4)" - atf_check -s exit:0 -o match:"basic: hello, world \(v4\)" \ - tail -n 1 "${logfile}" - fi + syslogd_log -4 -p user.debug -t inet -h 127.0.0.1 -P "${SYSLOGD_UDP_PORT}" \ + "hello, world (v4)" + atf_check -s exit:0 -o match:"inet: hello, world \(v4\)" \ + tail -n 1 "${logfile}" +} +inet_cleanup() +{ + syslogd_stop +} + +atf_test_case "inet6" "cleanup" +inet6_head() +{ + atf_set descr "Messages are logged over INET6 transport" +} +inet6_body() +{ + local logfile="${PWD}/inet6.log" + + [ "$(sysctl -n kern.features.inet6)" != "1" ] && + atf_skip "Kernel does not support INET6" + + printf "user.debug\t${logfile}\n" > "${SYSLOGD_CONFIG}" + syslogd_start + # We have INET6 transport; make sure we can use it. - if grep -qw "INET6" conf.txt; then - syslogd_log -6 -p user.debug -t basic -h ::1 -P "${SYSLOGD_UDP_PORT}" \ - "hello, world (v6)" - atf_check -s exit:0 -o match:"basic: hello, world \(v6\)" \ - tail -n 1 "${logfile}" - fi + syslogd_log -6 -p user.debug -t unix -h ::1 -P "${SYSLOGD_UDP_PORT}" \ + "hello, world (v6)" + atf_check -s exit:0 -o match:"unix: hello, world \(v6\)" \ + tail -n 1 "${logfile}" } -basic_cleanup() +inet6_cleanup() { syslogd_stop } @@ -407,7 +442,9 @@ jail_noinet_cleanup() atf_init_test_cases() { - atf_add_test_case "basic" + atf_add_test_case "unix" + atf_add_test_case "inet" + atf_add_test_case "inet6" atf_add_test_case "reload" atf_add_test_case "prog_filter" atf_add_test_case "host_filter"