From 7e61b67e20fb4a2b2e391bfcc6dbe6adbc296bfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Hrdina?= Date: Wed, 3 May 2023 12:01:54 +0200 Subject: [PATCH] Adding tests /CoreOS/filesystem/Regression/bz517575-Changes-for-lowering-capabilities-project /CoreOS/filesystem/Regression/bz1989202-Add-afs-directory-to-filesystem-package-in-RHEL9 /CoreOS/filesystem/Regression/Fail-to-update-filesystem-inside-systemd-nspawn /CoreOS/filesystem/Regression/filesystem-should-own-usr-share-licenses /CoreOS/filesystem/Sanity/content /CoreOS/filesystem/Sanity/static --- .../main.fmf | 27 ++++ .../runtest.sh | 53 ++++++++ .../main.fmf | 25 ++++ .../runtest.sh | 51 +++++++ .../main.fmf | 33 +++++ .../runtest.sh | 124 ++++++++++++++++++ .../main.fmf | 27 ++++ .../runtest.sh | 52 ++++++++ Sanity/content/main.fmf | 37 ++++++ Sanity/content/runtest.sh | 77 +++++++++++ Sanity/static/main.fmf | 26 ++++ Sanity/static/runtest.sh | 42 ++++++ 12 files changed, 574 insertions(+) create mode 100644 Regression/Fail-to-update-filesystem-inside-systemd-nspawn/main.fmf create mode 100755 Regression/Fail-to-update-filesystem-inside-systemd-nspawn/runtest.sh create mode 100644 Regression/bz1989202-Add-afs-directory-to-filesystem-package-in-RHEL9/main.fmf create mode 100755 Regression/bz1989202-Add-afs-directory-to-filesystem-package-in-RHEL9/runtest.sh create mode 100644 Regression/bz517575-Changes-for-lowering-capabilities-project/main.fmf create mode 100755 Regression/bz517575-Changes-for-lowering-capabilities-project/runtest.sh create mode 100644 Regression/filesystem-should-own-usr-share-licenses/main.fmf create mode 100755 Regression/filesystem-should-own-usr-share-licenses/runtest.sh create mode 100644 Sanity/content/main.fmf create mode 100755 Sanity/content/runtest.sh create mode 100644 Sanity/static/main.fmf create mode 100755 Sanity/static/runtest.sh diff --git a/Regression/Fail-to-update-filesystem-inside-systemd-nspawn/main.fmf b/Regression/Fail-to-update-filesystem-inside-systemd-nspawn/main.fmf new file mode 100644 index 0000000..fee6a16 --- /dev/null +++ b/Regression/Fail-to-update-filesystem-inside-systemd-nspawn/main.fmf @@ -0,0 +1,27 @@ +summary: Test for BZ#1912155 (Fail to update filesystem inside systemd-nspawn) +description: | + Bug summary: Fail to update filesystem inside systemd-nspawn container + Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1912155 +contact: František Hrdina +component: + - filesystem +test: ./runtest.sh +framework: beakerlib +recommend: + - filesystem + - systemd-container +duration: 15m +enabled: true +tag: + - Tier1 +tier: '1' +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1912155 +adjust: + - enabled: false + when: distro < rhel-6 + continue: false +extra-nitrate: TC#0609895 +extra-summary: /CoreOS/filesystem/Regression/Fail-to-update-filesystem-inside-systemd-nspawn +extra-task: /CoreOS/filesystem/Regression/Fail-to-update-filesystem-inside-systemd-nspawn +id: a9a61977-bf78-4fa8-8d75-8324338160f5 diff --git a/Regression/Fail-to-update-filesystem-inside-systemd-nspawn/runtest.sh b/Regression/Fail-to-update-filesystem-inside-systemd-nspawn/runtest.sh new file mode 100755 index 0000000..73201b8 --- /dev/null +++ b/Regression/Fail-to-update-filesystem-inside-systemd-nspawn/runtest.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/filesystem/Regression/Fail-to-update-filesystem-inside-systemd-nspawn +# Description: Test for BZ#1912155 (Fail to update filesystem inside systemd-nspawn) +# Author: František Hrdina +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2021 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# 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, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="filesystem" +CONTAINER_NAME="test-container" +SETUP_LOG="/root/setup.log" +TEST_LOG="/root/test.log" + + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm systemd-container + VERSION=$(cat /etc/redhat-release | grep -oP '([0-9]).*' | grep -oP '^([0-9])*') + rlRun "yum -y --nogpg --releasever=$VERSION --installroot=/var/lib/machines/$CONTAINER_NAME install dnf &>> $SETUP_LOG" 0 "Installing dnf into container" + rlRun "yumdownloader --downloadonly --destdir /var/lib/machines/$CONTAINER_NAME/ $PACKAGE &>> $SETUP_LOG" 0 "Downloading $PACKAGE rpm into container" + rlPhaseEnd + + rlPhaseStartTest + rlRun "systemd-nspawn -U -D /var/lib/machines/$CONTAINER_NAME /bin/bash -c 'rpm -Uhv --force $PACKAGE*rpm' &>> $TEST_LOG" 0 "Testing if installing filesystem inside of container succeeded" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "rm -rf /var/lib/machines/$CONTAINER_NAME" 0 "Removing container" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/Regression/bz1989202-Add-afs-directory-to-filesystem-package-in-RHEL9/main.fmf b/Regression/bz1989202-Add-afs-directory-to-filesystem-package-in-RHEL9/main.fmf new file mode 100644 index 0000000..aeccc1a --- /dev/null +++ b/Regression/bz1989202-Add-afs-directory-to-filesystem-package-in-RHEL9/main.fmf @@ -0,0 +1,25 @@ +summary: Test for BZ#1989202 (Add /afs directory to filesystem package in RHEL9) +description: | + Bug summary: Add /afs directory to filesystem package in RHEL9 + Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1989202 +contact: fhrdina@redhat.com +component: + - filesystem +test: ./runtest.sh +framework: beakerlib +recommend: + - filesystem +duration: 5m +enabled: true +tag: + - Tier3 +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1989202 +adjust: + - enabled: false + when: distro < rhel-9 + continue: false +extra-nitrate: TC#0611276 +extra-summary: /CoreOS/filesystem/Regression/bz1989202-Add-afs-directory-to-filesystem-package-in-RHEL9 +extra-task: /CoreOS/filesystem/Regression/bz1989202-Add-afs-directory-to-filesystem-package-in-RHEL9 +id: fcb113d7-388d-4506-ada4-103ed9716c44 diff --git a/Regression/bz1989202-Add-afs-directory-to-filesystem-package-in-RHEL9/runtest.sh b/Regression/bz1989202-Add-afs-directory-to-filesystem-package-in-RHEL9/runtest.sh new file mode 100755 index 0000000..3504c6d --- /dev/null +++ b/Regression/bz1989202-Add-afs-directory-to-filesystem-package-in-RHEL9/runtest.sh @@ -0,0 +1,51 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/filesystem/Regression/bz1989202-Add-afs-directory-to-filesystem-package-in-RHEL9 +# Description: Test for BZ#1989202 (Add /afs directory to filesystem package in RHEL9) +# Author: Pavel Zhukov +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2021 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# 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, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="filesystem" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "pushd $TmpDir" + rlPhaseEnd + + rlPhaseStartTest + rlAssertExists "/afs" + rlRun "rpm -ql filesystem | grep -q afs" 0 + rlRun "rpm -qf /afs | grep -q filesystem" 0 + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/Regression/bz517575-Changes-for-lowering-capabilities-project/main.fmf b/Regression/bz517575-Changes-for-lowering-capabilities-project/main.fmf new file mode 100644 index 0000000..4741f1e --- /dev/null +++ b/Regression/bz517575-Changes-for-lowering-capabilities-project/main.fmf @@ -0,0 +1,33 @@ +summary: Test for bz517575 (Changes for lowering capabilities project) +description: |+ + Bug summary: Changes for lowering capabilities project + Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=517575 + + Description: + As part of the lowering capabilities project, we should tighten permissions on several directories. + +contact: fhrdina@redhat.com +component: + - filesystem +test: ./runtest.sh +framework: beakerlib +recommend: + - filesystem +duration: 5m +enabled: true +tag: + - Tier3 +tier: '3' +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=517575 + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=559592 + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1149374 + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1066591 +adjust: + - enabled: false + when: distro < rhel-6 + continue: false +extra-nitrate: TC#0098163 +extra-summary: /CoreOS/filesystem/Regression/bz517575-Changes-for-lowering-capabilities-project +extra-task: /CoreOS/filesystem/Regression/bz517575-Changes-for-lowering-capabilities-project +id: 393284ac-b524-4528-a60c-bf933f42d47b diff --git a/Regression/bz517575-Changes-for-lowering-capabilities-project/runtest.sh b/Regression/bz517575-Changes-for-lowering-capabilities-project/runtest.sh new file mode 100755 index 0000000..c3f71a7 --- /dev/null +++ b/Regression/bz517575-Changes-for-lowering-capabilities-project/runtest.sh @@ -0,0 +1,124 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/filesystem/Regression/bz517575-Changes-for-lowering-capabilities-project +# Description: Test for bz517575 (Changes for lowering capabilities project) +# Author: Karel Volny +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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="filesystem" +(rlIsRHEL ">7" || rlIsFedora) && FORMAT="| awk '{print \$1, \$3, \$4, \$5, \" \", \$10, \$11, \$12}' | sed 's/ *$//'" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory" + rlRun "pushd $TmpDir" + # note that anything below RHEL6 is excluded in Makefile + if rlIsRHEL 6 ; then + rlRun "cat < expected.out +dr-xr-xr-x. root root system_u:object_r:root_t:s0 / +dr-xr-xr-x. root root system_u:object_r:bin_t:s0 /bin +dr-xr-xr-x. root root system_u:object_r:boot_t:s0 /boot +dr-xr-xr-x. root root system_u:object_r:lib_t:s0 /lib +dr-xr-x---. root root system_u:object_r:admin_home_t:s0 /root +dr-xr-xr-x. root root system_u:object_r:bin_t:s0 /sbin +dr-xr-xr-x. root root system_u:object_r:bin_t:s0 /usr/bin +dr-xr-xr-x. root root system_u:object_r:lib_t:s0 /usr/lib +dr-xr-xr-x. root root system_u:object_r:bin_t:s0 /usr/sbin +EOF" 0 "Storing expected output" + if [ -e /lib64 ]; then + rlRun "cat < expected-lib64.out +dr-xr-xr-x. root root system_u:object_r:lib_t:s0 /lib64 +dr-xr-xr-x. root root system_u:object_r:lib_t:s0 /usr/lib64 +EOF" 0 "Storing expected output for lib64" + fi + elif rlIsRHEL 8 || rlIsRHEL 9 || rlIsFedora; then + rlRun "cat < expected.out +dr-xr-xr-x. root root system_u:object_r:root_t:s0 / +lrwxrwxrwx. root root system_u:object_r:bin_t:s0 /bin -> usr/bin +dr-xr-xr-x. root root system_u:object_r:boot_t:s0 /boot +lrwxrwxrwx. root root system_u:object_r:lib_t:s0 /lib -> usr/lib +dr-xr-x---. root root system_u:object_r:admin_home_t:s0 /root +lrwxrwxrwx. root root system_u:object_r:bin_t:s0 /sbin -> usr/sbin +dr-xr-xr-x. root root system_u:object_r:bin_t:s0 /usr/bin +dr-xr-xr-x. root root system_u:object_r:lib_t:s0 /usr/lib +dr-xr-xr-x. root root system_u:object_r:bin_t:s0 /usr/sbin +EOF" 0 "Storing expected output" + if [ -e /lib64 ]; then + rlRun "cat < expected-lib64.out +lrwxrwxrwx. root root system_u:object_r:lib_t:s0 /lib64 -> usr/lib64 +dr-xr-xr-x. root root system_u:object_r:lib_t:s0 /usr/lib64 +EOF" 0 "Storing expected output for lib64" + fi + else + rlRun "cat < expected.out +dr-xr-xr-x. root root system_u:object_r:root_t:s0 / +lrwxrwxrwx. root root system_u:object_r:bin_t:s0 /bin -> usr/bin +dr-xr-xr-x. root root system_u:object_r:boot_t:s0 /boot +lrwxrwxrwx. root root system_u:object_r:lib_t:s0 /lib -> usr/lib +dr-xr-x---. root root system_u:object_r:admin_home_t:s0 /root +lrwxrwxrwx. root root system_u:object_r:bin_t:s0 /sbin -> usr/sbin +dr-xr-xr-x. root root system_u:object_r:bin_t:s0 /usr/bin +dr-xr-xr-x. root root system_u:object_r:lib_t:s0 /usr/lib +dr-xr-xr-x. root root system_u:object_r:bin_t:s0 /usr/sbin +EOF" 0 "Storing expected output" + if [ -e /lib64 ]; then + rlRun "cat < expected-lib64.out +lrwxrwxrwx. root root system_u:object_r:lib_t:s0 /lib64 -> usr/lib64 +dr-xr-xr-x. root root system_u:object_r:lib_t:s0 /usr/lib64 +EOF" 0 "Storing expected output for lib64" + fi + fi # is RHEL6 + rlPhaseEnd + + rlPhaseStartTest + rlRun "ls -ldZ / /bin /boot /lib /root /sbin /usr/bin /usr/lib /usr/sbin $FORMAT > actual.out" 0 "Getting file permissions" + rlRun "diff expected.out actual.out" 0 "Comparing expected output to actual output" + # DEBUG + echo "expected.out:" + cat expected.out + echo "actual.out:" + cat actual.out + if [ -e /lib64 ]; then + rlLogInfo "/lib64 exists, running additional checks" + rlRun "ls -ldZ /lib64 /usr/lib64 $FORMAT > actual-lib64.out" 0 "Getting file permissions" + rlRun "diff expected-lib64.out actual-lib64.out" 0 "Comparing expected output to actual output" + # DEBUG + echo "expected-lib64.out:" + cat expected-lib64.out + echo "actual-lib64.out:" + cat actual-lib64.out + fi + rlRun "rpm -V $PACKAGE" 0 "Verifying package '$PACKAGE'" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/Regression/filesystem-should-own-usr-share-licenses/main.fmf b/Regression/filesystem-should-own-usr-share-licenses/main.fmf new file mode 100644 index 0000000..3bb771b --- /dev/null +++ b/Regression/filesystem-should-own-usr-share-licenses/main.fmf @@ -0,0 +1,27 @@ +summary: Test for BZ#1278300 (filesystem should own /usr/share/licenses) +description: | + Bug summary: filesystem should own /usr/share/licenses directory + Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1278300 +contact: fhrdina@redhat.com +component: + - filesystem +test: ./runtest.sh +framework: beakerlib +recommend: + - filesystem + - lvm2 +duration: 20m +enabled: true +tag: + - Tier1 +tier: '1' +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1278300 +adjust: + - enabled: false + when: distro < rhel-7 + continue: false +extra-nitrate: TC#0520848 +extra-summary: /CoreOS/filesystem/Regression/filesystem-should-own-usr-share-licenses +extra-task: /CoreOS/filesystem/Regression/filesystem-should-own-usr-share-licenses +id: 6f7b9c25-4123-4c3c-8177-4a3f5f7eacdd diff --git a/Regression/filesystem-should-own-usr-share-licenses/runtest.sh b/Regression/filesystem-should-own-usr-share-licenses/runtest.sh new file mode 100755 index 0000000..9ae88ce --- /dev/null +++ b/Regression/filesystem-should-own-usr-share-licenses/runtest.sh @@ -0,0 +1,52 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/filesystem/Regression/filesystem-should-own-usr-share-licenses +# Description: Test for BZ#1278300 (filesystem should own /usr/share/licenses) +# Author: Robin Hack +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2016 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# 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, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="filesystem" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "pushd $TmpDir" + rlPhaseEnd + + rlPhaseStartTest + rlRun -s "LC_ALL=en_US.UTF-8 rpm -qf /usr/share/licenses/" + + rlAssertNotGrep "file /usr/share/licenses is not owned by any package" "${rlRun_LOG}" + rlAssertGrep "^filesystem" "${rlRun_LOG}" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/Sanity/content/main.fmf b/Sanity/content/main.fmf new file mode 100644 index 0000000..3144a6a --- /dev/null +++ b/Sanity/content/main.fmf @@ -0,0 +1,37 @@ +summary: package content +description: '' +contact: fhrdina@redhat.com +component: + - filesystem +test: ./runtest.sh +framework: beakerlib +require: + - library(distribution/dump) +recommend: + - filesystem + - filesystem-content +duration: 1h +enabled: true +tag: + - NoRHEL4 + - NoRHEL5 + - TIPpass + - TIPpass_Apps + - Tier1 + - rhel-CRB + - rhel8-buildroot + - rhel9-buildroot +tier: '1' +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1978587 +adjust: + - enabled: false + when: distro < rhel-7 + continue: false + - enabled: false + when: distro ~< rhel-7.5 + continue: false +extra-nitrate: TC#0562727 +extra-summary: /CoreOS/filesystem/Sanity/content +extra-task: /CoreOS/filesystem/Sanity/content +id: 78edd886-ab85-4dc3-9183-b2255330db26 diff --git a/Sanity/content/runtest.sh b/Sanity/content/runtest.sh new file mode 100755 index 0000000..2a15869 --- /dev/null +++ b/Sanity/content/runtest.sh @@ -0,0 +1,77 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/filesystem/Sanity/content +# Description: package content +# Author: Alois Mahdal +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2017 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# 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, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +: ${INCLUDE_GHOSTFILES:="NO"} + +rlJournalStart + rlPhaseStartSetup 'init' + rlImport "distribution/dump" + rlAssertRpm "filesystem" + rlAssertRpm "filesystem-content" + rlPhaseEnd + + rlPhaseStartSetup + TestTmp=$(mktemp -d) + rlLogInfo "TestTmp='$TestTmp'" + rlRun "pushd '$TestTmp'" + rlPhaseEnd + + rlPhaseStartSetup "prepare lists" + export LC_ALL=C + rlRun "rpm -ql filesystem | sort >by_rpmdb" + rlRun "rpm -ql --noghost filesystem | sort >by_rpmdb_noghost" + rlRun "sort /usr/share/filesystem/paths >by_file" + + #ghost files + rlRun "diff --left-column by_rpmdb by_rpmdb_noghost | grep '^<' | cut -f2 -d\ |sort >ghostfiles" \ + 0 "create list of ghost files from filesystem package" + rlPhaseEnd + + rlPhaseStartTest "compare lists" + #note: on rhel-7+, there are some irrelevant debug ghost files not included in filesystem-content 'paths' file + if [ "$INCLUDE_GHOSTFILES" = "YES" ]; then + rlRun "diff -u by_rpmdb by_file >lists.diff" 0 "both lists are the same" + else + rlRun "comm -13 ghostfiles /usr/share/filesystem/paths >by_file_noghost" + #rhel7 WORKAROUND + rlIsRHEL 7 && rlRun "sed -i '/\/usr\/share\/filesystem.*/d' by_file_noghost" + + rlRun "diff -u by_rpmdb_noghost by_file_noghost >lists.diff" 0 "both lists are the same - ignoring ghost files" + fi + distribution_dump__file -E -s lists.diff + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -rf '$TestTmp'" + rlPhaseEnd + +rlJournalPrintText +rlJournalEnd diff --git a/Sanity/static/main.fmf b/Sanity/static/main.fmf new file mode 100644 index 0000000..f4e5779 --- /dev/null +++ b/Sanity/static/main.fmf @@ -0,0 +1,26 @@ +summary: Generic static checks +description: '' +contact: fhrdina@redhat.com +component: + - filesystem +test: ./runtest.sh +framework: beakerlib +require: + - library(distribution/static) +recommend: + - filesystem + - filesystem-content +duration: 1h +enabled: true +tag: + - NoRHEL4 + - NoRHEL5 + - rhel-buildroot +adjust: + - enabled: false + when: distro == rhel-4, rhel-5 + continue: false +extra-nitrate: TC#0562728 +extra-summary: /CoreOS/filesystem/Sanity/static +extra-task: /CoreOS/filesystem/Sanity/static +id: e6b227e3-397e-4dac-91bd-5efd922e347b diff --git a/Sanity/static/runtest.sh b/Sanity/static/runtest.sh new file mode 100755 index 0000000..28f13b0 --- /dev/null +++ b/Sanity/static/runtest.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/filesystem/Sanity/static +# Description: Generic static checks +# Author: Alois Mahdal +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2017 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# 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, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +rlJournalStart + rlPhaseStartSetup 'init' + rlImport "distribution/static" + rlPhaseEnd + + rlPhaseStartTest + distribution_static__checks filesystem + { rlIsRHEL '>=7.5' || rlIsFedora '>=25'; } \ + && distribution_static__checks filesystem-content + rlPhaseEnd +rlJournalPrintText +rlJournalEnd