diff options
author | Richard Jones <rjones@redhat.com> | 2009-10-19 17:44:16 +0100 |
---|---|---|
committer | Richard Jones <rjones@redhat.com> | 2009-10-20 10:31:54 +0100 |
commit | 42c89f2e6bd956f738080b5aec53b7520f4f96da (patch) | |
tree | 07cd56e1d28b20608eeb40ffe554ed242cd57ccb /regressions | |
parent | 55f5dc6f1195d7dec5687ece3f6e74dde649ff7c (diff) | |
download | libguestfs-42c89f2e6bd956f738080b5aec53b7520f4f96da.tar.gz libguestfs-42c89f2e6bd956f738080b5aec53b7520f4f96da.tar.xz libguestfs-42c89f2e6bd956f738080b5aec53b7520f4f96da.zip |
New API: find0 (unlimited version of find)
This adds a new API call guestfs_find0, which is like guestfs_find
but mainly doesn't suffer from the protocol limit of the earlier
command. The earlier command is not deprecated because it is
still very useful.
guestfs_find0 uses a FileOut parameter and writes the results to
an external file. The filenames in the output are separated by
ASCII NUL characters (so a bit like "find -print0").
There is also the addition of a regression test for this command.
Diffstat (limited to 'regressions')
-rw-r--r-- | regressions/Makefile.am | 1 | ||||
-rwxr-xr-x | regressions/test-find0.sh | 39 |
2 files changed, 40 insertions, 0 deletions
diff --git a/regressions/Makefile.am b/regressions/Makefile.am index 9112b94d..058b60dc 100644 --- a/regressions/Makefile.am +++ b/regressions/Makefile.am @@ -26,6 +26,7 @@ TESTS = \ rhbz503169c13.sh \ test-cancellation-download-librarycancels.sh \ test-cancellation-upload-daemoncancels.sh \ + test-find0.sh \ test-noexec-stack.pl \ test-qemudie-killsub.sh \ test-qemudie-midcommand.sh \ diff --git a/regressions/test-find0.sh b/regressions/test-find0.sh new file mode 100755 index 00000000..4849b642 --- /dev/null +++ b/regressions/test-find0.sh @@ -0,0 +1,39 @@ +#!/bin/sh - +# libguestfs +# Copyright (C) 2009 Red Hat Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +# Test find0 call. + +set -e + +rm -f test.out + +../fish/guestfish <<'EOF' +add-ro ../images/test.iso +run +mount-ro /dev/sda / +find0 / test.out +EOF + +n=$(tr '\0' '\n' < test.out | grep '^known-[1-5]' | wc -l) +[ "$n" = 5 ] || { + echo find0: Invalid list of files + tr '\0' '\n' < test.out + exit 1 +} + +rm -f test.out |