diff --git a/Makefile-tests.am b/Makefile-tests.am index 87ae8d05..3c155ecb 100644 --- a/Makefile-tests.am +++ b/Makefile-tests.am @@ -32,7 +32,7 @@ testfiles = test-basic \ test-pull-corruption \ test-pull-resume \ test-gpg-signed-commit \ - test-admin-deploy-1 \ + test-admin-deploy-syslinux \ test-admin-deploy-2 \ test-admin-deploy-karg \ test-admin-deploy-etcmerge-cornercases \ @@ -48,6 +48,7 @@ testmeta_DATA = $(testfiles:=.test) insttest_DATA = tests/archive-test.sh \ tests/pull-test.sh \ tests/libtest.sh \ + tests/admin-test.sh \ $(NULL) gpginsttestdir = $(pkglibexecdir)/installed-tests/gpghome diff --git a/tests/test-admin-deploy-1.sh b/tests/admin-test.sh similarity index 97% rename from tests/test-admin-deploy-1.sh rename to tests/admin-test.sh index c1151d16..8520b880 100755 --- a/tests/test-admin-deploy-1.sh +++ b/tests/admin-test.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (C) 2011 Colin Walters +# Copyright (C) 2011,2014 Colin Walters # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -19,14 +19,6 @@ set -e -. $(dirname $0)/libtest.sh - -echo "1..1" - -setup_os_repository "archive-z2" "syslinux" - -echo "ok setup" - echo "1..9" ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime diff --git a/tests/test-admin-deploy-syslinux.sh b/tests/test-admin-deploy-syslinux.sh new file mode 100755 index 00000000..76161bc0 --- /dev/null +++ b/tests/test-admin-deploy-syslinux.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# +# Copyright (C) 2011,2014 Colin Walters +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the +# Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +set -e + +. $(dirname $0)/libtest.sh + +echo "1..1" + +setup_os_repository "archive-z2" "syslinux" + +echo "ok setup" + +. $(dirname $0)/admin-test.sh diff --git a/tests/test-admin-deploy-uboot.sh b/tests/test-admin-deploy-uboot.sh index e2490108..11dee585 100755 --- a/tests/test-admin-deploy-uboot.sh +++ b/tests/test-admin-deploy-uboot.sh @@ -1,9 +1,8 @@ #!/bin/bash # +# Copyright (C) 2011,2014 Colin Walters # Copyright (C) 2013 Javier Martinez # -# Based on tests/test-admin-deploy-1.sh by Colin Walters. -# # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either @@ -29,105 +28,4 @@ setup_os_repository "archive-z2" "uboot" echo "ok setup" -echo "1..2" - -ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime -rev=$(ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime) -export rev -# This initial deployment gets kicked off with some kernel arguments -ostree admin --sysroot=sysroot deploy --karg=root=LABEL=MOO --karg=console=ttySO,115200n8 --os=testos testos:testos/buildmaster/x86_64-runtime -assert_has_dir sysroot/boot/ostree/testos-${bootcsum} - -echo "ok deploy command" - -assert_not_has_dir sysroot/boot/loader.0 -# Ensure uEnv.txt exists and has proper values -assert_has_file sysroot/boot/loader.1/uEnv.txt -linux=$(grep linux sysroot/boot/loader/entries/ostree-testos-0.conf | cut -d ' ' -f 2) -initrd=$(grep initrd sysroot/boot/loader/entries/ostree-testos-0.conf | cut -d ' ' -f 2) -options=$(grep options sysroot/boot/loader/entries/ostree-testos-0.conf | cut -d ' ' -f 2-4) -assert_file_has_content sysroot/boot/loader.1/uEnv.txt "kernel_image=$linux" -assert_file_has_content sysroot/boot/loader.1/uEnv.txt "ramdisk_image=$initrd" -assert_file_has_content sysroot/boot/loader.1/uEnv.txt "bootargs=$options" - -echo "ok U-Boot" - -ostree admin --sysroot=sysroot deploy --os=testos testos:testos/buildmaster/x86_64-runtime -# Need a new bootversion, sine we now have two deployments -assert_has_dir sysroot/boot/loader.0 -assert_not_has_dir sysroot/boot/loader.1 -assert_has_dir sysroot/ostree/boot.0.1 -assert_not_has_dir sysroot/ostree/boot.0.0 -assert_not_has_dir sysroot/ostree/boot.1.0 -assert_not_has_dir sysroot/ostree/boot.1.1 -# Ensure we propagated kernel arguments from previous deployment -assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf 'options.* root=LABEL=MOO console=ttySO,115200n8' -assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.1/etc/os-release 'NAME=TestOS' -assert_file_has_content sysroot/ostree/boot.0/testos/${bootcsum}/0/etc/os-release 'NAME=TestOS' -# Ensure uEnv.txt has proper values -assert_has_file sysroot/boot/loader.0/uEnv.txt -linux=$(grep linux sysroot/boot/loader.0/entries/ostree-testos-0.conf | cut -d ' ' -f 2) -initrd=$(grep initrd sysroot/boot/loader.0/entries/ostree-testos-0.conf | cut -d ' ' -f 2) -options=$(grep options sysroot/boot/loader/entries/ostree-testos-0.conf | cut -d ' ' -f 2-4) -assert_file_has_content sysroot/boot/loader.0/uEnv.txt "kernel_image=$linux" -assert_file_has_content sysroot/boot/loader.0/uEnv.txt "ramdisk_image=$initrd" -assert_file_has_content sysroot/boot/loader.0/uEnv.txt "bootargs=$options" - -ostree admin --sysroot=sysroot status - -echo "ok second deploy" - -ostree admin --sysroot=sysroot deploy --os=testos testos:testos/buildmaster/x86_64-runtime -# Keep the same bootversion -assert_has_dir sysroot/boot/loader.0 -assert_not_has_dir sysroot/boot/loader.1 -# But swap subbootversion -assert_has_dir sysroot/ostree/boot.0.0 -assert_not_has_dir sysroot/ostree/boot.0.1 -# Ensure uEnv.txt has proper values -assert_has_file sysroot/boot/loader.0/uEnv.txt -linux=$(grep linux sysroot/boot/loader.0/entries/ostree-testos-0.conf | cut -d ' ' -f 2) -initrd=$(grep initrd sysroot/boot/loader.0/entries/ostree-testos-0.conf | cut -d ' ' -f 2) -options=$(grep options sysroot/boot/loader/entries/ostree-testos-0.conf | cut -d ' ' -f 2-4) -assert_file_has_content sysroot/boot/loader.0/uEnv.txt "kernel_image=$linux" -assert_file_has_content sysroot/boot/loader.0/uEnv.txt "ramdisk_image=$initrd" -assert_file_has_content sysroot/boot/loader.0/uEnv.txt "bootargs=$options" - -echo "ok third deploy (swap)" - -ostree admin --sysroot=sysroot deploy --os=otheros testos/buildmaster/x86_64-runtime -assert_not_has_dir sysroot/boot/loader.0 -assert_has_dir sysroot/boot/loader.1 -assert_has_file sysroot/boot/loader/entries/ostree-testos-1.conf -assert_has_file sysroot/boot/loader/entries/ostree-otheros-0.conf -assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.1/etc/os-release 'NAME=TestOS' -assert_file_has_content sysroot/ostree/deploy/otheros/deploy/${rev}.0/etc/os-release 'NAME=TestOS' -# Ensure uEnv.txt has proper values -assert_has_file sysroot/boot/loader.1/uEnv.txt -linux=$(grep linux sysroot/boot/loader.1/entries/ostree-otheros-0.conf | cut -d ' ' -f 2) -initrd=$(grep initrd sysroot/boot/loader.1/entries/ostree-otheros-0.conf | cut -d ' ' -f 2) -options=$(grep options sysroot/boot/loader/entries/ostree-otheros-0.conf | cut -d ' ' -f 2-4) -assert_file_has_content sysroot/boot/loader.1/uEnv.txt "kernel_image=$linux" -assert_file_has_content sysroot/boot/loader.1/uEnv.txt "ramdisk_image=$initrd" -assert_file_has_content sysroot/boot/loader.1/uEnv.txt "bootargs=$options" - -echo "ok independent deploy" - -ostree admin --sysroot=sysroot deploy --retain --os=testos testos:testos/buildmaster/x86_64-runtime -assert_has_dir sysroot/boot/loader.0 -assert_not_has_dir sysroot/boot/loader.1 -assert_has_file sysroot/boot/loader/entries/ostree-testos-0.conf -assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.2/etc/os-release 'NAME=TestOS' -assert_has_file sysroot/boot/loader/entries/ostree-testos-2.conf -assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/os-release 'NAME=TestOS' -# Ensure uEnv.txt has proper values -assert_has_file sysroot/boot/loader.0/uEnv.txt -linux=$(grep linux sysroot/boot/loader.0/entries/ostree-testos-0.conf | cut -d ' ' -f 2) -initrd=$(grep initrd sysroot/boot/loader.0/entries/ostree-testos-0.conf | cut -d ' ' -f 2) -options=$(grep options sysroot/boot/loader/entries/ostree-testos-0.conf | cut -d ' ' -f 2-4) -assert_file_has_content sysroot/boot/loader.0/uEnv.txt "kernel_image=$linux" -assert_file_has_content sysroot/boot/loader.0/uEnv.txt "ramdisk_image=$initrd" -assert_file_has_content sysroot/boot/loader.0/uEnv.txt "bootargs=$options" - -echo "ok fourth deploy (retain)" - +. $(dirname $0)/admin-test.sh