Module Name: src
Committed By: apb
Date: Tue Apr 7 19:28:41 UTC 2009
Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/util/mtree: Makefile d_create.out t_mtree.sh
Added Files:
src/tests/util/mtree: d_convert.in d_convert_C.out d_convert_D.out
Log Message:
Add tests for "mtree -C" and "mtree -D". Add "link" keyword to
previous mtree tests.
To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.1 -r1.2 src/tests/util/mtree/Makefile \
src/tests/util/mtree/d_create.out src/tests/util/mtree/t_mtree.sh
cvs rdiff -u -r0 -r1.1 src/tests/util/mtree/d_convert.in \
src/tests/util/mtree/d_convert_C.out src/tests/util/mtree/d_convert_D.out
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.36 src/distrib/sets/lists/tests/mi:1.37
--- src/distrib/sets/lists/tests/mi:1.36 Tue Apr 7 13:52:08 2009
+++ src/distrib/sets/lists/tests/mi Tue Apr 7 19:28:40 2009
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.36 2009/04/07 13:52:08 apb Exp $
+# $NetBSD: mi,v 1.37 2009/04/07 19:28:40 apb Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -986,6 +986,9 @@
./usr/tests/util/make/t_make tests-util-tests
./usr/tests/util/mtree tests-util-tests
./usr/tests/util/mtree/Atffile tests-util-tests
+./usr/tests/util/mtree/d_convert.in tests-util-tests
+./usr/tests/util/mtree/d_convert_C.out tests-util-tests
+./usr/tests/util/mtree/d_convert_D.out tests-util-tests
./usr/tests/util/mtree/d_create.out tests-util-tests
./usr/tests/util/mtree/t_mtree tests-util-tests
./usr/tests/util/ps tests-util-tests
Index: src/tests/util/mtree/Makefile
diff -u src/tests/util/mtree/Makefile:1.1 src/tests/util/mtree/Makefile:1.2
--- src/tests/util/mtree/Makefile:1.1 Tue Apr 7 13:52:08 2009
+++ src/tests/util/mtree/Makefile Tue Apr 7 19:28:40 2009
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1 2009/04/07 13:52:08 apb Exp $
+# $NetBSD: Makefile,v 1.2 2009/04/07 19:28:40 apb Exp $
NOMAN= # defined
@@ -9,6 +9,9 @@
TESTS_SH= t_mtree
FILESDIR= ${TESTSDIR}
-FILES= d_create.out
+FILES+= d_convert.in
+FILES+= d_convert_C.out
+FILES+= d_convert_D.out
+FILES+= d_create.out
.include <bsd.test.mk>
Index: src/tests/util/mtree/d_create.out
diff -u src/tests/util/mtree/d_create.out:1.1 src/tests/util/mtree/d_create.out:1.2
--- src/tests/util/mtree/d_create.out:1.1 Tue Apr 7 13:52:08 2009
+++ src/tests/util/mtree/d_create.out Tue Apr 7 19:28:40 2009
@@ -6,13 +6,13 @@
# .
/set type=file nlink=1
. type=dir nlink=4
- a.symlink.1 type=link
+ a.symlink.1 type=link link=a.file.1
top.dangling \
- type=link
+ type=link link=nonexistent
top.file.1 size=18 \
sha256=74c53aaf0cd9543b7efad969de1058ee38859134ba467500b849811fc3513195
top.symlink.b \
- type=link
+ type=link link=b
# ./a
a type=dir nlink=4
Index: src/tests/util/mtree/t_mtree.sh
diff -u src/tests/util/mtree/t_mtree.sh:1.1 src/tests/util/mtree/t_mtree.sh:1.2
--- src/tests/util/mtree/t_mtree.sh:1.1 Tue Apr 7 13:52:08 2009
+++ src/tests/util/mtree/t_mtree.sh Tue Apr 7 19:28:40 2009
@@ -1,4 +1,4 @@
-# $NetBSD: t_mtree.sh,v 1.1 2009/04/07 13:52:08 apb Exp $
+# $NetBSD: t_mtree.sh,v 1.2 2009/04/07 19:28:40 apb Exp $
#
# Copyright (c) 2009 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -77,7 +77,7 @@
create_setup
# run mtree and check output
- ( cd create && mtree -c -k type,nlink,size,sha256 ) >output.raw \
+ ( cd create && mtree -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
@@ -99,8 +99,32 @@
h_check /dev/null output
}
+atf_test_case convert_C
+convert_C_head()
+{
+ atf_set "descr" "Convert a specfile to mtree -C format"
+}
+convert_C_body()
+{
+ mtree -C -K all <"$(atf_get_srcdir)/d_convert.in" >output
+ h_check "$(atf_get_srcdir)/d_convert_C.out" output
+}
+
+atf_test_case convert_D
+convert_D_head()
+{
+ atf_set "descr" "Convert a specfile to mtree -D format"
+}
+convert_D_body()
+{
+ mtree -D -K all <"$(atf_get_srcdir)/d_convert.in" >output
+ h_check "$(atf_get_srcdir)/d_convert_D.out" output
+}
+
atf_init_test_cases()
{
atf_add_test_case create
atf_add_test_case check
+ atf_add_test_case convert_C
+ atf_add_test_case convert_D
}
Added files:
Index: src/tests/util/mtree/d_convert.in
diff -u /dev/null src/tests/util/mtree/d_convert.in:1.1
--- /dev/null Tue Apr 7 19:28:41 2009
+++ src/tests/util/mtree/d_convert.in Tue Apr 7 19:28:40 2009
@@ -0,0 +1,39 @@
+# Similar to d_create.out, but a few entries have been deleted; nlink,
+# size and sha256 attributes have been removed; and the order has been
+# changed to test sorting.
+
+# .
+. type=dir
+ a.symlink.1 type=link link=a.file.1
+ top.dangling type=link link=nonexistent
+ top.file.1 type=file
+ top.symlink.b \
+ type=link link=b
+
+# ./b
+b type=dir
+ b.file.1 type=file
+ b.file.2 type=file
+# end ./b, up to "."
+..
+
+# ./a
+a type=dir
+ a.file.2 type=file
+
+# ./a/1
+1 type=dir
+ a1.file.1 type=file
+# end ./a/1, up to "./a"
+..
+
+ a.file.1 type=file
+
+# ./a/2
+2 type=dir
+# end ./a/2, up to "./a"
+..
+
+# end ./a, up to "."
+..
+
Index: src/tests/util/mtree/d_convert_C.out
diff -u /dev/null src/tests/util/mtree/d_convert_C.out:1.1
--- /dev/null Tue Apr 7 19:28:41 2009
+++ src/tests/util/mtree/d_convert_C.out Tue Apr 7 19:28:40 2009
@@ -0,0 +1,14 @@
+. type=dir
+./a.symlink.1 type=link link=a.file.1
+./top.dangling type=link link=nonexistent
+./top.file.1 type=file
+./top.symlink.b type=link link=b
+./b type=dir
+./b/b.file.1 type=file
+./b/b.file.2 type=file
+./a type=dir
+./a/a.file.2 type=file
+./a/1 type=dir
+./a/1/a1.file.1 type=file
+./a/a.file.1 type=file
+./a/2 type=dir
Index: src/tests/util/mtree/d_convert_D.out
diff -u /dev/null src/tests/util/mtree/d_convert_D.out:1.1
--- /dev/null Tue Apr 7 19:28:41 2009
+++ src/tests/util/mtree/d_convert_D.out Tue Apr 7 19:28:40 2009
@@ -0,0 +1,14 @@
+type=dir .
+type=link link=a.file.1 ./a.symlink.1
+type=link link=nonexistent ./top.dangling
+type=file ./top.file.1
+type=link link=b ./top.symlink.b
+type=dir ./b
+type=file ./b/b.file.1
+type=file ./b/b.file.2
+type=dir ./a
+type=file ./a/a.file.2
+type=dir ./a/1
+type=file ./a/1/a1.file.1
+type=file ./a/a.file.1
+type=dir ./a/2