diff options
author | Ulrich Drepper <drepper@redhat.com> | 2003-11-07 23:00:00 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2003-11-07 23:00:00 +0000 |
commit | ca10f33858adef0c20f8bcbf65b49f920e3274e9 (patch) | |
tree | dff8ac42acd1b9e8e289058bc3a0cab2f907ae3b /io/ftwtest-sh | |
parent | c685b2b0b4e86f488ead098816292684362e55f7 (diff) | |
download | glibc-ca10f33858adef0c20f8bcbf65b49f920e3274e9.tar.gz glibc-ca10f33858adef0c20f8bcbf65b49f920e3274e9.tar.xz glibc-ca10f33858adef0c20f8bcbf65b49f920e3274e9.zip |
Update.
2003-11-07 Jakub Jelinek <jakub@redhat.com> * io/ftw.c (NFTW_OLD_NAME, NFTW_NEW_NAME): Define. (ftw_dir, ftw_startup): Add __attribute ((noinline)). (NFTW_OLD_NAME, NFTW_NEW_NAME): New functions. (NFTW_NAME): Only define if !_LIBC, add versioned_symbol and compat_symbol. * io/ftw64.c (NFTW_OLD_NAME, NFTW_NEW_NAME): Define. * io/Versions (libc): Export nftw@@GLIBC_2.3.3 and nftw64@@GLIBC_2.3.3. * io/ftw.h (FTW_ACTIONRETVAL): New flag. (FTW_CONTINUE, FTW_STOP, FTW_SKIP_SUBTREE, FTW_SKIP_SIBLINGS): New. * io/ftw.c (ftw_dir): Add old_dir argument. Clear result if it was FTW_SKIP_SIBLINGS after processing all dir entries. Change cwd back if old_dir != NULL. (process_entry): Adjust caller. Don't change cwd back here. Change FTW_SKIP_SUBTREE result to 0. (ftw_startup): Adjust ftw_dir caller. Clear result if it was FTW_SKIP_SUBTREE or FTW_SKIP_SIBLINGS. * io/ftwtest.c (skip_subtree, skip_siblings): New variables. (options, main): Add --skip-subtree and --skip-siblings options. (cb): Use return FTW_CONTINUE instead of return 0. Handle --skip-subtree and --skip-siblings. * io/ftwtest-sh: Add tests for FTW_ACTIONRETVAL. * manual/filesys.texi: Document FTW_ACTIONRETVAL.
Diffstat (limited to 'io/ftwtest-sh')
-rw-r--r-- | io/ftwtest-sh | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/io/ftwtest-sh b/io/ftwtest-sh index 76c1de7f3e..2fed2edcfa 100644 --- a/io/ftwtest-sh +++ b/io/ftwtest-sh @@ -202,6 +202,83 @@ succeeded EOF rm $testout +mkdir $tmpdir/foo/lvl1b +echo > $tmpdir/foo/lvl1b/file@1b +echo > $tmpdir/foo/lvl1b/file2@1b +echo > $tmpdir/foo/lvl1b/file3@1b + +LD_LIBRARY_PATH=$objpfx $ldso $testprogram --skip-subtree=lvl1 $tmpdir | + sort > $testout + +cat <<EOF | diff -u $testout - || exit 1 +base = "/tmp/", file = "ftwtest.d", flag = FTW_D, level = 0 +base = "/tmp/ftwtest.d/", file = "bar", flag = FTW_D, level = 1 +base = "/tmp/ftwtest.d/", file = "baz", flag = FTW_F, level = 1 +base = "/tmp/ftwtest.d/", file = "foo", flag = FTW_D, level = 1 +base = "/tmp/ftwtest.d/bar/", file = "xo", flag = FTW_F, level = 2 +base = "/tmp/ftwtest.d/foo/", file = "lvl1", flag = FTW_D, level = 2 +base = "/tmp/ftwtest.d/foo/", file = "lvl1b", flag = FTW_D, level = 2 +base = "/tmp/ftwtest.d/foo/lvl1b/", file = "file2@1b", flag = FTW_F, level = 3 +base = "/tmp/ftwtest.d/foo/lvl1b/", file = "file3@1b", flag = FTW_F, level = 3 +base = "/tmp/ftwtest.d/foo/lvl1b/", file = "file@1b", flag = FTW_F, level = 3 +EOF +rm $testout + +LD_LIBRARY_PATH=$objpfx $ldso $testprogram --skip-siblings=lvl1 $tmpdir | + sort > $testout + +# The filesystem is not required to put lvl1 before lvl1b. +# If lvl1b comes after lvl1, it shouldn't be printed, while if it +# comes before, it should. +catcmd=cat +[ -n "`ls -U $tmpdir/foo/ | sed -n '/lvl1$/,${/lvl1b$/p}'`" ] \ + && catcmd="grep -v lvl1b" + +$catcmd <<EOF | diff -u $testout - || exit 1 +base = "/tmp/", file = "ftwtest.d", flag = FTW_D, level = 0 +base = "/tmp/ftwtest.d/", file = "bar", flag = FTW_D, level = 1 +base = "/tmp/ftwtest.d/", file = "baz", flag = FTW_F, level = 1 +base = "/tmp/ftwtest.d/", file = "foo", flag = FTW_D, level = 1 +base = "/tmp/ftwtest.d/bar/", file = "xo", flag = FTW_F, level = 2 +base = "/tmp/ftwtest.d/foo/", file = "lvl1", flag = FTW_D, level = 2 +base = "/tmp/ftwtest.d/foo/", file = "lvl1b", flag = FTW_D, level = 2 +base = "/tmp/ftwtest.d/foo/lvl1b/", file = "file2@1b", flag = FTW_F, level = 3 +base = "/tmp/ftwtest.d/foo/lvl1b/", file = "file3@1b", flag = FTW_F, level = 3 +base = "/tmp/ftwtest.d/foo/lvl1b/", file = "file@1b", flag = FTW_F, level = 3 +EOF +rm $testout + +LD_LIBRARY_PATH=$objpfx $ldso $testprogram --skip-siblings=file@1b $tmpdir | + sort > $testout + +# The filesystem is not required to put file2@1b and file3@1b after file@1b. +# If file[23]@1b come after file@1b, it shouldn't be printed, while if they +# come before, they should. +regexp=`echo $(ls -U /tmp/ftwtest.d/foo/lvl1b \ + | sed -n '/file@1b$/,${/file[23]@1b$/p}') | sed 's, ,|,'` +catcmd=cat +[ -n "$regexp" ] && catcmd="egrep -v $regexp" + +$catcmd <<EOF | diff -u $testout - || exit 1 +base = "/tmp/", file = "ftwtest.d", flag = FTW_D, level = 0 +base = "/tmp/ftwtest.d/", file = "bar", flag = FTW_D, level = 1 +base = "/tmp/ftwtest.d/", file = "baz", flag = FTW_F, level = 1 +base = "/tmp/ftwtest.d/", file = "foo", flag = FTW_D, level = 1 +base = "/tmp/ftwtest.d/bar/", file = "xo", flag = FTW_F, level = 2 +base = "/tmp/ftwtest.d/foo/", file = "lvl1", flag = FTW_D, level = 2 +base = "/tmp/ftwtest.d/foo/", file = "lvl1b", flag = FTW_D, level = 2 +base = "/tmp/ftwtest.d/foo/lvl1/", file = "file@1", flag = FTW_F, level = 3 +base = "/tmp/ftwtest.d/foo/lvl1/", file = "link@1", flag = FTW_SLN, level = 3 +base = "/tmp/ftwtest.d/foo/lvl1/", file = "lvl2", flag = FTW_D, level = 3 +base = "/tmp/ftwtest.d/foo/lvl1/lvl2/", file = "file@2", flag = FTW_F, level = 4 +base = "/tmp/ftwtest.d/foo/lvl1/lvl2/", file = "lvl3", flag = FTW_D, level = 4 +base = "/tmp/ftwtest.d/foo/lvl1/lvl2/lvl3/", file = "file@3", flag = FTW_F, level = 5 +base = "/tmp/ftwtest.d/foo/lvl1b/", file = "file2@1b", flag = FTW_F, level = 3 +base = "/tmp/ftwtest.d/foo/lvl1b/", file = "file3@1b", flag = FTW_F, level = 3 +base = "/tmp/ftwtest.d/foo/lvl1b/", file = "file@1b", flag = FTW_F, level = 3 +EOF +rm $testout + rm -fr $tmpdir exit 0 |