From 296d28a01361ea6ab36a451b55dcf65b57d64b6c Mon Sep 17 00:00:00 2001 From: pdancak Date: Thu, 20 Jun 2024 15:20:55 +0200 Subject: [PATCH] basic test for setup --- Sanity/Basic-sanity-test/PURPOSE | 3 + Sanity/Basic-sanity-test/main.fmf | 13 +++++ Sanity/Basic-sanity-test/runtest.sh | 85 +++++++++++++++++++++++++++++ 3 files changed, 101 insertions(+) create mode 100644 Sanity/Basic-sanity-test/PURPOSE create mode 100644 Sanity/Basic-sanity-test/main.fmf create mode 100755 Sanity/Basic-sanity-test/runtest.sh diff --git a/Sanity/Basic-sanity-test/PURPOSE b/Sanity/Basic-sanity-test/PURPOSE new file mode 100644 index 0000000..d69c155 --- /dev/null +++ b/Sanity/Basic-sanity-test/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /CoreOS/setup/Sanity/Basic-sanity-test +Description: Tests core functionality of the setup package +Author: Martin Cermak diff --git a/Sanity/Basic-sanity-test/main.fmf b/Sanity/Basic-sanity-test/main.fmf new file mode 100644 index 0000000..e0f5b78 --- /dev/null +++ b/Sanity/Basic-sanity-test/main.fmf @@ -0,0 +1,13 @@ +summary: Tests contents of the setup package +contact: Petr Dancak +component: + - setup +test: ./runtest.sh +path: /Sanity/Basic-sanity-test +framework: beakerlib +recommend: + - setup +duration: 15m +enabled: true +extra-summary: /CoreOS/setup/Sanity/Basic-sanity-test +extra-task: /CoreOS/setup/Sanity/Basic-sanity-test diff --git a/Sanity/Basic-sanity-test/runtest.sh b/Sanity/Basic-sanity-test/runtest.sh new file mode 100755 index 0000000..413550d --- /dev/null +++ b/Sanity/Basic-sanity-test/runtest.sh @@ -0,0 +1,85 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/setup/Sanity/Basic-sanity-test +# Description: Tests core functionality of the setup package +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2010 Red Hat, Inc. All rights reserved. +# +# 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 version 2. +# +# This program 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 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. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include rhts environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="setup" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlPhaseEnd + + rlPhaseStartTest + + rlAssertExists "/etc/aliases" + rlAssertExists "/etc/bashrc" + rlAssertExists "/etc/csh.cshrc" + rlAssertExists "/etc/csh.login" + rlAssertExists "/etc/environment" + rlAssertExists "/etc/exports" + rlAssertExists "/etc/filesystems" + rlAssertExists "/etc/fstab" + rlAssertExists "/etc/group" + rlAssertExists "/etc/gshadow" + rlAssertExists "/etc/host.conf" + rlAssertExists "/etc/hosts" + # https://bugzilla.redhat.com/show_bug.cgi?id=1663556 + if rlIsRHEL ">7" || rlIsFedora ">=20"; then + rlAssertNotExists "/etc/hosts.allow" + rlAssertNotExists "/etc/hosts.deny" + else + rlAssertExists "/etc/hosts.allow" + rlAssertExists "/etc/hosts.deny" + fi + rlAssertExists "/etc/inputrc" + rlAssertExists "/etc/motd" + rlAssertExists "/etc/mtab" + rlAssertExists "/etc/passwd" + rlAssertExists "/etc/printcap" + rlAssertExists "/etc/profile" + rlAssertExists "/etc/profile.d" + rlAssertExists "/etc/protocols" + # https://bugzilla.redhat.com/show_bug.cgi?id=1090639 + if rlIsRHEL ">7" || rlIsFedora ">=21" ; then + rlAssertNotExists "/etc/securetty" + else + rlAssertExists "/etc/securetty" + fi + rlAssertExists "/etc/services" + rlAssertExists "/etc/shadow" + rlAssertExists "/etc/shells" + rlAssertExists "/var/log/lastlog" + + rlPhaseEnd + + rlPhaseStartCleanup + rlPhaseEnd +#rlJournalPrintText +rlJournalEnd