]> xenbits.xensource.com Git - people/royger/freebsd.git/commitdiff
newfs_msdos: connect the ATF test from NetBSD
authorEric van Gyzen <vangyzen@FreeBSD.org>
Mon, 31 Jan 2022 20:43:04 +0000 (14:43 -0600)
committerEric van Gyzen <vangyzen@FreeBSD.org>
Wed, 2 Mar 2022 21:56:30 +0000 (15:56 -0600)
NetBSD has an ATF test for newfs_msdos.  Connect it to the build.
Adapt it for FreeBSD.  This would have caught the bug fixed by my
previous commit.

Reviewed by: delphij, emaste
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D34116

(cherry picked from commit 4e71258227d6a0d7ae5adadb0f3672bfce2bc906)

contrib/netbsd-tests/sbin/newfs_msdos/t_create.sh
etc/mtree/BSD.tests.dist
sbin/newfs_msdos/Makefile
sbin/newfs_msdos/tests/Makefile [new file with mode: 0644]

index dc431166a4699317609fdee14ac70879d8b13cd8..61ed927b8889cc0370effde10c3360933c1c9cac 100755 (executable)
@@ -31,11 +31,21 @@ validfat32_head() {
 }
 validfat32_body() {
 
-       atf_check -s eq:0 -o ignore -e ignore \
+       if true; then
+               # FreeBSD
+               exp_err=empty
+               fsck=fsck_msdosfs
+       else
+               # NetBSD
+               exp_err=ignore
+               fsck=fsck_msdos
+       fi
+
+       atf_check -s eq:0 -o ignore -e $exp_err \
            newfs_msdos -b 512 -C 33m -F 32 msdos.img
 #      fsck_msdos/newfs_msdos have been fixed
 #      atf_expect_fail "PR bin/46743"
-       atf_check -s eq:0 -o not-match:FIXED -e empty fsck_msdos -p msdos.img
+       atf_check -s eq:0 -o not-match:FIXED -e empty $fsck -p msdos.img
        atf_expect_pass
 }
 
index b21256c8563c96a7bcb52c829f54b7f3c887fdc7..e3195c47ee88c605a141332bc2c398d080b5f2a3 100644 (file)
         ..
         mdconfig
         ..
+        newfs_msdos
+        ..
         nvmecontrol
         ..
         pfctl
index d12cf0245df299e21fefeffcd6e2385418f7fea0..0123f4dd7a8a6855a770595cc38238048b129b55 100644 (file)
@@ -1,5 +1,7 @@
 # $FreeBSD$
 
+.include <src.opts.mk>
+
 PACKAGE=runtime
 PROG=  newfs_msdos
 MAN=   newfs_msdos.8
@@ -11,4 +13,7 @@ WARNS?= 3
 .endif
 CSTD=  c11
 
+HAS_TESTS=
+SUBDIR.${MK_TESTS}+= tests
+
 .include <bsd.prog.mk>
diff --git a/sbin/newfs_msdos/tests/Makefile b/sbin/newfs_msdos/tests/Makefile
new file mode 100644 (file)
index 0000000..3f112c7
--- /dev/null
@@ -0,0 +1,6 @@
+TESTSRC=${SRCTOP}/contrib/netbsd-tests/sbin/newfs_msdos
+
+NETBSD_ATF_TESTS_SH+=  create
+
+.include <netbsd-tests.test.mk>
+.include <bsd.test.mk>