inspector: Add a real test of inspection.

Verify that the output from inspection doesn't change, in order to
catch regressions such as RHBZ#975412.
This commit is contained in:
Richard W.M. Jones
2013-06-18 17:11:21 +01:00
parent d7bc1dd922
commit a86cb71fca
6 changed files with 216 additions and 2 deletions

1
.gitignore vendored
View File

@@ -222,6 +222,7 @@ Makefile.in
/html/virt-tar-in.1.html
/html/virt-tar-out.1.html
/html/virt-win-reg.1.html
/inspector/actual-*.xml
/inspector/stamp-virt-inspector.pod
/inspector/test-xmllint.sh
/inspector/virt-inspector

View File

@@ -0,0 +1,66 @@
<?xml version="1.0"?>
<operatingsystems>
<operatingsystem>
<root>/dev/debian/root</root>
<name>linux</name>
<arch>x86_64</arch>
<distro>debian</distro>
<product_name>5.0.1</product_name>
<major_version>5</major_version>
<minor_version>0</minor_version>
<package_format>deb</package_format>
<package_management>apt</package_management>
<hostname>debian.invalid</hostname>
<format>installed</format>
<mountpoints>
<mountpoint dev="/dev/debian/root">/</mountpoint>
<mountpoint dev="/dev/debian/usr">/usr</mountpoint>
<mountpoint dev="/dev/debian/var">/var</mountpoint>
<mountpoint dev="/dev/sda1">/boot</mountpoint>
<mountpoint dev="/dev/debian/home">/home</mountpoint>
</mountpoints>
<filesystems>
<filesystem dev="/dev/debian/home">
<type>ext2</type>
<uuid>01234567-0123-0123-0123-012345678905</uuid>
</filesystem>
<filesystem dev="/dev/debian/root">
<type>ext2</type>
<uuid>01234567-0123-0123-0123-012345678902</uuid>
</filesystem>
<filesystem dev="/dev/debian/usr">
<type>ext2</type>
<uuid>01234567-0123-0123-0123-012345678903</uuid>
</filesystem>
<filesystem dev="/dev/debian/var">
<type>ext2</type>
<uuid>01234567-0123-0123-0123-012345678904</uuid>
</filesystem>
<filesystem dev="/dev/sda1">
<type>ext2</type>
<label>BOOT</label>
<uuid>01234567-0123-0123-0123-012345678901</uuid>
</filesystem>
</filesystems>
<applications>
<application>
<name>test1</name>
<version>1.2.3</version>
<release>1</release>
<arch>amd64</arch>
</application>
<application>
<name>test2</name>
<version>1.2.3</version>
<release>1</release>
<arch>amd64</arch>
</application>
<application>
<name>test3</name>
<version>1.2.3</version>
<release>1</release>
<arch>amd64</arch>
</application>
</applications>
</operatingsystem>
</operatingsystems>

View File

@@ -0,0 +1,33 @@
<?xml version="1.0"?>
<operatingsystems>
<operatingsystem>
<root>/dev/VG/Root</root>
<name>linux</name>
<arch>x86_64</arch>
<distro>fedora</distro>
<product_name>Fedora release 14 (Phony)</product_name>
<major_version>14</major_version>
<minor_version>0</minor_version>
<package_format>rpm</package_format>
<package_management>yum</package_management>
<hostname>fedora.invalid</hostname>
<format>installed</format>
<mountpoints>
<mountpoint dev="/dev/VG/Root">/</mountpoint>
<mountpoint dev="/dev/sda1">/boot</mountpoint>
</mountpoints>
<filesystems>
<filesystem dev="/dev/VG/Root">
<type>ext2</type>
<label>ROOT</label>
<uuid>01234567-0123-0123-0123-012345678902</uuid>
</filesystem>
<filesystem dev="/dev/sda1">
<type>ext2</type>
<label>BOOT</label>
<uuid>01234567-0123-0123-0123-012345678901</uuid>
</filesystem>
</filesystems>
<applications/>
</operatingsystem>
</operatingsystems>

View File

@@ -0,0 +1,52 @@
<?xml version="1.0"?>
<operatingsystems>
<operatingsystem>
<root>/dev/sda2</root>
<name>linux</name>
<arch>x86_64</arch>
<distro>ubuntu</distro>
<product_name>Ubuntu 10.10 (Phony Pharaoh)</product_name>
<major_version>10</major_version>
<minor_version>10</minor_version>
<package_format>deb</package_format>
<package_management>apt</package_management>
<hostname>ubuntu.invalid</hostname>
<format>installed</format>
<mountpoints>
<mountpoint dev="/dev/sda2">/</mountpoint>
<mountpoint dev="/dev/sda1">/boot</mountpoint>
</mountpoints>
<filesystems>
<filesystem dev="/dev/mapper/cryptswap1"/>
<filesystem dev="/dev/sda1">
<type>ext2</type>
<label>BOOT</label>
<uuid>01234567-0123-0123-0123-012345678901</uuid>
</filesystem>
<filesystem dev="/dev/sda2">
<type>ext2</type>
<uuid>01234567-0123-0123-0123-012345678902</uuid>
</filesystem>
</filesystems>
<applications>
<application>
<name>test1</name>
<version>1.2.3</version>
<release>1</release>
<arch>amd64</arch>
</application>
<application>
<name>test2</name>
<version>1.2.3</version>
<release>1</release>
<arch>amd64</arch>
</application>
<application>
<name>test3</name>
<version>1.2.3</version>
<release>1</release>
<arch>amd64</arch>
</application>
</applications>
</operatingsystem>
</operatingsystems>

View File

@@ -0,0 +1,58 @@
<?xml version="1.0"?>
<operatingsystems>
<operatingsystem>
<root>/dev/sda2</root>
<name>windows</name>
<arch>i386</arch>
<distro>windows</distro>
<product_name>Microsoft Windows 7 Phony Edition</product_name>
<product_variant>Client</product_variant>
<major_version>6</major_version>
<minor_version>1</minor_version>
<windows_systemroot>/Windows</windows_systemroot>
<windows_current_control_set>ControlSet001</windows_current_control_set>
<hostname>windows.invalid</hostname>
<format>installed</format>
<mountpoints>
<mountpoint dev="/dev/sda2">/</mountpoint>
</mountpoints>
<filesystems>
<filesystem dev="/dev/sda2">
<type>ntfs</type>
<uuid>091A29CC586B609C</uuid>
</filesystem>
</filesystems>
<drive_mappings>
<drive_mapping name="C">/dev/sda2</drive_mapping>
</drive_mappings>
<applications>
<application>
<name>test1</name>
<display_name>Test1 is not real software</display_name>
<version>1.2.3</version>
<url>http://libguestfs.org/</url>
</application>
<application>
<name>test2</name>
<display_name>Test2 is not real software</display_name>
<version>1.2.4</version>
<url>http://libguestfs.org/</url>
<description>Longer description about phony test2 software</description>
</application>
<application>
<name>test3</name>
<display_name>Test3 is not real software</display_name>
<version>1.2.5</version>
<install_path>C:\Program Files\Red Hat\test3</install_path>
<publisher>Red Hat Inc.</publisher>
</application>
<application>
<name>test4</name>
<display_name>Test4 is not real software</display_name>
<version>1.2.6</version>
<publisher>Red Hat Inc.</publisher>
<description>WOW6432node is where 32 bit emulated apps are installed on 64 bit Windows</description>
</application>
</applications>
</operatingsystem>
</operatingsystems>

View File

@@ -1,6 +1,6 @@
#!/bin/bash -
# libguestfs virt-inspector test script
# Copyright (C) 2012 Red Hat Inc.
# Copyright (C) 2012-2013 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
@@ -22,7 +22,11 @@ set -e
for f in ../tests/guests/{debian,fedora,ubuntu,windows}.img; do
# Ignore zero-sized windows.img if ntfs-3g is not installed.
if [ -s "$f" ]; then
$VG ./virt-inspector -a $f
b=$(basename "$f" .xml)
$VG ./virt-inspector -a "$f" > "actual-$b.xml"
# This 'diff' command will fail (because of -e option) if there
# are any differences.
diff -ur "expected-$b.xml" "actual-$b.xml"
fi
done