[ostree] Unify uboot and syslinux test cases



commit 5bf6099a8b9749fb3c5e1ee239702f57f044ec4a
Author: Colin Walters <walters verbum org>
Date:   Wed Jan 15 09:48:04 2014 -0500

    Unify uboot and syslinux test cases
    
    The test-admin-deploy-1 was copied into -uboot at some point.  But
    really they should be testing exactly the same thing, except for
    the bootloader backend.
    
    Unify these tests by extracting a common test core.

 Makefile-tests.am                               |    3 +-
 tests/{test-admin-deploy-1.sh => admin-test.sh} |   10 +--
 tests/test-admin-deploy-syslinux.sh             |   30 +++++++
 tests/test-admin-deploy-uboot.sh                |  106 +----------------------
 4 files changed, 35 insertions(+), 114 deletions(-)
---
diff --git a/Makefile-tests.am b/Makefile-tests.am
index 87ae8d0..3c155ec 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 c1151d1..8520b88 100755
--- a/tests/test-admin-deploy-1.sh
+++ b/tests/admin-test.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 #
-# Copyright (C) 2011 Colin Walters <walters verbum org>
+# Copyright (C) 2011,2014 Colin Walters <walters verbum org>
 #
 # 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 0000000..76161bc
--- /dev/null
+++ b/tests/test-admin-deploy-syslinux.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+#
+# Copyright (C) 2011,2014 Colin Walters <walters verbum org>
+#
+# 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 e249010..11dee58 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 <walters verbum org>
 # Copyright (C) 2013 Javier Martinez <javier martinez collabora co uk>
 #
-# 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]