faubackup/tests t_find.at,NONE,1.1

Martin Waitz <[email protected]> Mon, 26 Apr 2004 22:26:35 +0000
Newsgroups gmane.comp.sysutils.backup.faubackup.cvs
Message-ID <[email protected]>
Update of /cvsroot/faubackup/faubackup/tests
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv568/tests

Added Files:
	t_find.at 
Log Message:
add test for faubackup-find

--- NEW FILE: t_find.at ---
AT_SETUP([faubackup-find])


m4_define([dir_exclude], [
	subdir=$1
	mkdir "testdir/$subdir"
])

m4_define([dir_include], [
	dir_exclude($1)
	mkdir "checkdir/$subdir"
])

m4_define([file_exclude], [
	AT_DATA("testdir/$subdir/$1", $2
) ])

m4_define([file_include], [
	file_exclude($1, $2)
	touch "checkdir/$subdir/$1"
])


# the test tree
dir_include()
  dir_include(a)
    file_exclude(.faubackuprc, NoBackup)
    file_exclude(foo, foo)
    file_exclude(bar, bar)
  dir_include(b)
    file_include(1, one)
    file_include(2, two)
    file_include(3, three)
    file_include(abc, 2)
    file_include(def, 3)
    file_include(ghi, 4)
    file_include(whith space, hello world)
    file_include(with	tab, how are you?)
    file_include(with
return, lets see if this works)
 

# execute test
AT_CHECK(cd testdir && FAUBACKUP_FIND, , [stdout])

# the following xargs command should remove the entire contents of checkdir
# if faubackup-find reports too much, it will fail
# if faubackup-find misses something, then the directory will not be emptied
# rmdir foo/. does not work, so it must be checked separately
AT_CHECK(xargs -0 -n 1 -i <stdout \
 sh -c 'if test -d "checkdir/{}"; then \
		if test "{}" != .; then rmdir "checkdir/{}"; fi; \
	else rm "checkdir/{}"; fi')
AT_CHECK(test -d checkdir)
AT_CHECK(find checkdir, , checkdir
)
AT_CHECK(rmdir checkdir)

AT_CLEANUP



-------------------------------------------------------
This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek
For a limited time only, get FREE Ground shipping on all orders of $35
or more. Hurry up and shop folks, this offer expires April 30th!
http://www.thinkgeek.com/freeshipping/?cpg=12297