Pino Toscano
2014-Oct-06 16:12 UTC
[Libguestfs] [PATCH] log: tests: skip fedora.img if journal is not available
---
cat/test-virt-log.sh | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/cat/test-virt-log.sh b/cat/test-virt-log.sh
index af6bb95..d4fa0ed 100755
--- a/cat/test-virt-log.sh
+++ b/cat/test-virt-log.sh
@@ -19,7 +19,32 @@
export LANG=C
set -e
+can_handle ()
+{
+ fn=$(basename $1)
+ case "$fn" in
+ fedora.img)
+ guestfish -a /dev/null run : available journal
+ ;;
+ *)
+ return 0
+ ;;
+ esac
+}
+
# Read out the log files from the image using virt-log.
for f in ../tests/guests/{fedora,debian,ubuntu}.img; do
- if [ -s "$f" ]; then $VG virt-log -a "$f"; fi
+ echo "Trying $f ..."
+ if [ ! -s "$f" ]; then
+ echo "SKIP: empty file"
+ echo
+ continue
+ fi
+ if ! can_handle "$f"; then
+ echo "SKIP: cannot handle $f"
+ echo
+ continue
+ fi
+ $VG virt-log -a "$f"
+ echo
done
--
1.9.3
Richard W.M. Jones
2014-Oct-06 18:50 UTC
Re: [Libguestfs] [PATCH] log: tests: skip fedora.img if journal is not available
On Mon, Oct 06, 2014 at 06:12:17PM +0200, Pino Toscano wrote:> --- > cat/test-virt-log.sh | 27 ++++++++++++++++++++++++++- > 1 file changed, 26 insertions(+), 1 deletion(-) > > diff --git a/cat/test-virt-log.sh b/cat/test-virt-log.sh > index af6bb95..d4fa0ed 100755 > --- a/cat/test-virt-log.sh > +++ b/cat/test-virt-log.sh > @@ -19,7 +19,32 @@ > export LANG=C > set -e > > +can_handle () > +{ > + fn=$(basename $1) > + case "$fn" in > + fedora.img) > + guestfish -a /dev/null run : available journal > + ;; > + *) > + return 0 > + ;; > + esac > +} > + > # Read out the log files from the image using virt-log. > for f in ../tests/guests/{fedora,debian,ubuntu}.img; do > - if [ -s "$f" ]; then $VG virt-log -a "$f"; fi > + echo "Trying $f ..." > + if [ ! -s "$f" ]; then > + echo "SKIP: empty file" > + echo > + continue > + fi > + if ! can_handle "$f"; then > + echo "SKIP: cannot handle $f" > + echo > + continue > + fi > + $VG virt-log -a "$f" > + echoACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Seemingly Similar Threads
- Reg Disk space in guest domain with fedora img
- [PATCH] tests/mountable: skip if btrfs is not available
- [PATCH] tests/mountable: skip if btrfs is not available
- LVM Checksum error when using persistent grants (#linux-next + stable/for-jens-3.8)
- ext3 on an logical volume - snapshot using how?