From ab4a7972df9b04fafd00aebacda9a57da3dda39a Mon Sep 17 00:00:00 2001 From: alakatos Date: Fri, 27 Aug 2021 13:50:45 +0200 Subject: [PATCH] Add required flags for branch protection Add missing tests folder --- rsyslog.spec | 15 ++++- tests/initial-gating-check/Makefile | 64 +++++++++++++++++++ tests/initial-gating-check/PURPOSE | 3 + tests/initial-gating-check/runtest.sh | 89 +++++++++++++++++++++++++++ tests/tests.yml | 21 +++++++ 5 files changed, 191 insertions(+), 1 deletion(-) create mode 100644 tests/initial-gating-check/Makefile create mode 100644 tests/initial-gating-check/PURPOSE create mode 100755 tests/initial-gating-check/runtest.sh create mode 100644 tests/tests.yml diff --git a/rsyslog.spec b/rsyslog.spec index c81b3f2..624480f 100644 --- a/rsyslog.spec +++ b/rsyslog.spec @@ -5,7 +5,7 @@ Summary: Enhanced system logging and kernel message trapping daemon Name: rsyslog Version: 8.2102.0 -Release: 8%{?dist} +Release: 9%{?dist} License: (GPLv3+ and ASL 2.0) URL: http://www.rsyslog.com/ Source0: http://www.rsyslog.com/files/download/rsyslog/%{name}-%{version}.tar.gz @@ -250,6 +250,13 @@ pushd .. popd %build +# Add additional flags as per https://one.redhat.com/rhel-developer-guide/#_what_are_the_required_flags +%ifarch aarch64 +export CFLAGS="$RPM_OPT_FLAGS -mbranch-protection=standard" +%else +export CFLAGS="$RPM_OPT_FLAGS -fcf-protection=full" +%endif + %ifarch sparc64 #sparc64 need big PIC export CFLAGS="$RPM_OPT_FLAGS -fPIC" @@ -495,6 +502,12 @@ done %changelog +* Fri Aug 27 2021 Attila Lakatos - 8.2102.0-9 +- Add required flags for branch protection +- Add missing tests folder +- Resolve issues detected by covscan + resolves: rhbz#1938863 + * Mon Aug 23 2021 Attila Lakatos - 8.2102.0-8 - Resolve issues detected by covscan resolves: rhbz#1938863 diff --git a/tests/initial-gating-check/Makefile b/tests/initial-gating-check/Makefile new file mode 100644 index 0000000..adc40c3 --- /dev/null +++ b/tests/initial-gating-check/Makefile @@ -0,0 +1,64 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /CoreOS/rsyslog/Sanity/various-simple-checks +# Description: various-simple-checks +# Author: Stefan Dordevic +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/CoreOS/rsyslog/Sanity/various-simple-checks +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) + test -x runtest.sh || chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Stefan Dordevic " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: various-simple-checks" >> $(METADATA) + @echo "Type: Sanity" >> $(METADATA) + @echo "TestTime: 10m" >> $(METADATA) + @echo "RunFor: rsyslog" >> $(METADATA) + @echo "Requires: rsyslog" >> $(METADATA) + @echo "RhtsRequires: library(distribution/RpmSnapshot)" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2+" >> $(METADATA) + @echo "Confidential: yes" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/initial-gating-check/PURPOSE b/tests/initial-gating-check/PURPOSE new file mode 100644 index 0000000..1ff6cf0 --- /dev/null +++ b/tests/initial-gating-check/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /CoreOS/rsyslog/Sanity/various-simple-checks +Description: various-simple-checks +Author: Stefan Dordevic diff --git a/tests/initial-gating-check/runtest.sh b/tests/initial-gating-check/runtest.sh new file mode 100755 index 0000000..b60bac1 --- /dev/null +++ b/tests/initial-gating-check/runtest.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/rsyslog/Sanity/various-simple-checks +# Description: initial-gating-check +# Author: Jiri Vymazal +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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/bin/rhts-environment.sh || exit 1 +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="rsyslog" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "pushd $TmpDir" + rlLog "Import RpmSnapshot library" + rlRun "rlImport distribution/RpmSnapshot" + rlFileBackup "/var/log/messages" + rlFileBackup "/etc/rsyslog.conf" + rlRun "cp /etc/rsyslog.conf ." + rlServiceStop "rsyslog" + rlServiceStart "rsyslog" + rlPhaseEnd + + rlPhaseStartTest "BZ#1399555" + rlAssertGrep "rsyslogd" /var/log/messages + rlAssertNotGrep "liblogging" /var/log/messages + rlPhaseEnd + + rlPhaseStartTest "BZ#1399562" + rlServiceStop "rsyslog" + rlServiceStart "rsyslog" + rlAssertNotGrep "rsyslogd.*segfault" /var/log/messages + rlPhaseEnd + + rlPhaseStartTest "BZ#1399652" + rlServiceStop "rsyslog" + rlServiceStart "rsyslog" + [ ! -f "/var/run/rsyslogd.pid" ] && rlFail "/var/run/rsyslogd.pid file not found" + [ -f "/var/run/syslogd.pid" ] && rlFail "/var/run/syslogd.pid file found" + pid_of=`pidof rsyslogd` + rlLogInfo "PID of rsyslogd: $pid_of" + pid_file=`cat /var/run/syslogd.pid` + rlLogInfo "PID in pidfile: $pid_file" + # dummy check + [ $pid_of -ne $pid_file ] && rlFail "PIDs are not the same" + rlPhaseEnd + + rlPhaseStartTest "BZ#1410630" + rlRun "rsyslogd -N 1" 0 "\"rsyslogd -N 1\" should return 0" + rlLogInfo "set invalid configuration " + echo ":msg, eregex, \"^(Starting|Stopping) user-[0-9]+\.slice\" stop" >> /etc/rsyslog.conf + rlRun "rsyslogd -N 1" 1 "\"rsyslogd -N 1\" should return 1" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlServiceStop "rsyslog" + sleep 2 + rlFileRestore "/var/log/messages" + rlFileRestore "/etc/rsyslog.conf" + rlServiceStart "rsyslog" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..2d31a44 --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,21 @@ +--- +- hosts: localhost + tags: [ always ] + tasks: + - set_fact: + our_required_packages: + - rsyslog + - logrotate + - bash + - libestr + - systemd # for journal integration + +- hosts: localhost + tags: + - classic + roles: + - role: standard-test-beakerlib + tests: + - initial-gating-check + required_packages: "{{ our_required_packages }}" +