Module Name:    src
Committed By:   apb
Date:           Sat Sep 19 20:37:05 UTC 2009

Modified Files:
        src/tests/util/mtree: Makefile t_mtree.sh
Added Files:
        src/tests/util/mtree: d_merge.in d_merge_C_M.out d_merge_C_M_S.out

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


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/util/mtree/Makefile \
    src/tests/util/mtree/t_mtree.sh
cvs rdiff -u -r0 -r1.1 src/tests/util/mtree/d_merge.in \
    src/tests/util/mtree/d_merge_C_M.out \
    src/tests/util/mtree/d_merge_C_M_S.out

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/util/mtree/Makefile
diff -u src/tests/util/mtree/Makefile:1.3 src/tests/util/mtree/Makefile:1.4
--- src/tests/util/mtree/Makefile:1.3	Wed Apr  8 19:06:30 2009
+++ src/tests/util/mtree/Makefile	Sat Sep 19 20:37:05 2009
@@ -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>
Index: src/tests/util/mtree/t_mtree.sh
diff -u src/tests/util/mtree/t_mtree.sh:1.3 src/tests/util/mtree/t_mtree.sh:1.4
--- src/tests/util/mtree/t_mtree.sh:1.3	Wed Apr  8 19:06:30 2009
+++ src/tests/util/mtree/t_mtree.sh	Sat Sep 19 20:37:05 2009
@@ -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
 }

Added files:

Index: src/tests/util/mtree/d_merge.in
diff -u /dev/null src/tests/util/mtree/d_merge.in:1.1
--- /dev/null	Sat Sep 19 20:37:05 2009
+++ src/tests/util/mtree/d_merge.in	Sat Sep 19 20:37:05 2009
@@ -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
Index: src/tests/util/mtree/d_merge_C_M.out
diff -u /dev/null src/tests/util/mtree/d_merge_C_M.out:1.1
--- /dev/null	Sat Sep 19 20:37:05 2009
+++ src/tests/util/mtree/d_merge_C_M.out	Sat Sep 19 20:37:05 2009
@@ -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 
Index: src/tests/util/mtree/d_merge_C_M_S.out
diff -u /dev/null src/tests/util/mtree/d_merge_C_M_S.out:1.1
--- /dev/null	Sat Sep 19 20:37:05 2009
+++ src/tests/util/mtree/d_merge_C_M_S.out	Sat Sep 19 20:37:05 2009
@@ -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 

Reply via email to