Date: Sun, 12 Apr 2020 22:11:29 +0000 (UTC) From: David Bright <dab@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r359838 - in stable/12: etc/mtree sbin/nvmecontrol sbin/nvmecontrol/tests Message-ID: <202004122211.03CMBTCl001235@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dab Date: Sun Apr 12 22:11:29 2020 New Revision: 359838 URL: https://svnweb.freebsd.org/changeset/base/359838 Log: MFC r359717: Add a basic test for nvmecontrol I recently made some bug fixes in nvmecontrol. It occurred to me that since nvmecontrol lacks any kyua tests, I should convert the informal testing I did into a more formal automated test. The test in this change should be considered just a starting point; it is neither complete nor thorough. While converting the test to ATF/kyua, I discovered a small bug in nvmecontrol; the nvmecontrol devlist command would always exit with an unsuccessful status. So I included the fix for that, too, so that the test won't fail. Sponsored by: Dell EMC Isilon Added: stable/12/sbin/nvmecontrol/tests/ - copied from r359717, head/sbin/nvmecontrol/tests/ Modified: stable/12/etc/mtree/BSD.tests.dist stable/12/sbin/nvmecontrol/Makefile stable/12/sbin/nvmecontrol/devlist.c Directory Properties: stable/12/ (props changed) Modified: stable/12/etc/mtree/BSD.tests.dist ============================================================================== --- stable/12/etc/mtree/BSD.tests.dist Sun Apr 12 21:23:51 2020 (r359837) +++ stable/12/etc/mtree/BSD.tests.dist Sun Apr 12 22:11:29 2020 (r359838) @@ -432,6 +432,8 @@ .. mdconfig .. + nvmecontrol + .. pfctl files .. Modified: stable/12/sbin/nvmecontrol/Makefile ============================================================================== --- stable/12/sbin/nvmecontrol/Makefile Sun Apr 12 21:23:51 2020 (r359837) +++ stable/12/sbin/nvmecontrol/Makefile Sun Apr 12 22:11:29 2020 (r359838) @@ -1,5 +1,7 @@ # $FreeBSD$ +.include <src.opts.mk> + PACKAGE=runtime PROG= nvmecontrol SRCS= comnd.c nvmecontrol.c @@ -11,6 +13,8 @@ MAN= nvmecontrol.8 LDFLAGS+= -rdynamic LIBADD+= util SUBDIR= modules +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests .PATH: ${SRCTOP}/sys/dev/nvme Modified: stable/12/sbin/nvmecontrol/devlist.c ============================================================================== --- stable/12/sbin/nvmecontrol/devlist.c Sun Apr 12 21:23:51 2020 (r359837) +++ stable/12/sbin/nvmecontrol/devlist.c Sun Apr 12 22:11:29 2020 (r359838) @@ -122,8 +122,10 @@ devlist(const struct cmd *f, int argc, char *argv[]) close(fd); } - if (found == 0) + if (found == 0) { printf("No NVMe controllers found.\n"); + exit(1); + } - exit(1); + exit(0); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202004122211.03CMBTCl001235>