Add tests for "mtree -C" and "mtree -D". Add "link" keyword to

previous mtree tests.
This commit is contained in:
apb 2009-04-07 19:28:40 +00:00
parent eb993d20f8
commit 854eeab1fc
7 changed files with 105 additions and 8 deletions

View File

@ -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. # 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/make/t_make tests-util-tests
./usr/tests/util/mtree tests-util-tests ./usr/tests/util/mtree tests-util-tests
./usr/tests/util/mtree/Atffile 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/d_create.out tests-util-tests
./usr/tests/util/mtree/t_mtree tests-util-tests ./usr/tests/util/mtree/t_mtree tests-util-tests
./usr/tests/util/ps tests-util-tests ./usr/tests/util/ps tests-util-tests

View File

@ -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 NOMAN= # defined
@ -9,6 +9,9 @@ TESTSDIR= ${TESTSBASE}/util/mtree
TESTS_SH= t_mtree TESTS_SH= t_mtree
FILESDIR= ${TESTSDIR} 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> .include <bsd.test.mk>

View File

@ -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 "."
..

View File

@ -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

View File

@ -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

View File

@ -6,13 +6,13 @@
# . # .
/set type=file nlink=1 /set type=file nlink=1
. type=dir nlink=4 . type=dir nlink=4
a.symlink.1 type=link a.symlink.1 type=link link=a.file.1
top.dangling \ top.dangling \
type=link type=link link=nonexistent
top.file.1 size=18 \ top.file.1 size=18 \
sha256=74c53aaf0cd9543b7efad969de1058ee38859134ba467500b849811fc3513195 sha256=74c53aaf0cd9543b7efad969de1058ee38859134ba467500b849811fc3513195
top.symlink.b \ top.symlink.b \
type=link type=link link=b
# ./a # ./a
a type=dir nlink=4 a type=dir nlink=4

View File

@ -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. # Copyright (c) 2009 The NetBSD Foundation, Inc.
# All rights reserved. # All rights reserved.
@ -77,7 +77,7 @@ create_body()
create_setup create_setup
# run mtree and check output # 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 $?" || atf_fail "mtree exit status $?"
h_postprocess <output.raw >output h_postprocess <output.raw >output
h_check "$(atf_get_srcdir)/d_create.out" output h_check "$(atf_get_srcdir)/d_create.out" output
@ -99,8 +99,32 @@ check_body()
h_check /dev/null output 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_init_test_cases()
{ {
atf_add_test_case create atf_add_test_case create
atf_add_test_case check atf_add_test_case check
atf_add_test_case convert_C
atf_add_test_case convert_D
} }