[PATCH] Add a basic test for ostree-based installs.
Chris Lumens
clumens at redhat.com
Mon Jul 7 18:53:25 UTC 2014
This would also allow for testing further ostree-related things in the future,
should anything come up.
---
tests/Makefile.am | 4 +-
tests/ostree/basic.ks | 13 +++++++
tests/ostree/run_ostree_tests.sh | 80 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 96 insertions(+), 1 deletion(-)
create mode 100644 tests/ostree/basic.ks
create mode 100755 tests/ostree/run_ostree_tests.sh
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 877bdb9..2803481 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -49,6 +49,7 @@ dist_check_SCRIPTS = $(srcdir)/glade/*/*.py \
gettext/gettext_warnings.sh \
gettext/gettext_potfiles.py \
storage/run_storage_tests.py \
+ ostree/run_ostree_tests.sh \
$(srcdir)/gui/*.ks \
$(srcdir)/gui/*.sh \
$(srcdir)/gui/inside/*.py \
@@ -63,7 +64,8 @@ TESTS = nosetests.sh \
gettext/gettext_potfiles.py \
storage/run_storage_tests.py \
gui/run_gui_tests.sh \
- glade/run_glade_tests.sh
+ glade/run_glade_tests.sh \
+ ostree/run_ostree_tests.sh
clean-local:
-rm -rf pylint/.pylint.d
diff --git a/tests/ostree/basic.ks b/tests/ostree/basic.ks
new file mode 100644
index 0000000..6523904
--- /dev/null
+++ b/tests/ostree/basic.ks
@@ -0,0 +1,13 @@
+ostreesetup --nogpg --osname=fedora-atomic --remote=fedora-atomic --url=REPO --ref=fedora-atomic/rawhide/x86_64/base/core
+
+bootloader --timeout=1 --extlinux
+zerombr
+clearpart --all
+part --fstype=ext4 --size=4400 /
+part --fstype=ext4 --size=500 /boot
+part --fstype=swap --size=500 swap
+
+keyboard us
+timezone America/New_York
+rootpw qweqwe
+shutdown
diff --git a/tests/ostree/run_ostree_tests.sh b/tests/ostree/run_ostree_tests.sh
new file mode 100755
index 0000000..6831a59
--- /dev/null
+++ b/tests/ostree/run_ostree_tests.sh
@@ -0,0 +1,80 @@
+#!/bin/bash
+#
+# Copyright (C) 2014 Red Hat, Inc.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# the GNU General Public License v.2, or (at your option) any later version.
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY expressed or implied, including the implied warranties 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. Any Red Hat trademarks that are incorporated in the
+# source code or documentation are not subject to the GNU General Public
+# License and may only be used or replicated with the express permission of
+# Red Hat, Inc.
+#
+# Red Hat Author(s): Chris Lumens <clumens at redhat.com>
+
+# Have to be root to run this test, as it requires creating disk iamges.
+if [ ${EUID} != 0 ]; then
+ exit 77
+fi
+
+# The boot.iso location can come from one of two different places:
+# (1) $TEST_IMAGE, if this script is being called from "make check"
+# (2) The command line, if this script is being called directly.
+if [[ "${TEST_IMAGE}" != "" ]]; then
+ IMAGE=${TEST_IMAGE}
+elif [[ $# != 0 ]]; then
+ IMAGE=$1
+ shift
+fi
+
+# The same with the ostree repo.
+if [[ "${TEST_OSTREE_REPO}" != "" ]]; then
+ REPO=${TEST_OSTREE_REPO}
+elif [[ $# != 0 ]]; then
+ REPO=$1
+ shift
+else
+ echo "usage: $0 <boot.iso> <ostree repo>"
+ exit 1
+fi
+
+if [ ! -e "${IMAGE}" ]; then
+ echo "Required boot.iso does not exist."
+ exit 2
+fi
+
+status=0
+for ks in ostree/*ks; do
+ # Substitute in the location of an ostree repo here. This could be one
+ # publically accessible, or a very local and private one that happens
+ # to be fast.
+ ksfile=$(mktemp)
+ sed -e "/ostreesetup/ s|REPO|${REPO}|" ${ks} > ${ksfile}
+
+ echo ${ks}
+ echo ====================
+
+ livemedia-creator --make-disk \
+ --iso "${IMAGE}" \
+ --ks ${ksfile} \
+ --tmp /var/tmp \
+ --title Fedora \
+ --project Fedora \
+ --releasever 21 \
+ --ram 2048 \
+ --vcpus 2 \
+ --vnc vnc
+ if [ "$?" -ne 0 ]; then
+ status=1
+ fi
+
+ rm ${ksfile}
+done
+
+exit $status
--
1.9.3
More information about the anaconda-patches
mailing list