From owner-svn-src-stable-12@freebsd.org Sun Apr 12 22:11:30 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 33EBC2AB6DC; Sun, 12 Apr 2020 22:11:30 +0000 (UTC) (envelope-from dab@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 490mDf0djnz3HFC; Sun, 12 Apr 2020 22:11:30 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 112428C4D; Sun, 12 Apr 2020 22:11:30 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03CMBT9I001237; Sun, 12 Apr 2020 22:11:29 GMT (envelope-from dab@FreeBSD.org) Received: (from dab@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03CMBTCl001235; Sun, 12 Apr 2020 22:11:29 GMT (envelope-from dab@FreeBSD.org) Message-Id: <202004122211.03CMBTCl001235@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dab set sender to dab@FreeBSD.org using -f From: David Bright Date: Sun, 12 Apr 2020 22:11:29 +0000 (UTC) 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 X-SVN-Group: stable-12 X-SVN-Commit-Author: dab X-SVN-Commit-Paths: in stable/12: etc/mtree sbin/nvmecontrol sbin/nvmecontrol/tests X-SVN-Commit-Revision: 359838 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Apr 2020 22:11:30 -0000 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 + 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); }