diff --git a/.gitignore b/.gitignore
index bf9d28008..f122d19dc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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
diff --git a/inspector/expected-debian.img.xml b/inspector/expected-debian.img.xml
new file mode 100644
index 000000000..908ef39ac
--- /dev/null
+++ b/inspector/expected-debian.img.xml
@@ -0,0 +1,66 @@
+
+
+
+ /dev/debian/root
+ linux
+ x86_64
+ debian
+ 5.0.1
+ 5
+ 0
+ deb
+ apt
+ debian.invalid
+ installed
+
+ /
+ /usr
+ /var
+ /boot
+ /home
+
+
+
+ ext2
+ 01234567-0123-0123-0123-012345678905
+
+
+ ext2
+ 01234567-0123-0123-0123-012345678902
+
+
+ ext2
+ 01234567-0123-0123-0123-012345678903
+
+
+ ext2
+ 01234567-0123-0123-0123-012345678904
+
+
+ ext2
+
+ 01234567-0123-0123-0123-012345678901
+
+
+
+
+ test1
+ 1.2.3
+ 1
+ amd64
+
+
+ test2
+ 1.2.3
+ 1
+ amd64
+
+
+ test3
+ 1.2.3
+ 1
+ amd64
+
+
+
+
diff --git a/inspector/expected-fedora.img.xml b/inspector/expected-fedora.img.xml
new file mode 100644
index 000000000..1cea7b5b9
--- /dev/null
+++ b/inspector/expected-fedora.img.xml
@@ -0,0 +1,33 @@
+
+
+
+ /dev/VG/Root
+ linux
+ x86_64
+ fedora
+ Fedora release 14 (Phony)
+ 14
+ 0
+ rpm
+ yum
+ fedora.invalid
+ installed
+
+ /
+ /boot
+
+
+
+ ext2
+
+ 01234567-0123-0123-0123-012345678902
+
+
+ ext2
+
+ 01234567-0123-0123-0123-012345678901
+
+
+
+
+
diff --git a/inspector/expected-ubuntu.img.xml b/inspector/expected-ubuntu.img.xml
new file mode 100644
index 000000000..cbb0e98d3
--- /dev/null
+++ b/inspector/expected-ubuntu.img.xml
@@ -0,0 +1,52 @@
+
+
+
+ /dev/sda2
+ linux
+ x86_64
+ ubuntu
+ Ubuntu 10.10 (Phony Pharaoh)
+ 10
+ 10
+ deb
+ apt
+ ubuntu.invalid
+ installed
+
+ /
+ /boot
+
+
+
+
+ ext2
+
+ 01234567-0123-0123-0123-012345678901
+
+
+ ext2
+ 01234567-0123-0123-0123-012345678902
+
+
+
+
+ test1
+ 1.2.3
+ 1
+ amd64
+
+
+ test2
+ 1.2.3
+ 1
+ amd64
+
+
+ test3
+ 1.2.3
+ 1
+ amd64
+
+
+
+
diff --git a/inspector/expected-windows.img.xml b/inspector/expected-windows.img.xml
new file mode 100644
index 000000000..ff787f188
--- /dev/null
+++ b/inspector/expected-windows.img.xml
@@ -0,0 +1,58 @@
+
+
+
+ /dev/sda2
+ windows
+ i386
+ windows
+ Microsoft Windows 7 Phony Edition
+ Client
+ 6
+ 1
+ /Windows
+ ControlSet001
+ windows.invalid
+ installed
+
+ /
+
+
+
+ ntfs
+ 091A29CC586B609C
+
+
+
+ /dev/sda2
+
+
+
+ test1
+ Test1 is not real software
+ 1.2.3
+ http://libguestfs.org/
+
+
+ test2
+ Test2 is not real software
+ 1.2.4
+ http://libguestfs.org/
+ Longer description about phony test2 software
+
+
+ test3
+ Test3 is not real software
+ 1.2.5
+ C:\Program Files\Red Hat\test3
+ Red Hat Inc.
+
+
+ test4
+ Test4 is not real software
+ 1.2.6
+ Red Hat Inc.
+ WOW6432node is where 32 bit emulated apps are installed on 64 bit Windows
+
+
+
+
diff --git a/inspector/test-virt-inspector.sh b/inspector/test-virt-inspector.sh
index 7ad075089..c8dd37242 100755
--- a/inspector/test-virt-inspector.sh
+++ b/inspector/test-virt-inspector.sh
@@ -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