Pino Toscano
2014-Jan-14 13:44 UTC
[Libguestfs] [PATCH] builder: test-virt-builder: check some results
Check at least some basic modifications in the image created with virt-builder. --- builder/test-virt-builder.sh | 47 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/builder/test-virt-builder.sh b/builder/test-virt-builder.sh index 47d20a4..3c8eb60 100755 --- a/builder/test-virt-builder.sh +++ b/builder/test-virt-builder.sh @@ -65,6 +65,51 @@ $VG ./virt-builder phony-fedora \ --firstboot Makefile --firstboot-command 'echo "hello"' \ --firstboot-install "minicom,inkscape" -# XXX Test that the modifications were made. +# Check that some modifications were made. +$VG ../fish/guestfish --ro -i -a $output > test.out <<EOF +# Uploaded files +is-file /etc/foo/bar/baz/Makefile +cat /etc/foo/bar/baz/foo +is-symlink /foo +is-symlink /foo1 +is-symlink /foo2 +is-symlink /foo3 + +echo ----- +# Hostname +cat /etc/sysconfig/network | grep HOSTNAME+ +echo ----- +# Timezone +is-file /usr/share/zoneinfo/Europe/London +is-symlink /etc/localtime +readlink /etc/localtime + +echo ----- +# Password +is-file /etc/shadow +cat /etc/shadow | sed -r '/^root:/!d;s,^(root:\\\$6\\\$).*,\\1,g' +EOF + +if [ "$(cat test.out)" != "true +Hello World +true +true +true +true +----- +HOSTNAME=test.example.com +----- +true +true +/usr/share/zoneinfo/Europe/London +----- +true +root:\$6\$" ]; then + echo "$0: unexpected output:" + cat test.out + exit 1 +fi rm $output +rm test.out -- 1.8.3.1
Richard W.M. Jones
2014-Jan-14 13:58 UTC
Re: [Libguestfs] [PATCH] builder: test-virt-builder: check some results
On Tue, Jan 14, 2014 at 02:44:03PM +0100, Pino Toscano wrote:> Check at least some basic modifications in the image created with > virt-builder. > --- > builder/test-virt-builder.sh | 47 +++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 46 insertions(+), 1 deletion(-) > > diff --git a/builder/test-virt-builder.sh b/builder/test-virt-builder.sh > index 47d20a4..3c8eb60 100755 > --- a/builder/test-virt-builder.sh > +++ b/builder/test-virt-builder.sh > @@ -65,6 +65,51 @@ $VG ./virt-builder phony-fedora \ > --firstboot Makefile --firstboot-command 'echo "hello"' \ > --firstboot-install "minicom,inkscape" > > -# XXX Test that the modifications were made. > +# Check that some modifications were made. > +$VG ../fish/guestfish --ro -i -a $output > test.out <<EOF > +# Uploaded files > +is-file /etc/foo/bar/baz/Makefile > +cat /etc/foo/bar/baz/foo > +is-symlink /foo > +is-symlink /foo1 > +is-symlink /foo2 > +is-symlink /foo3 > + > +echo ----- > +# Hostname > +cat /etc/sysconfig/network | grep HOSTNAME> + > +echo ----- > +# Timezone > +is-file /usr/share/zoneinfo/Europe/London > +is-symlink /etc/localtime > +readlink /etc/localtime > + > +echo ----- > +# Password > +is-file /etc/shadow > +cat /etc/shadow | sed -r '/^root:/!d;s,^(root:\\\$6\\\$).*,\\1,g' > +EOF > + > +if [ "$(cat test.out)" != "true > +Hello World > +true > +true > +true > +true > +----- > +HOSTNAME=test.example.com > +----- > +true > +true > +/usr/share/zoneinfo/Europe/London > +----- > +true > +root:\$6\$" ]; then > + echo "$0: unexpected output:" > + cat test.out > + exit 1 > +fi > > rm $output > +rm test.outACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
Maybe Matching Threads
- [PATCH] customize: Add --append-line.
- [PATCH 0/3] Timezone and keyboard layout settings in virt-builder and virt-sysprep.
- [PATCH node-image] update rwtab entries for /live, /boot, and /var/lib/random-seed
- Another issue with Sys.timezone
- Timeserver sending wrong time to Windows Clients