From 0c428864495af9dc7d2af4d0a5ae21732af9c739 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Wed, 1 Mar 2023 14:35:52 -0600 Subject: [PATCH] sysctl: tests: fix a couple issues The function that sets test case metadata is actually named ${tc}_head rather than ${tc}, so add the suffix. While we're here, hook the tests up to the infrastructure so that they do get run. Sponsored by: Klara, Inc. --- etc/mtree/BSD.tests.dist | 2 ++ sbin/sysctl/Makefile | 5 +++++ sbin/sysctl/tests/sysctl_test.sh | 12 ++++++------ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/etc/mtree/BSD.tests.dist b/etc/mtree/BSD.tests.dist index 859b5c5ace7f..f3420369ad80 100644 --- a/etc/mtree/BSD.tests.dist +++ b/etc/mtree/BSD.tests.dist @@ -466,6 +466,8 @@ .. route .. + sysctl + .. .. secure lib diff --git a/sbin/sysctl/Makefile b/sbin/sysctl/Makefile index 2069bd3382d2..ee6eba9feae5 100644 --- a/sbin/sysctl/Makefile +++ b/sbin/sysctl/Makefile @@ -1,10 +1,15 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD$ +.include + PACKAGE=runtime CONFS= sysctl.conf PROG= sysctl WARNS?= 3 MAN= sysctl.8 +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests + .include diff --git a/sbin/sysctl/tests/sysctl_test.sh b/sbin/sysctl/tests/sysctl_test.sh index a26c2c77b998..e932626a9f14 100644 --- a/sbin/sysctl/tests/sysctl_test.sh +++ b/sbin/sysctl/tests/sysctl_test.sh @@ -38,7 +38,7 @@ sysctl_by_name_body() atf_test_case sysctl_nflag -sysctl_nflag() +sysctl_nflag_head() { atf_set "descr" "Verify -n argument" } @@ -49,7 +49,7 @@ sysctl_nflag_body() atf_test_case sysctl_eflag -sysctl_eflag() +sysctl_eflag_head() { atf_set "descr" "Verify -e argument" } @@ -60,7 +60,7 @@ sysctl_eflag_body() atf_test_case sysctl_tflag -sysctl_tflag() +sysctl_tflag_head() { atf_set "descr" "Verify -t argument" } @@ -71,7 +71,7 @@ sysctl_tflag_body() atf_test_case sysctl_dflag -sysctl_dflag() +sysctl_dflag_head() { atf_set "descr" "Verify -d argument" } @@ -82,7 +82,7 @@ sysctl_dflag_body() atf_test_case sysctl_tflag_dflag -sysctl_tflag_dflag() +sysctl_tflag_dflag_head() { atf_set "descr" "Verify -t -d arguments" } @@ -94,7 +94,7 @@ sysctl_tflag_dflag_body() atf_test_case sysctl_nflag_tflag_dflag -sysctl_nflag_tflag_dflag() +sysctl_nflag_tflag_dflag_head() { atf_set "descr" "Verify -n -t -d arguments" }