Add tests for "mtree -C -S" and "mtree -D -S"; convert previous tests

for "mtree -C" and "mtree -D" to expect the output to be in the same
order as the input.
This commit is contained in:
apb 2009-04-08 19:06:30 +00:00
parent ef658dd50e
commit 7291fc32b2
7 changed files with 65 additions and 10 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.2 2009/04/07 19:28:40 apb Exp $
# $NetBSD: Makefile,v 1.3 2009/04/08 19:06:30 apb Exp $
NOMAN= # defined
@ -11,7 +11,9 @@ 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
.include <bsd.test.mk>

View File

@ -6,17 +6,18 @@
. 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
b.file.1 type=file
# end ./b, up to "."
..
top.file.1 type=file
# ./a
a type=dir
a.file.2 type=file

View File

@ -1,11 +1,11 @@
. 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
./b/b.file.1 type=file
./top.file.1 type=file
./a type=dir
./a/a.file.2 type=file
./a/1 type=dir

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
./a type=dir
./a/a.file.1 type=file
./a/a.file.2 type=file
./a/1 type=dir
./a/1/a1.file.1 type=file
./a/2 type=dir
./b type=dir
./b/b.file.1 type=file
./b/b.file.2 type=file

View File

@ -1,11 +1,11 @@
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=file ./b/b.file.1
type=file ./top.file.1
type=dir ./a
type=file ./a/a.file.2
type=dir ./a/1

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 ./a
type=file ./a/a.file.1
type=file ./a/a.file.2
type=dir ./a/1
type=file ./a/1/a1.file.1
type=dir ./a/2
type=dir ./b
type=file ./b/b.file.1
type=file ./b/b.file.2

View File

@ -1,4 +1,4 @@
# $NetBSD: t_mtree.sh,v 1.2 2009/04/07 19:28:40 apb Exp $
# $NetBSD: t_mtree.sh,v 1.3 2009/04/08 19:06:30 apb Exp $
#
# Copyright (c) 2009 The NetBSD Foundation, Inc.
# All rights reserved.
@ -102,7 +102,7 @@ check_body()
atf_test_case convert_C
convert_C_head()
{
atf_set "descr" "Convert a specfile to mtree -C format"
atf_set "descr" "Convert a specfile to mtree -C format, unsorted"
}
convert_C_body()
{
@ -110,10 +110,21 @@ convert_C_body()
h_check "$(atf_get_srcdir)/d_convert_C.out" output
}
atf_test_case convert_C_S
convert_C_S_head()
{
atf_set "descr" "Convert a specfile to mtree -C format, sorted"
}
convert_C_S_body()
{
mtree -C -S -K all <"$(atf_get_srcdir)/d_convert.in" >output
h_check "$(atf_get_srcdir)/d_convert_C_S.out" output
}
atf_test_case convert_D
convert_D_head()
{
atf_set "descr" "Convert a specfile to mtree -D format"
atf_set "descr" "Convert a specfile to mtree -D format, unsorted"
}
convert_D_body()
{
@ -121,10 +132,23 @@ convert_D_body()
h_check "$(atf_get_srcdir)/d_convert_D.out" output
}
atf_test_case convert_D_S
convert_D_S_head()
{
atf_set "descr" "Convert a specfile to mtree -D format, sorted"
}
convert_D_S_body()
{
mtree -D -S -K all <"$(atf_get_srcdir)/d_convert.in" >output
h_check "$(atf_get_srcdir)/d_convert_D_S.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_C_S
atf_add_test_case convert_D
atf_add_test_case convert_D_S
}