From ff195852b26067dca2d7d303b961dacf5d253497 Mon Sep 17 00:00:00 2001 From: Amith Kumar Date: Apr 21 2021 12:51:19 +0000 Subject: libsepol-sanity: Add test for bug1838257 Add a sanity test suite which verifies but 1838257. The fix evaluates the rpm scripts for components libsepol, libsemanage and libselinux. It looks for obsolete commands like telinit. Signed-off-by: Amith Kumar --- diff --git a/libsepol/Sanity/bz1838257-rpm-scripts-use-deprecated-telinit/Makefile b/libsepol/Sanity/bz1838257-rpm-scripts-use-deprecated-telinit/Makefile new file mode 100644 index 0000000..b1cceb1 --- /dev/null +++ b/libsepol/Sanity/bz1838257-rpm-scripts-use-deprecated-telinit/Makefile @@ -0,0 +1,72 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /CoreOS/libsepol/Sanity/bz1838257-rpm-scripts-use-deprecated-telinit +# Description: The rpm scripts from libsepol uses out of date commands like telinit. +# Author: Amith Kumar +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/CoreOS/libsepol/Sanity/bz1838257-rpm-scripts-use-deprecated-telinit +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Amith Kumar " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: The rpm scripts from libsepol uses out of date commands like telinit" >> $(METADATA) + @echo "Type: Sanity" >> $(METADATA) + @echo "TestTime: 5m" >> $(METADATA) + @echo "RunFor: libsepol" >> $(METADATA) + @echo "RunFor: libselinux" >> $(METADATA) + @echo "RunFor: libsemanage" >> $(METADATA) + @echo "Requires: libsepol" >> $(METADATA) + @echo "Requires: libsepol-devel" >> $(METADATA) + @echo "Requires: libselinux" >> $(METADATA) + @echo "Requires: libselinux-devel" >> $(METADATA) + @echo "Requires: libsemanage" >> $(METADATA) + @echo "Requires: libsemanage-devel" >> $(METADATA) + @echo "Requires: pkgconfig" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Bug: 1838257" >> $(METADATA) + + rhts-lint $(METADATA) + diff --git a/libsepol/Sanity/bz1838257-rpm-scripts-use-deprecated-telinit/PURPOSE b/libsepol/Sanity/bz1838257-rpm-scripts-use-deprecated-telinit/PURPOSE new file mode 100644 index 0000000..21b5178 --- /dev/null +++ b/libsepol/Sanity/bz1838257-rpm-scripts-use-deprecated-telinit/PURPOSE @@ -0,0 +1,11 @@ +PURPOSE of /CoreOS/libsepol/Sanity/bz1838257-rpm-scripts-use-deprecated-telinit + +Description: libsepol rpm scripts use deprecated telinit command + +Author: Amith Kumar + +Bugzilla links: +https://bugzilla.redhat.com/show_bug.cgi?id=1838257 + +Description of problem: +The rpm scripts from the rpm is using out of date commands like telinit. diff --git a/libsepol/Sanity/bz1838257-rpm-scripts-use-deprecated-telinit/main.fmf b/libsepol/Sanity/bz1838257-rpm-scripts-use-deprecated-telinit/main.fmf new file mode 100644 index 0000000..d79a34a --- /dev/null +++ b/libsepol/Sanity/bz1838257-rpm-scripts-use-deprecated-telinit/main.fmf @@ -0,0 +1,2 @@ +path: /libsepol/Sanity/bz1838257-rpm-scripts-use-deprecated-telinit +tier: 1 diff --git a/libsepol/Sanity/bz1838257-rpm-scripts-use-deprecated-telinit/runtest.sh b/libsepol/Sanity/bz1838257-rpm-scripts-use-deprecated-telinit/runtest.sh new file mode 100755 index 0000000..18dbf39 --- /dev/null +++ b/libsepol/Sanity/bz1838257-rpm-scripts-use-deprecated-telinit/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/libsepol/Sanity/bz1838257-rpm-scripts-use-deprecated-telinit +# Description: The rpm scripts from the rpm is using out of date commands like telinit. +# Author: Amith Kumar +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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/bin/rhts-environment.sh +. /usr/share/beakerlib/beakerlib.sh + +PACKAGE=libsepol +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlPhaseEnd + + if rlIsFedora '>=33' || rlIsRHEL ">=7" ; then + rlPhaseStartTest "libsepol rpm scripts use deprecated telinit command bz#1838257" + for COMPONENT in "libsepol" "libsemanage" "libselinux" ; do + rlRun "rpm -qa --scripts \*$COMPONENT\* 2>&1 | tee output_file" + rlAssertNotGrep "telinit" output_file + rlRun "rm -f output_file" + done + rlPhaseEnd + fi + + rlPhaseStartCleanup + rlPhaseEnd +rlJournalPrintText +rlJournalEnd