Add required flags for branch protection

Add missing tests folder
This commit is contained in:
alakatos 2021-08-27 13:50:45 +02:00
parent b138af8e08
commit ab4a7972df
5 changed files with 191 additions and 1 deletions

View File

@ -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 <alakatos@redhat.com> - 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 <alakatos@redhat.com> - 8.2102.0-8
- Resolve issues detected by covscan
resolves: rhbz#1938863

View File

@ -0,0 +1,64 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/rsyslog/Sanity/various-simple-checks
# Description: various-simple-checks
# Author: Stefan Dordevic <sdordevi@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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 <sdordevi@redhat.com>" > $(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)

View File

@ -0,0 +1,3 @@
PURPOSE of /CoreOS/rsyslog/Sanity/various-simple-checks
Description: various-simple-checks
Author: Stefan Dordevic <sdordevi@redhat.com>

View File

@ -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 <jvymazal@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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

21
tests/tests.yml Normal file
View File

@ -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 }}"