[anaconda][master][PATCH] Add a simple tmpfs kickstart test

Martin Kolman mkolman at redhat.com
Thu May 21 16:38:55 UTC 2015


A simple test for tmpfs support in kickstart (part --fstype=tmpfs).
Tests that the tmpfs mountpoint is created with correct size and
mounted during installation and also if it is correctly configured in fstab.

Signed-off-by: Martin Kolman <mkolman at redhat.com>
---
 tests/kickstart_tests/tmpfs-fixed_size.ks | 48 +++++++++++++++++++++++++++++++
 tests/kickstart_tests/tmpfs-fixed_size.sh | 48 +++++++++++++++++++++++++++++++
 2 files changed, 96 insertions(+)
 create mode 100644 tests/kickstart_tests/tmpfs-fixed_size.ks
 create mode 100755 tests/kickstart_tests/tmpfs-fixed_size.sh

diff --git a/tests/kickstart_tests/tmpfs-fixed_size.ks b/tests/kickstart_tests/tmpfs-fixed_size.ks
new file mode 100644
index 0000000..72cee9c
--- /dev/null
+++ b/tests/kickstart_tests/tmpfs-fixed_size.ks
@@ -0,0 +1,48 @@
+url --url=http://dl.fedoraproject.org/pub/fedora/linux/development/$releasever/$basearch/os/
+install
+network --bootproto=dhcp
+
+bootloader --timeout=1
+zerombr
+clearpart --all
+
+part --fstype=ext4 --size=4400 /
+part --fstype=swap --size=500 swap
+part --fstype=tmpfs --size 5000 /tmp
+
+keyboard us
+lang en
+timezone America/New_York
+rootpw qweqwe
+shutdown
+
+%packages
+ at core
+%end
+
+%post
+mount | grep -q "tmpfs on /tmp"
+if [[ $? != 0 ]]; then
+    echo '*** tmpfs not mounted in /tmp' >> /root/RESULT
+fi
+
+mount | grep "tmpfs on /tmp" | grep -q "size=5120000k"
+if [[ $? != 0 ]]; then
+    echo '*** tmpfs size is not 5000 MB' >> /root/RESULT
+fi
+
+cat /etc/fstab | grep -q "tmpfs"
+if [[ $? != 0 ]]; then
+    echo '*** tmpfs is not present in fstab' >> /root/RESULT
+fi
+
+cat /etc/fstab | grep "tmpfs" | grep -q "size=5000m"
+if [[ $? != 0 ]]; then
+    echo '*** tmpfs size is not 5000 MB in fstab' >> /root/RESULT
+fi
+
+# the installation was successfull if nothing bad happend till now
+if [[ ! -e /root/RESULT ]]; then
+        echo SUCCESS > /root/RESULT
+fi
+%end
diff --git a/tests/kickstart_tests/tmpfs-fixed_size.sh b/tests/kickstart_tests/tmpfs-fixed_size.sh
new file mode 100755
index 0000000..e3ed01a
--- /dev/null
+++ b/tests/kickstart_tests/tmpfs-fixed_size.sh
@@ -0,0 +1,48 @@
+#
+# 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>
+
+kernel_args() {
+    echo vnc
+}
+
+prepare() {
+    ks=$1
+    tmpdir=$2
+
+    echo ${ks}
+}
+
+validate() {
+    img=$1
+
+    # There should be a /root/RESULT file with results in it.  Check
+    # its contents and decide whether the test finally succeeded or
+    # not.
+    result=$(virt-cat -a ${img} -m /dev/sda2 /root/RESULT)
+    if [[ $? != 0 ]]; then
+        status=1
+        echo '*** /root/RESULT does not exist in VM image.'
+    elif [[ "${result}" != "SUCCESS" ]]; then
+        status=1
+        echo "${result}"
+    fi
+
+    return ${status}
+}
+
-- 
2.4.1



More information about the anaconda-patches mailing list