Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/util/mtree Add tests for the "mtree -M" issue reported...



details:   https://anonhg.NetBSD.org/src/rev/20546a943ffd
branches:  trunk
changeset: 747543:20546a943ffd
user:      apb <apb%NetBSD.org@localhost>
date:      Sat Sep 19 20:37:05 2009 +0000

description:
Add tests for the "mtree -M" issue reported in PR 42031 from Geoff Wing.

diffstat:

 tests/util/mtree/Makefile          |   6 +++++-
 tests/util/mtree/d_merge.in        |  27 +++++++++++++++++++++++++++
 tests/util/mtree/d_merge_C_M.out   |  13 +++++++++++++
 tests/util/mtree/d_merge_C_M_S.out |  13 +++++++++++++
 tests/util/mtree/t_mtree.sh        |  17 ++++++++++++++++-
 5 files changed, 74 insertions(+), 2 deletions(-)

diffs (120 lines):

diff -r e0f5daa751c8 -r 20546a943ffd tests/util/mtree/Makefile
--- a/tests/util/mtree/Makefile Sat Sep 19 19:47:48 2009 +0000
+++ b/tests/util/mtree/Makefile Sat Sep 19 20:37:05 2009 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.3 2009/04/08 19:06:30 apb Exp $
+# $NetBSD: Makefile,v 1.4 2009/09/19 20:37:05 apb Exp $
 
 NOMAN=         # defined
 
@@ -15,5 +15,9 @@
 FILES+=                d_convert_D.out
 FILES+=                d_convert_D_S.out
 FILES+=                d_create.out
+FILES+=                d_merge.1.in
+FILES+=                d_merge.1.out
+FILES+=                d_merge.2.in
+FILES+=                d_merge.2.out
 
 .include <bsd.test.mk>
diff -r e0f5daa751c8 -r 20546a943ffd tests/util/mtree/d_merge.in
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/util/mtree/d_merge.in       Sat Sep 19 20:37:05 2009 +0000
@@ -0,0 +1,27 @@
+# The last entry for any duplicate node should take precedence.
+
+.                               type=dir
+
+# directory "a" with only one entry, changing from dir to link
+./a                             type=dir
+./a/change-dir-to-link          type=dir  mode=0755
+./a/change-dir-to-link          type=link  mode=0755
+
+# directory "b" with only one entry, changing from link to dir
+./b                             type=dir
+./b/change-link-to-dir          type=link  mode=0755
+./b/change-link-to-dir          type=dir  mode=0755
+
+# directory "c" with multiple entries, one changing from dir to link
+./c                             type=dir
+./c/aaa                         type=file
+./c/zzz                         type=file
+./c/change-dir-to-link          type=dir  mode=0755
+./c/change-dir-to-link          type=link  mode=0755
+
+# directory "d" with multiple entries, one changing from link to dir
+./d                             type=dir
+./d/aaa                         type=file
+./d/zzz                         type=file
+./d/change-link-to-dir          type=link  mode=0755
+./d/change-link-to-dir          type=dir  mode=0755
diff -r e0f5daa751c8 -r 20546a943ffd tests/util/mtree/d_merge_C_M.out
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/util/mtree/d_merge_C_M.out  Sat Sep 19 20:37:05 2009 +0000
@@ -0,0 +1,13 @@
+. type=dir 
+./a type=dir 
+./a/change-dir-to-link type=link mode=0755 
+./b type=dir 
+./b/change-link-to-dir type=dir mode=0755 
+./c type=dir 
+./c/aaa type=file 
+./c/zzz type=file 
+./c/change-dir-to-link type=link mode=0755 
+./d type=dir 
+./d/aaa type=file 
+./d/zzz type=file 
+./d/change-link-to-dir type=dir mode=0755 
diff -r e0f5daa751c8 -r 20546a943ffd tests/util/mtree/d_merge_C_M_S.out
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/util/mtree/d_merge_C_M_S.out        Sat Sep 19 20:37:05 2009 +0000
@@ -0,0 +1,13 @@
+. type=dir 
+./a type=dir 
+./a/change-dir-to-link type=link mode=0755 
+./b type=dir 
+./b/change-link-to-dir type=dir mode=0755 
+./c type=dir 
+./c/aaa type=file 
+./c/change-dir-to-link type=link mode=0755 
+./c/zzz type=file 
+./d type=dir 
+./d/aaa type=file 
+./d/zzz type=file 
+./d/change-link-to-dir type=dir mode=0755 
diff -r e0f5daa751c8 -r 20546a943ffd tests/util/mtree/t_mtree.sh
--- a/tests/util/mtree/t_mtree.sh       Sat Sep 19 19:47:48 2009 +0000
+++ b/tests/util/mtree/t_mtree.sh       Sat Sep 19 20:37:05 2009 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_mtree.sh,v 1.3 2009/04/08 19:06:30 apb Exp $
+# $NetBSD: t_mtree.sh,v 1.4 2009/09/19 20:37:05 apb Exp $
 #
 # Copyright (c) 2009 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -143,6 +143,20 @@
        h_check "$(atf_get_srcdir)/d_convert_D_S.out" output
 }
 
+atf_test_case merge
+merge_head()
+{
+       atf_set "descr" "Merge records of different type"
+}
+merge_body()
+{
+       mtree -C -M -K all <"$(atf_get_srcdir)/d_merge.in" >output
+       h_check "$(atf_get_srcdir)/d_merge_C_M.out" output
+       # same again, with sorting
+       mtree -C -M -S -K all <"$(atf_get_srcdir)/d_merge.in" >output
+       h_check "$(atf_get_srcdir)/d_merge_C_M_S.out" output
+}
+
 atf_init_test_cases()
 {
        atf_add_test_case create
@@ -151,4 +165,5 @@
        atf_add_test_case convert_C_S
        atf_add_test_case convert_D
        atf_add_test_case convert_D_S
+       atf_add_test_case merge
 }



Home | Main Index | Thread Index | Old Index