Add tests for Arch Linux

Signed-off-by: Nikos Skalkotos <skalkoto@gmail.com>
This commit is contained in:
Nikos Skalkotos
2014-11-21 21:47:12 +00:00
committed by Richard W.M. Jones
parent 7ce73d8980
commit f3dbf340b8
7 changed files with 133 additions and 0 deletions

1
.gitignore vendored
View File

@@ -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

View File

@@ -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 \

View File

@@ -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>

View File

@@ -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

View File

@@ -0,0 +1,15 @@
%NAME%
test-package
%VERSION%
1:0.1-1
%DESC%
Test package for libguestfs
%URL%
http://libguestfs.org/
%ARCH%
x86_64

View File

@@ -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

View File

@@ -231,6 +231,22 @@
</devices>
</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@/archlinux.img'/>
<target dev='vda' bus='virtio'/>
</disk>
</devices>
</domain>
<domain type='test'>
<name>windows</name>
<memory>1048576</memory>