Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/usr.sbin/mtree Test the netbsd and mtree flavors.
details: https://anonhg.NetBSD.org/src/rev/a3dcc6193b8d
branches: trunk
changeset: 783650:a3dcc6193b8d
user: christos <christos%NetBSD.org@localhost>
date: Wed Jan 02 18:11:44 2013 +0000
description:
Test the netbsd and mtree flavors.
diffstat:
tests/usr.sbin/mtree/Makefile | 6 +-
tests/usr.sbin/mtree/d_create.out | 55 ------
tests/usr.sbin/mtree/mtree_d_create.out | 55 ++++++
tests/usr.sbin/mtree/netbsd6_d_create.out | 55 ++++++
tests/usr.sbin/mtree/t_mtree.sh | 259 ++++++++++++++++++++++++++---
5 files changed, 340 insertions(+), 90 deletions(-)
diffs (truncated from 599 to 300 lines):
diff -r 5ce4e503a299 -r a3dcc6193b8d tests/usr.sbin/mtree/Makefile
--- a/tests/usr.sbin/mtree/Makefile Wed Jan 02 17:02:13 2013 +0000
+++ b/tests/usr.sbin/mtree/Makefile Wed Jan 02 18:11:44 2013 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1 2012/03/17 16:33:16 jruoho Exp $
+# $NetBSD: Makefile,v 1.2 2013/01/02 18:11:44 christos Exp $
NOMAN= # defined
@@ -9,12 +9,14 @@
TESTS_SH= t_mtree
FILESDIR= ${TESTSDIR}
+
FILES+= d_convert.in
FILES+= d_convert_C.out
FILES+= d_convert_C_S.out
FILES+= d_convert_D.out
FILES+= d_convert_D_S.out
-FILES+= d_create.out
+FILES+= netbsd6_d_create.out
+FILES+= mtree_d_create.out
FILES+= d_merge.in
FILES+= d_merge_C_M.out
FILES+= d_merge_C_M_S.out
diff -r 5ce4e503a299 -r a3dcc6193b8d tests/usr.sbin/mtree/d_create.out
--- a/tests/usr.sbin/mtree/d_create.out Wed Jan 02 17:02:13 2013 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-# user: x
-# machine: x
-# tree: x
-# date: x
-
-# .
-/set type=file nlink=1
-. type=dir nlink=4
- a.symlink.1 type=link link=a.file.1
- top.dangling \
- type=link link=nonexistent
- top.file.1 size=18 \
- sha256=74c53aaf0cd9543b7efad969de1058ee38859134ba467500b849811fc3513195
- top.symlink.b \
- type=link link=b
-
-# ./a
-a type=dir nlink=4
- a.file.1 size=18 \
- sha256=bdbea62f7ccdf862f22254ea871d523845250010d5f233896e800142a859eef2
- a.file.2 size=18 \
- sha256=77876d113fe1b45a41f8d1d3e178aaad7f91fcd93d3df782690625b74ad90fe6
- a.hardlink.b2 \
- nlink=2 size=18 \
- sha256=784fd6b95fe5054d87bf268de51dea043031c5e985f668d4f51e1c759b0f9333
-
-# ./a/1
-1 type=dir nlink=2
- a1.file.1 size=21 \
- sha256=a062cd272facdd38c4fdeff2a18947b28c99a28a8fe51f88468978740382e592
-# ./a/1
-..
-
-
-# ./a/2
-2 type=dir nlink=2
-# ./a/2
-..
-
-# ./a
-..
-
-
-# ./b
-b type=dir nlink=2
- b.file.1 nlink=2 size=18 \
- sha256=5754b0d97a8238ea0e495ab871667dcab8f1d684e323290ae76f70c47de18998
- b.file.2 nlink=2 size=18 \
- sha256=784fd6b95fe5054d87bf268de51dea043031c5e985f668d4f51e1c759b0f9333
- b.hardlink.1 \
- nlink=2 size=18 \
- sha256=5754b0d97a8238ea0e495ab871667dcab8f1d684e323290ae76f70c47de18998
-# ./b
-..
-
diff -r 5ce4e503a299 -r a3dcc6193b8d tests/usr.sbin/mtree/mtree_d_create.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.sbin/mtree/mtree_d_create.out Wed Jan 02 18:11:44 2013 +0000
@@ -0,0 +1,55 @@
+# user: x
+# machine: x
+# tree: x
+# date: x
+
+# .
+/set type=file nlink=1
+. type=dir nlink=4 size=240
+ a.symlink.1 type=link size=8 link=a.file.1
+ top.dangling \
+ type=link size=11 link=nonexistent
+ top.file.1 size=18 \
+ sha256=74c53aaf0cd9543b7efad969de1058ee38859134ba467500b849811fc3513195
+ top.symlink.b \
+ type=link size=1 link=b
+
+# ./a
+a type=dir nlink=4 size=200
+ a.file.1 size=18 \
+ sha256=bdbea62f7ccdf862f22254ea871d523845250010d5f233896e800142a859eef2
+ a.file.2 size=18 \
+ sha256=77876d113fe1b45a41f8d1d3e178aaad7f91fcd93d3df782690625b74ad90fe6
+ a.hardlink.b2 \
+ nlink=2 size=18 \
+ sha256=784fd6b95fe5054d87bf268de51dea043031c5e985f668d4f51e1c759b0f9333
+
+# ./a/1
+1 type=dir nlink=2 size=40
+ a1.file.1 size=21 \
+ sha256=a062cd272facdd38c4fdeff2a18947b28c99a28a8fe51f88468978740382e592
+# ./a/1
+..
+
+
+# ./a/2
+2 type=dir nlink=2 size=0
+# ./a/2
+..
+
+# ./a
+..
+
+
+# ./b
+b type=dir nlink=2 size=120
+ b.file.1 nlink=2 size=18 \
+ sha256=5754b0d97a8238ea0e495ab871667dcab8f1d684e323290ae76f70c47de18998
+ b.file.2 nlink=2 size=18 \
+ sha256=784fd6b95fe5054d87bf268de51dea043031c5e985f668d4f51e1c759b0f9333
+ b.hardlink.1 \
+ nlink=2 size=18 \
+ sha256=5754b0d97a8238ea0e495ab871667dcab8f1d684e323290ae76f70c47de18998
+# ./b
+..
+
diff -r 5ce4e503a299 -r a3dcc6193b8d tests/usr.sbin/mtree/netbsd6_d_create.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.sbin/mtree/netbsd6_d_create.out Wed Jan 02 18:11:44 2013 +0000
@@ -0,0 +1,55 @@
+# user: x
+# machine: x
+# tree: x
+# date: x
+
+# .
+/set type=file nlink=1
+. type=dir nlink=4
+ a.symlink.1 type=link link=a.file.1
+ top.dangling \
+ type=link link=nonexistent
+ top.file.1 size=18 \
+ sha256=74c53aaf0cd9543b7efad969de1058ee38859134ba467500b849811fc3513195
+ top.symlink.b \
+ type=link link=b
+
+# ./a
+a type=dir nlink=4
+ a.file.1 size=18 \
+ sha256=bdbea62f7ccdf862f22254ea871d523845250010d5f233896e800142a859eef2
+ a.file.2 size=18 \
+ sha256=77876d113fe1b45a41f8d1d3e178aaad7f91fcd93d3df782690625b74ad90fe6
+ a.hardlink.b2 \
+ nlink=2 size=18 \
+ sha256=784fd6b95fe5054d87bf268de51dea043031c5e985f668d4f51e1c759b0f9333
+
+# ./a/1
+1 type=dir nlink=2
+ a1.file.1 size=21 \
+ sha256=a062cd272facdd38c4fdeff2a18947b28c99a28a8fe51f88468978740382e592
+# ./a/1
+..
+
+
+# ./a/2
+2 type=dir nlink=2
+# ./a/2
+..
+
+# ./a
+..
+
+
+# ./b
+b type=dir nlink=2
+ b.file.1 nlink=2 size=18 \
+ sha256=5754b0d97a8238ea0e495ab871667dcab8f1d684e323290ae76f70c47de18998
+ b.file.2 nlink=2 size=18 \
+ sha256=784fd6b95fe5054d87bf268de51dea043031c5e985f668d4f51e1c759b0f9333
+ b.hardlink.1 \
+ nlink=2 size=18 \
+ sha256=5754b0d97a8238ea0e495ab871667dcab8f1d684e323290ae76f70c47de18998
+# ./b
+..
+
diff -r 5ce4e503a299 -r a3dcc6193b8d tests/usr.sbin/mtree/t_mtree.sh
--- a/tests/usr.sbin/mtree/t_mtree.sh Wed Jan 02 17:02:13 2013 +0000
+++ b/tests/usr.sbin/mtree/t_mtree.sh Wed Jan 02 18:11:44 2013 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_mtree.sh,v 1.4 2012/03/25 16:10:13 christos Exp $
+# $NetBSD: t_mtree.sh,v 1.5 2013/01/02 18:11:44 christos Exp $
#
# Copyright (c) 2009, 2012 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -28,6 +28,7 @@
# Postprocess mtree output, canonicalising portions that
# are expected to differ from one run to another.
#
+
h_postprocess()
{
sed -e '
@@ -43,7 +44,9 @@
diff -Nru "$1" "$2" || atf_fail "files $1 and $2 differ"
}
-atf_test_case create
+
+atf_test_case mtree_create
+atf_test_case netbsd6_create
create_head()
{
atf_set "descr" "Create a specfile describing a directory tree"
@@ -52,6 +55,7 @@
create_setup()
{
# create some directories
+ rm -fr create
mkdir -p create/a/1 create/a/2 create/b
# create some files
for file in create/top.file.1 \
@@ -80,13 +84,33 @@
create_setup
# run mtree and check output
- ( cd create && mtree -c -k type,nlink,link,size,sha256 ) >output.raw \
+ ( cd create && mtree -F ${FLAVOR} -c -k type,nlink,link,size,sha256 ) >output.raw \
|| atf_fail "mtree exit status $?"
h_postprocess <output.raw >output
- h_check "$(atf_get_srcdir)/d_create.out" output
+ h_check "$(atf_get_srcdir)/${FLAVOR}_d_create.out" output
+}
+
+mtree_create_head()
+{
+ FLAVOR=mtree create_head
+}
+netbsd6_create_head()
+{
+ FLAVOR=netbsd6 create_head
}
-atf_test_case check
+mtree_create_body()
+{
+ FLAVOR=mtree create_body
+}
+netbsd6_create_body()
+{
+ FLAVOR=netbsd6 create_body
+}
+
+
+atf_test_case mtree_check
+atf_test_case netbsd6_check
check_head()
{
atf_set "descr" "Check a directory tree against a specfile"
@@ -98,12 +122,32 @@
create_setup
# run mtree and check output
- ( cd create && mtree ) <"$(atf_get_srcdir)/d_create.out" >output \
+ ( cd create && mtree -F ${FLAVOR} ) <"$(atf_get_srcdir)/${FLAVOR}_d_create.out" >output \
|| atf_fail "mtree exit status $?"
h_check /dev/null output
}
-atf_test_case convert_C
+mtree_check_head()
+{
+ FLAVOR=mtree check_head
+}
+netbsd6_check_head()
+{
+ FLAVOR=netbsd6 check_head
+}
+
+mtree_check_body()
+{
+ FLAVOR=mtree check_body
+}
+netbsd6_check_body()
Home |
Main Index |
Thread Index |
Old Index