Signed-off-by: Nikos Skalkotos <skalkoto(a)gmail.com>
---
.gitignore | 1 +
inspector/Makefile.am | 1 +
inspector/expected-archlinux.img.xml | 35 +++++++++++++++++
tests/guests/Makefile.am | 7 ++++
tests/guests/guest-aux/archlinux-package | 15 +++++++
tests/guests/guest-aux/make-archlinux-img.sh | 58 ++++++++++++++++++++++++++++
tests/guests/guests.xml.in | 16 ++++++++
7 files changed, 133 insertions(+)
create mode 100644 inspector/expected-archlinux.img.xml
create mode 100644 tests/guests/guest-aux/archlinux-package
create mode 100755 tests/guests/guest-aux/make-archlinux-img.sh
diff --git a/.gitignore b/.gitignore
index fa1cee4..b4a8ed1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -527,6 +527,7 @@ Makefile.in
/tests/guests/guest-aux/windows-system
/tests/guests/stamp-fedora-md.img
/tests/guests/ubuntu.img
+/tests/guests/archlinux.img
/tests/guests/windows.img
/tests/mount-local/test-parallel-mount-local
/tests/mountable/test-internal-parse-mountable
diff --git a/inspector/Makefile.am b/inspector/Makefile.am
index e1f5acd..d3538ad 100644
--- a/inspector/Makefile.am
+++ b/inspector/Makefile.am
@@ -37,6 +37,7 @@ EXTRA_DIST = \
expected-debian.img.xml \
expected-fedora.img.xml \
expected-ubuntu.img.xml \
+ expected-archlinux.img.xml \
expected-windows.img.xml \
test-virt-inspector.sh \
test-xmllint.sh.in \
diff --git a/inspector/expected-archlinux.img.xml b/inspector/expected-archlinux.img.xml
new file mode 100644
index 0000000..665ac30
--- /dev/null
+++ b/inspector/expected-archlinux.img.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<operatingsystems>
+ <operatingsystem>
+ <root>/dev/sda1</root>
+ <name>linux</name>
+ <arch>x86_64</arch>
+ <distro>archlinux</distro>
+ <major_version>0</major_version>
+ <minor_version>0</minor_version>
+ <package_format>pacman</package_format>
+ <package_management>pacman</package_management>
+ <hostname>archlinux.test</hostname>
+ <format>installed</format>
+ <mountpoints>
+ <mountpoint dev="/dev/sda1">/</mountpoint>
+ </mountpoints>
+ <filesystems>
+ <filesystem dev="/dev/sda1">
+ <type>ext4</type>
+ <uuid>01234567-0123-0123-0123-012345678902</uuid>
+ </filesystem>
+ </filesystems>
+ <applications>
+ <application>
+ <name>test-package</name>
+ <epoch>1</epoch>
+ <version>0.1</version>
+ <release>1</release>
+ <arch>x86_64</arch>
+ <
url>http://libguestfs.org/</url>
+ <description>Test package for libguestfs</description>
+ </application>
+ </applications>
+ </operatingsystem>
+</operatingsystems>
diff --git a/tests/guests/Makefile.am b/tests/guests/Makefile.am
index e58d563..2bb721d 100644
--- a/tests/guests/Makefile.am
+++ b/tests/guests/Makefile.am
@@ -28,6 +28,8 @@ EXTRA_DIST = \
guest-aux/fedora-packages.db.txt \
guest-aux/fedora-packages.db \
guest-aux/make-ubuntu-img.sh \
+ guest-aux/make-archlinux-img.sh \
+ guest-aux/archlinux-package \
guest-aux/make-windows-img.sh \
guest-aux/windows-software \
guest-aux/windows-software.reg \
@@ -49,6 +51,7 @@ disk_images = \
fedora-md2.img \
fedora-btrfs.img \
ubuntu.img \
+ archlinux.img \
windows.img
# This is 'check_DATA' because we don't need it until 'make check'
@@ -102,6 +105,10 @@ debian.img: guest-aux/make-debian-img.sh
ubuntu.img: guest-aux/make-ubuntu-img.sh
SRCDIR=$(srcdir) $(top_builddir)/run --test $<
+# Make a (dummy) Arch Linux image.
+archlinux.img: guest-aux/make-archlinux-img.sh
+ SRCDIR=$(srcdir) $(top_builddir)/run --test $<
+
# Make a (dummy) Windows image.
windows.img: guest-aux/make-windows-img.sh \
guest-aux/windows-software guest-aux/windows-system
diff --git a/tests/guests/guest-aux/archlinux-package
b/tests/guests/guest-aux/archlinux-package
new file mode 100644
index 0000000..96459a2
--- /dev/null
+++ b/tests/guests/guest-aux/archlinux-package
@@ -0,0 +1,15 @@
+%NAME%
+test-package
+
+%VERSION%
+1:0.1-1
+
+%DESC%
+Test package for libguestfs
+
+%URL%
+http://libguestfs.org/
+
+%ARCH%
+x86_64
+
diff --git a/tests/guests/guest-aux/make-archlinux-img.sh
b/tests/guests/guest-aux/make-archlinux-img.sh
new file mode 100755
index 0000000..62babd1
--- /dev/null
+++ b/tests/guests/guest-aux/make-archlinux-img.sh
@@ -0,0 +1,58 @@
+#!/bin/bash -
+# libguestfs
+# Copyright (C) 2014 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+# Make an Arch Linux image which is enough to fool the inspection heuristics.
+
+export LANG=C
+set -e
+
+# Create a disk image.
+guestfish <<EOF
+sparse archlinux.img.tmp.$$ 512M
+run
+
+# Format the disk.
+part-init /dev/sda mbr
+part-add /dev/sda p 64 -64
+
+# Phony / filesystem.
+mkfs ext4 /dev/sda1 blocksize:4096
+set-e2uuid /dev/sda1 01234567-0123-0123-0123-012345678902
+
+# Enough to fool inspection API.
+mount /dev/sda1 /
+mkdir /boot
+mkdir /bin
+mkdir /etc
+mkdir /home
+mkdir /usr
+mkdir-p /var/lib/pacman/local/test-package-1:0.1-1
+
+write /etc/fstab "/dev/sda1 / ext4 rw,relatime,data=ordered 0 1"
+touch /etc/arch-release
+write /etc/hostname "archlinux.test"
+
+upload $SRCDIR/guest-aux/archlinux-package
/var/lib/pacman/local/test-package-1:0.1-1/desc
+
+upload $SRCDIR/../data/bin-x86_64-dynamic /bin/ls
+
+mkdir /boot/grub
+touch /boot/grub/grub.conf
+EOF
+
+mv archlinux.img.tmp.$$ archlinux.img
diff --git a/tests/guests/guests.xml.in b/tests/guests/guests.xml.in
index bac5d8e..451d3fa 100644
--- a/tests/guests/guests.xml.in
+++ b/tests/guests/guests.xml.in
@@ -232,6 +232,22 @@
</domain>
<domain type='test'>
+ <name>archlinux</name>
+ <memory>1048576</memory>
+ <os>
+ <type>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <devices>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source file='@abs_builddir(a)/archlinux.img'/>
+ <target dev='vda' bus='virtio'/>
+ </disk>
+ </devices>
+ </domain>
+
+ <domain type='test'>
<name>windows</name>
<memory>1048576</memory>
<os>
--
2.1.3