diff --git a/cronie.spec b/cronie.spec index c2d011c..9a2cf3c 100644 --- a/cronie.spec +++ b/cronie.spec @@ -6,7 +6,7 @@ Summary: Cron daemon for executing programs at set times Name: cronie Version: 1.5.7 -Release: 9%{?dist} +Release: 10%{?dist} License: MIT and BSD and ISC and GPLv2+ URL: https://github.com/cronie-crond/cronie Source0: https://github.com/cronie-crond/cronie/releases/download/cronie-%{version}/cronie-%{version}.tar.gz @@ -214,6 +214,11 @@ exit 0 %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/cron.d/dailyjobs %changelog +* Thu Nov 16 2023 Jan Houška - 1.5.7-10 +- Related: RHEL-5372 +- remove obsolete tests. +- Correct gating.yaml for CI. + * Fri Nov 10 2023 Ondřej Pohořelský - 1.5.7-9 - Add support for `-n` option in crontab entries - Resolves: RHEL-5372 diff --git a/gating.yaml b/gating.yaml index 648918d..c190bde 100644 --- a/gating.yaml +++ b/gating.yaml @@ -3,4 +3,4 @@ product_versions: - rhel-9 decision_context: osci_compose_gate rules: - - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} + - !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional} diff --git a/tests/Can-t-remove-crontab-from-expired-accounts/Makefile b/tests/Can-t-remove-crontab-from-expired-accounts/Makefile deleted file mode 100644 index eea8ff8..0000000 --- a/tests/Can-t-remove-crontab-from-expired-accounts/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /CoreOS/cronie/Regression/Can-t-remove-crontab-from-expired-accounts -# Description: Test for Can't remove crontab from expired accounts -# Author: Karel Volny -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# 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/cronie/Regression/Can-t-remove-crontab-from-expired-accounts -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: Karel Volny " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: Test for Can't remove crontab from expired accounts" >> $(METADATA) - @echo "Type: Regression" >> $(METADATA) - @echo "TestTime: 5m" >> $(METADATA) - @echo "RunFor: cronie" >> $(METADATA) - @echo "Requires: cronie" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2+" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/Can-t-remove-crontab-from-expired-accounts/PURPOSE b/tests/Can-t-remove-crontab-from-expired-accounts/PURPOSE deleted file mode 100644 index addedc0..0000000 --- a/tests/Can-t-remove-crontab-from-expired-accounts/PURPOSE +++ /dev/null @@ -1,3 +0,0 @@ -PURPOSE of /CoreOS/cronie/Regression/Can-t-remove-crontab-from-expired-accounts -Description: Test for Can't remove crontab from expired accounts -Author: Karel Volny diff --git a/tests/Can-t-remove-crontab-from-expired-accounts/runtest.sh b/tests/Can-t-remove-crontab-from-expired-accounts/runtest.sh deleted file mode 100644 index 73d8914..0000000 --- a/tests/Can-t-remove-crontab-from-expired-accounts/runtest.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash -# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /CoreOS/cronie/Regression/Can-t-remove-crontab-from-expired-accounts -# Description: Test for Can't remove crontab from expired accounts -# Author: Karel Volny -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# 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="cronie" -TestUser="usertest" -ct_file="/var/spool/cron/$TestUser" - -rlJournalStart - rlPhaseStartSetup - rlAssertRpm $PACKAGE - rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" - rlRun "pushd $TmpDir" - rlRun "useradd $TestUser" 0 "Adding the testing user" - rlPhaseEnd - - rlPhaseStartTest - rlRun "echo '1 1 1 1 1 nonsense' | crontab -u $TestUser -" 0 "Setting up crontab for the testing user" - rlRun -s "crontab -u $TestUser -l" 0 "Checking the testing crontab" - rlAssertGrep "nonsense" $rlRun_LOG - rlRun "chage -E 1 $TestUser" 0 "Expiring the testing user account" - rlRun "crontab -u $TestUser -r" 0 "Removing the testing crontab" - rlAssertNotGrep "not allowed" $rlRun_LOG - rlRun -s "crontab -u $TestUser -l" 1 "Checking the testing crontab (should not exist)" - rlAssertGrep "no crontab for $TestUser" $rlRun_LOG - rlAssertNotGrep "not allowed" $rlRun_LOG - rlAssertNotExists "$ct_file" - rlPhaseEnd - - rlPhaseStartCleanup - rlRun "userdel $TestUser" 0 "Deleting the testing user" - rlRun "popd" - rlRun "rm -rf $TmpDir $ct_file" 0 "Removing tmp directory and possible cruft" - rlPhaseEnd -rlJournalPrintText -rlJournalEnd diff --git a/tests/Cron-does-uid-lookups-for-non-existent-users/Makefile b/tests/Cron-does-uid-lookups-for-non-existent-users/Makefile deleted file mode 100644 index 230390a..0000000 --- a/tests/Cron-does-uid-lookups-for-non-existent-users/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /CoreOS/cronie/Regression/Cron-does-uid-lookups-for-non-existent-users -# Description: Test for Cron does uid lookups for non-existent users -# Author: Vaclav Danek -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2015 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/cronie/Regression/Cron-does-uid-lookups-for-non-existent-users -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: Vaclav Danek " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: Test for Cron does uid lookups for non-existent users" >> $(METADATA) - @echo "Type: Regression" >> $(METADATA) - @echo "TestTime: 5m" >> $(METADATA) - @echo "RunFor: cronie" >> $(METADATA) - @echo "Requires: cronie" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2+" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/Cron-does-uid-lookups-for-non-existent-users/PURPOSE b/tests/Cron-does-uid-lookups-for-non-existent-users/PURPOSE deleted file mode 100644 index 9d7cf13..0000000 --- a/tests/Cron-does-uid-lookups-for-non-existent-users/PURPOSE +++ /dev/null @@ -1,4 +0,0 @@ -PURPOSE of /CoreOS/cronie/Regression/Cron-does-uid-lookups-for-non-existent-users -Description: Test for Cron does uid lookups for non-existent users -Author: Vaclav Danek -Bug summary: Cron does uid lookups for non-existent users diff --git a/tests/Cron-does-uid-lookups-for-non-existent-users/runtest.sh b/tests/Cron-does-uid-lookups-for-non-existent-users/runtest.sh deleted file mode 100644 index 72329da..0000000 --- a/tests/Cron-does-uid-lookups-for-non-existent-users/runtest.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /CoreOS/cronie/Regression/Cron-does-uid-lookups-for-non-existent-users -# Description: Test for Cron does uid lookups for non-existent users -# Author: Vaclav Danek -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2015 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="cronie" - -rlJournalStart - rlPhaseStartSetup - rlAssertRpm $PACKAGE - rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" - rlRun "pushd $TmpDir" - rlPhaseEnd - - rlPhaseStartTest - rlRun "sleep 61 | crontab -" 0 - rlRun -s "tail /var/log/cron" 0 - rlAssertNotGrep "ORPHAN (no passwd entry)" $rlRun_LOG - rm -f $rlRun_LOG - rlPhaseEnd - - rlPhaseStartCleanup - rlRun "popd" - rlRun "rm -r $TmpDir" 0 "Removing tmp directory" - rlPhaseEnd -rlJournalPrintText -rlJournalEnd diff --git a/tests/MAILTO-problem-with-anacron/Makefile b/tests/MAILTO-problem-with-anacron/Makefile deleted file mode 100644 index cc54f39..0000000 --- a/tests/MAILTO-problem-with-anacron/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /CoreOS/cronie/Regression/MAILTO-problem-with-anacron -# Description: Test for MAILTO problem with anacron -# Author: Karel Volny -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# 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/cronie/Regression/MAILTO-problem-with-anacron -export TESTVERSION=1.0 - -BUILT_FILES= - -FILES=$(METADATA) runtest.sh Makefile PURPOSE anacrontab - -.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: Karel Volny " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: Test for MAILTO problem with anacron" >> $(METADATA) - @echo "Type: Regression" >> $(METADATA) - @echo "TestTime: 15m" >> $(METADATA) - @echo "RunFor: cronie" >> $(METADATA) - @echo "Requires: cronie" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2+" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/MAILTO-problem-with-anacron/PURPOSE b/tests/MAILTO-problem-with-anacron/PURPOSE deleted file mode 100644 index 0eb365c..0000000 --- a/tests/MAILTO-problem-with-anacron/PURPOSE +++ /dev/null @@ -1,4 +0,0 @@ -PURPOSE of /CoreOS/cronie/Regression/MAILTO-problem-with-anacron -Description: Test for MAILTO problem with anacron -Author: Karel Volny -Bug summary: MAILTO problem with anacron diff --git a/tests/MAILTO-problem-with-anacron/anacrontab b/tests/MAILTO-problem-with-anacron/anacrontab deleted file mode 100644 index c672b71..0000000 --- a/tests/MAILTO-problem-with-anacron/anacrontab +++ /dev/null @@ -1,5 +0,0 @@ -SHELL=/bin/sh -PATH=/sbin:/bin:/usr/sbin:/usr/bin -MAILTO=testuser1 - -1 0 test echo "Hello anacron!" diff --git a/tests/MAILTO-problem-with-anacron/runtest.sh b/tests/MAILTO-problem-with-anacron/runtest.sh deleted file mode 100644 index 9504398..0000000 --- a/tests/MAILTO-problem-with-anacron/runtest.sh +++ /dev/null @@ -1,155 +0,0 @@ -#!/bin/bash -# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /CoreOS/cronie/Regression/MAILTO-problem-with-anacron -# Description: Test for MAILTO problem with anacron -# Author: Karel Volny -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# 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="cronie" -TestDir=$PWD - -rlJournalStart - rlPhaseStartSetup - rlAssertRpm $PACKAGE - rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" - rlRun "pushd $TmpDir" - rlRun "useradd testuser1" 0 "Adding the testing user" - rlFileBackup --clean /var/spool/mail/root /var/log/cron - # stop cron not to interfere with our logs - rlServiceStop crond - rlPhaseEnd - - # email should be sent to user specified via MAILTO (testuser1) - rlPhaseStartTest anacronmail - rlRun "truncate --size 0 /var/spool/mail/testuser1" 0 "Truncating mail queue for the user 'testuser1'" - rlRun "truncate --size 0 /var/log/cron" 0 "Truncating cron log" - # DEBUG - echo "anacrontab:" - echo "***********" - cat ${TestDir}/anacrontab - rlRun "anacron -f -n -d -t ${TestDir}/anacrontab" 0 "Forcing anacron to run job" - sleep 5 - # DEBUG - echo "/var/spool/mail/testuser1:" - echo "**************************" - cat /var/spool/mail/testuser1 - rlAssertGrep "anacron" "/var/spool/mail/testuser1" - rlAssertGrep "To: testuser1" "/var/spool/mail/testuser1" - # DEBUG - echo "/var/log/cron:" - echo "**************" - cat /var/log/cron - rlAssertGrep "\(produced output\)" /var/log/cron - rlAssertNotGrep "not mailing" /var/log/cron -i - rlPhaseEnd - - # email should NOT be sent with empty MAILTO - rlPhaseStartTest noanacronmail-empty - rlRun "truncate --size 0 /var/spool/mail/root" 0 "Truncating mail queue for root" - rlRun "truncate --size 0 /var/log/cron" 0 "Truncating cron log" - rlRun "sed -i -e 's/MAILTO=testuser1/MAILTO=/' ${TestDir}/anacrontab" 0 "Removing mailto user from anacrontab" - # DEBUG - echo "anacrontab:" - echo "***********" - cat ${TestDir}/anacrontab - rlRun "anacron -f -n -d -t ${TestDir}/anacrontab" 0 "Forcing anacron to run job" - sleep 5 - # DEBUG - echo "/var/spool/mail/root:" - echo "*********************" - cat /var/spool/mail/root - rlAssertNotGrep "anacron" "/var/spool/mail/root" - # DEBUG - echo "/var/log/cron:" - echo "**************" - cat /var/log/cron - rlAssertGrep "\(produced output\)" /var/log/cron - rlAssertGrep "not mailing" /var/log/cron -i - rlPhaseEnd - - # email should be sent to nonexisting user double-doublequotes, as the string after '=' is treated literally - rlPhaseStartTest anacronmail-quotes - rlRun "truncate --size 0 /var/spool/mail/root" 0 "Truncating mail queue for root" - rlRun "truncate --size 0 /var/log/cron" 0 "Truncating cron log" - rlRun "sed -i -e 's/MAILTO=/MAILTO=\"\"/' ${TestDir}/anacrontab" 0 "Setting mailto to double quotes in anacrontab" - # DEBUG - echo "anacrontab:" - echo "***********" - cat ${TestDir}/anacrontab - rlRun "anacron -f -n -d -t ${TestDir}/anacrontab" 0 "Forcing anacron to run job" - sleep 5 - # DEBUG - echo "/var/spool/mail/root:" - echo "*********************" - cat /var/spool/mail/root - rlAssertGrep "anacron" "/var/spool/mail/root" - #rlAssertGrep "To: \"\"" "/var/spool/mail/root" - # ^ this doesn't work in Beaker for some reason, check the quotes in 'Received: ... for "";' - rlAssertGrep "for \"\"" "/var/spool/mail/root" - # DEBUG - echo "/var/log/cron:" - echo "**************" - cat /var/log/cron - rlAssertGrep "\(produced output\)" /var/log/cron - rlAssertNotGrep "not mailing" /var/log/cron -i - rlPhaseEnd - - # email should be sent to the user running anacron, when MAILTO is missing - rlPhaseStartTest anacronmail-missing - rlRun "truncate --size 0 /var/spool/mail/root" 0 "Truncating mail queue for root" - rlRun "truncate --size 0 /var/log/cron" 0 "Truncating cron log" - rlRun "sed -i -e '/MAILTO/d' ${TestDir}/anacrontab" 0 "Removing mailto from anacrontab" - # DEBUG - echo "anacrontab:" - echo "***********" - cat ${TestDir}/anacrontab - rlRun "anacron -f -n -d -t ${TestDir}/anacrontab" 0 "Forcing anacron to run job" - sleep 5 - # DEBUG - echo "/var/spool/mail/root:" - echo "*********************" - cat /var/spool/mail/root - rlAssertGrep "anacron" "/var/spool/mail/root" - # DEBUG - echo "/var/log/cron:" - echo "**************" - cat /var/log/cron - rlAssertGrep "\(produced output\)" /var/log/cron - rlAssertNotGrep "not mailing" /var/log/cron -i - rlPhaseEnd - - rlPhaseStartCleanup - rlRun "userdel testuser1" - rlServiceRestore crond - rlFileRestore - rlRun "popd" - rlRun "rm -r $TmpDir" 0 "Removing tmp directory" - #avoid systemd failing to start crond due start-limit - sleep 10 - rlPhaseEnd -rlJournalPrintText -rlJournalEnd diff --git a/tests/Make-crontab-a-PIE/Makefile b/tests/Make-crontab-a-PIE/Makefile deleted file mode 100644 index 43e6a94..0000000 --- a/tests/Make-crontab-a-PIE/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /CoreOS/Regression/Regression/Make-crontab-a-PIE -# Description: What the test does -# Author: Jakub Prokes -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2013 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/Regression/Make-crontab-a-PIE -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: Jakub Prokes " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: What the test does" >> $(METADATA) - @echo "Type: Regression" >> $(METADATA) - @echo "TestTime: 5m" >> $(METADATA) - @echo "RunFor: cronie" >> $(METADATA) - @echo "Requires: cronie elfutils" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/Make-crontab-a-PIE/PURPOSE b/tests/Make-crontab-a-PIE/PURPOSE deleted file mode 100644 index 2d2bf11..0000000 --- a/tests/Make-crontab-a-PIE/PURPOSE +++ /dev/null @@ -1,3 +0,0 @@ -PURPOSE of /CoreOS/Regression/Regression/Make-crontab-a-PIE -Description: What the test does -Author: Jakub Prokes diff --git a/tests/Make-crontab-a-PIE/runtest.sh b/tests/Make-crontab-a-PIE/runtest.sh deleted file mode 100644 index b0341a1..0000000 --- a/tests/Make-crontab-a-PIE/runtest.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash -# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /CoreOS/Regression/Regression/Make-crontab-a-PIE -# Description: What the test does -# Author: Jakub Prokes -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2013 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 Beaker environment -. /usr/bin/rhts-environment.sh || exit 1 -. /usr/share/beakerlib/beakerlib.sh || exit 1 - -PACKAGES="cronie vixie-cron" - -function myAssertRpms() { - rlRun "rpm -q $*" $((${#@}-1)) "One of required packages was found"; -} - - -rlJournalStart - rlPhaseStartSetup - myAssertRpms $PACKAGES - rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" - rlRun "pushd $TmpDir" - rlPhaseEnd - - rlPhaseStartTest - rlRun "eu-readelf -h /usr/bin/crontab | grep -E 'Type:[[:space:]]+DYN[[:space:]]+\(Shared object file\)'" - rlPhaseEnd - - rlPhaseStartCleanup - rlRun "popd" - rlRun "rm -r $TmpDir" 0 "Removing tmp directory" - rlPhaseEnd -rlJournalPrintText -rlJournalEnd diff --git a/tests/anacron-segfaults-with-certain-config-data-2/Makefile b/tests/anacron-segfaults-with-certain-config-data-2/Makefile deleted file mode 100644 index 4323b82..0000000 --- a/tests/anacron-segfaults-with-certain-config-data-2/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /CoreOS/cronie/Regression/anacron-segfaults-with-certain-config-data -# Description: try some invalid configs for anacron to check config parser -# Author: Jakub Prokes -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2014 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/cronie/Regression/anacron-segfaults-with-certain-config-data-2 -export TESTVERSION=1.0 - -BUILT_FILES= - -FILES=$(METADATA) runtest.sh Makefile PURPOSE configs - -.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: Jakub Prokes " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: try some invalid configs for anacron to check config parser" >> $(METADATA) - @echo "Type: Regression" >> $(METADATA) - @echo "TestTime: 5m" >> $(METADATA) - @echo "RunFor: cronie" >> $(METADATA) - @echo "Requires: cronie" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2+" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/anacron-segfaults-with-certain-config-data-2/PURPOSE b/tests/anacron-segfaults-with-certain-config-data-2/PURPOSE deleted file mode 100644 index 6c8e9e2..0000000 --- a/tests/anacron-segfaults-with-certain-config-data-2/PURPOSE +++ /dev/null @@ -1,3 +0,0 @@ -PURPOSE of /CoreOS/cronie/Regression/anacron-segfaults-with-certain-config-data-2 -Description: try some invalid configs for anacron to check config parser -Author: Jakub Prokes diff --git a/tests/anacron-segfaults-with-certain-config-data-2/configs/scenario-01_1 b/tests/anacron-segfaults-with-certain-config-data-2/configs/scenario-01_1 deleted file mode 100644 index 3f10d0b..0000000 --- a/tests/anacron-segfaults-with-certain-config-data-2/configs/scenario-01_1 +++ /dev/null @@ -1,16 +0,0 @@ -# /etc/anacrontab: configuration file for anacron - -# See anacron(8) and anacrontab(5) for details. - -SHELL=/bin/sh -PATH=/sbin:/bin:/usr/sbin:/usr/bin -MAILTO=root -# the maximal random delay added to the base delay of the jobs -RANDOM_DELAY=45 -# the jobs will be started during the following hours only -START_HOURS_RANGE=0 - -#period in days delay in minutes job-identifier command -1 5 cron.daily nice run-parts /etc/cron.daily -7 25 cron.weekly nice run-parts /etc/cron.weekly -@monthly 45 cron.monthly nice run-parts /etc/cron.monthly diff --git a/tests/anacron-segfaults-with-certain-config-data-2/configs/scenario-02_0 b/tests/anacron-segfaults-with-certain-config-data-2/configs/scenario-02_0 deleted file mode 100644 index fee29eb..0000000 --- a/tests/anacron-segfaults-with-certain-config-data-2/configs/scenario-02_0 +++ /dev/null @@ -1,16 +0,0 @@ -# /etc/anacrontab: configuration file for anacron - -# See anacron(8) and anacrontab(5) for details. - -SHELL=/bin/sh -PATH=/sbin:/bin:/usr/sbin:/usr/bin -MAILTO=root -# the maximal random delay added to the base delay of the jobs -RANDOM_DELAY=45 -# the jobs will be started during the following hours only -START_HOURS_RANGE=3-8 - -#period in days delay in minutes job-identifier command -1 5 cron.daily nice run-parts /etc/cron.daily -7 25 cron.weekly nice run-parts /etc/cron.weekly -@monthly 45 cron.monthly nice run-parts /etc/cron.monthly diff --git a/tests/anacron-segfaults-with-certain-config-data-2/configs/scenario-03_1 b/tests/anacron-segfaults-with-certain-config-data-2/configs/scenario-03_1 deleted file mode 100644 index 1767210..0000000 --- a/tests/anacron-segfaults-with-certain-config-data-2/configs/scenario-03_1 +++ /dev/null @@ -1,18 +0,0 @@ -# /etc/anacrontab: configuration file for anacron - -# See anacron(8) and anacrontab(5) for details. - -SHELL=/bin/sh -PATH=/sbin:/bin:/usr/sbin:/usr/bin -MAILTO=root -# the maximal random delay added to the base delay of the jobs -RANDOM_DELAY=45 -VAR=8 -# the jobs will be started during the following hours only -START_HOURS_RANGE=3-$VAR -#START_HOURS_RANGE=0 - -#period in days delay in minutes job-identifier command -1 5 cron.daily nice run-parts /etc/cron.daily -7 25 cron.weekly nice run-parts /etc/cron.weekly -@monthly 45 cron.monthly nice run-parts /etc/cron.monthly diff --git a/tests/anacron-segfaults-with-certain-config-data-2/configs/scenario-04_1 b/tests/anacron-segfaults-with-certain-config-data-2/configs/scenario-04_1 deleted file mode 100644 index 504a7cb..0000000 --- a/tests/anacron-segfaults-with-certain-config-data-2/configs/scenario-04_1 +++ /dev/null @@ -1,17 +0,0 @@ -# /etc/anacrontab: configuration file for anacron - -# See anacron(8) and anacrontab(5) for details. - -SHELL=/bin/sh -PATH=/sbin:/bin:/usr/sbin:/usr/bin -MAILTO=root -# the maximal random delay added to the base delay of the jobs -RANDOM_DELAY=45 -%@$&=^^^^ -# the jobs will be started during the following hours only -START_HOURS_RANGE=%@$&=^^^^ - -#period in days delay in minutes job-identifier command -1 5 cron.daily nice run-parts /etc/cron.daily -7 25 cron.weekly nice run-parts /etc/cron.weekly -@monthly 45 cron.monthly nice run-parts /etc/cron.monthly diff --git a/tests/anacron-segfaults-with-certain-config-data-2/configs/scenario-05_1 b/tests/anacron-segfaults-with-certain-config-data-2/configs/scenario-05_1 deleted file mode 100644 index c2d2b58..0000000 --- a/tests/anacron-segfaults-with-certain-config-data-2/configs/scenario-05_1 +++ /dev/null @@ -1,14 +0,0 @@ -# /etc/anacrontab: configuration file for anacron - -# See anacron(8) and anacrontab(5) for details. - -SHELL=/bin/sh -PATH=/sbin:/bin:/usr/sbin:/usr/bin -MAILTO=root -# the maximal random delay added to the base delay of the jobs -RANDOM_DELAY=%@$&=^^^^ - -#period in days delay in minutes job-identifier command -1 5 cron.daily nice run-parts /etc/cron.daily -7 25 cron.weekly nice run-parts /etc/cron.weekly -@monthly 45 cron.monthly nice run-parts /etc/cron.monthly diff --git a/tests/anacron-segfaults-with-certain-config-data-2/runtest.sh b/tests/anacron-segfaults-with-certain-config-data-2/runtest.sh deleted file mode 100644 index bf78c58..0000000 --- a/tests/anacron-segfaults-with-certain-config-data-2/runtest.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash -# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /CoreOS/cronie/Regression/anacron-segfaults-with-certain-config-data-2 -# Description: try some invalid configs for anacron to check config parser -# Author: Jakub Prokes -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2014 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 - -assertRpms() { - rlRun "rpm -q $*" 0-$((${#@}-1)) "One of required packages was found"; - RC=$?; - [[ $RC -lt ${#@} ]] && return 0; - return $RC; -} - -PACKAGES="${PACKAGES:-cronie vixie-cron}" - -rlJournalStart - rlPhaseStartSetup - assertRpms $PACKAGES - rlPhaseEnd - - rlPhaseStartTest - for scenario in ./configs/*; do - [[ ! -f $scenario ]] && rlFail "$scenario isn't regular file"; - ## File name has 'special' format: scenario-X_Y where X is scenario number and Y is expected - ## exit code. And of course there must be some issues related to RHEL 5 :-) - if rlIsRHEL 5; then - rlRun "anacron -f -u -d -t $(readlink -f $scenario)" 0 "Testing $(basename ${scenario%_[0-9]})"; - else - if rlRun "anacron -T -t $scenario;" ${scenario##*_} "Verifying $(basename ${scenario%_[0-9]})"; then - rlRun "anacron -f -u -d -t $scenario" 0 "Testing $(basename ${scenario%_[0-9]})"; - else - [[ $? -eq 139 ]] && cat $scenario; - fi - fi - done - rlPhaseEnd - - rlPhaseStartCleanup - rlPhaseEnd -rlJournalPrintText -rlJournalEnd diff --git a/tests/anacron-segfaults-with-certain-config-data/Makefile b/tests/anacron-segfaults-with-certain-config-data/Makefile deleted file mode 100644 index e4475ae..0000000 --- a/tests/anacron-segfaults-with-certain-config-data/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /CoreOS/cronie/Regression/anacron-segfaults-with-certain-config-data -# Description: Test for anacron segfaults with certain config data -# Author: Robin Hack -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2015 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/cronie/Regression/anacron-segfaults-with-certain-config-data -export TESTVERSION=1.0 - -BUILT_FILES= - -FILES=$(METADATA) runtest.sh Makefile PURPOSE core.sh - -.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: Robin Hack " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: Test for anacron segfaults with certain config data" >> $(METADATA) - @echo "Type: Regression" >> $(METADATA) - @echo "TestTime: 20m" >> $(METADATA) - @echo "RunFor: cronie" >> $(METADATA) - @echo "Requires: cronie" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2+" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/anacron-segfaults-with-certain-config-data/PURPOSE b/tests/anacron-segfaults-with-certain-config-data/PURPOSE deleted file mode 100644 index 28d8f4b..0000000 --- a/tests/anacron-segfaults-with-certain-config-data/PURPOSE +++ /dev/null @@ -1,3 +0,0 @@ -PURPOSE of /CoreOS/cronie/Regression/anacron-segfaults-with-certain-config-data -Description: anacron segfaults with certain config data -Author: Robin Hack diff --git a/tests/anacron-segfaults-with-certain-config-data/core.sh b/tests/anacron-segfaults-with-certain-config-data/core.sh deleted file mode 100644 index 21c0cc9..0000000 --- a/tests/anacron-segfaults-with-certain-config-data/core.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -echo "$1" > /tmp/core.lock diff --git a/tests/anacron-segfaults-with-certain-config-data/runtest.sh b/tests/anacron-segfaults-with-certain-config-data/runtest.sh deleted file mode 100644 index a2d784d..0000000 --- a/tests/anacron-segfaults-with-certain-config-data/runtest.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash -# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /CoreOS/cronie/Regression/anacron-segfaults-with-certain-config-data -# Description: Test for anacron segfaults with certain config data -# Author: Robin Hack -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2015 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="cronie" - -rlJournalStart - rlPhaseStartSetup "Set anacron" - rlAssertRpm $PACKAGE - TESTDIR="${PWD}" - - rlFileBackup "/etc/anacrontab" - - rlRun "echo 'START_HOURS_RANGE=0' > /etc/anacrontab" - - # Prepare coredump handler - rlServiceStop crond - rlRun "chmod +x ${TESTDIR}/core.sh" - - rlRun "cat /proc/sys/kernel/core_pattern > /tmp/core_pattern" - rlRun "echo \"|${TESTDIR}/core.sh %e\" > /proc/sys/kernel/core_pattern" - rlPhaseEnd - - rlPhaseStartTest - rlRun "anacron" - - rlRun "sleep 2" 0 "Wait for kernel" - - # Anacron segfaults - rlAssertNotExists "/tmp/core.lock" - if [ -s "/tmp/core.lock" ]; then - rlAssertNotGrep "anacron" "/tmp/core.lock" - fi - rlPhaseEnd - - rlPhaseStartCleanup - rlRun "cat /tmp/core_pattern > /proc/sys/kernel/core_pattern" - - rm -f /tmp/core.lock - rm -f /tmp/core_pattern - killall anacron - - rlFileRestore - rlServiceRestore crond - #avoid systemd failing to start crond due start-limit - sleep 10 - rlPhaseEnd -rlJournalPrintText -rlJournalEnd diff --git a/tests/config-parsing-issue/Makefile b/tests/config-parsing-issue/Makefile deleted file mode 100644 index 894a5c3..0000000 --- a/tests/config-parsing-issue/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /CoreOS/cronie/Regression/config-parsing-issue -# Description: Test for cronie-anacron-1.4.4-14.el6.x86_64 doesn't like -# Author: Jakub Prokes -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2015 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/cronie/Regression/config-parsing-issue -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: Jakub Prokes " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: Test for cronie-anacron-1.4.4-14.el6.x86_64 doesn't like" >> $(METADATA) - @echo "Type: Regression" >> $(METADATA) - @echo "TestTime: 5m" >> $(METADATA) - @echo "RunFor: cronie" >> $(METADATA) - @echo "Requires: cronie-anacron" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2+" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/config-parsing-issue/PURPOSE b/tests/config-parsing-issue/PURPOSE deleted file mode 100644 index fe80c7e..0000000 --- a/tests/config-parsing-issue/PURPOSE +++ /dev/null @@ -1,4 +0,0 @@ -PURPOSE of /CoreOS/cronie/Regression/config-parsing-issue -Description: Test for cronie-anacron-1.4.4-14.el6.x86_64 doesn't like -Author: Jakub Prokes -Bug summary: cronie-anacron-1.4.4-14.el6.x86_64 doesn't like its own /etc/anacrontab syntax diff --git a/tests/config-parsing-issue/runtest.sh b/tests/config-parsing-issue/runtest.sh deleted file mode 100644 index d95adab..0000000 --- a/tests/config-parsing-issue/runtest.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /CoreOS/cronie/Regression/config-parsing-issue -# Description: Test for cronie-anacron-1.4.4-14.el6.x86_64 doesn't like -# Author: Jakub Prokes -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2015 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="cronie-anacron" - -rlJournalStart - rlPhaseStartSetup - rlAssertRpm $PACKAGE - rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" - rlRun "pushd $TmpDir" - rlRun "grep '^SHELL' /etc/anacrontab"; - rlRun "grep '^PATH' /etc/anacrontab"; - rlRun "grep '^MAILTO' /etc/anacrontab"; - rlPhaseEnd - - rlPhaseStartTest - rlRun "anacron -T" - rlPhaseEnd - - rlPhaseStartCleanup - rlRun "popd" - rlRun "rm -r $TmpDir" 0 "Removing tmp directory" - rlPhaseEnd -rlJournalPrintText -rlJournalEnd diff --git a/tests/cron-daemon-fails-to-log-that-it-is-shutting-down/Makefile b/tests/cron-daemon-fails-to-log-that-it-is-shutting-down/Makefile deleted file mode 100644 index c4d85ea..0000000 --- a/tests/cron-daemon-fails-to-log-that-it-is-shutting-down/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /CoreOS/cronie/Regression/cron-daemon-fails-to-log-that-it-is-shutting-down -# Description: Test for cron daemon fails to log that it is shutting down. -# Author: Robin Hack -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2015 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/cronie/Regression/cron-daemon-fails-to-log-that-it-is-shutting-down -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: Robin Hack " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: Test for cron daemon fails to log that it is shutting down." >> $(METADATA) - @echo "Type: Regression" >> $(METADATA) - @echo "TestTime: 20m" >> $(METADATA) - @echo "RunFor: cronie" >> $(METADATA) - @echo "Requires: cronie" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2+" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/cron-daemon-fails-to-log-that-it-is-shutting-down/PURPOSE b/tests/cron-daemon-fails-to-log-that-it-is-shutting-down/PURPOSE deleted file mode 100644 index 4b459e8..0000000 --- a/tests/cron-daemon-fails-to-log-that-it-is-shutting-down/PURPOSE +++ /dev/null @@ -1,4 +0,0 @@ -PURPOSE of /CoreOS/cronie/Regression/cron-daemon-fails-to-log-that-it-is-shutting-down -Description: Test for cron daemon fails to log that it is shutting down. -Author: Robin Hack -Bug summary: cron daemon fails to log that it is shutting down. diff --git a/tests/cron-daemon-fails-to-log-that-it-is-shutting-down/runtest.sh b/tests/cron-daemon-fails-to-log-that-it-is-shutting-down/runtest.sh deleted file mode 100644 index 0aa147d..0000000 --- a/tests/cron-daemon-fails-to-log-that-it-is-shutting-down/runtest.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash -# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /CoreOS/cronie/Regression/cron-daemon-fails-to-log-that-it-is-shutting-down -# Description: Test for cron daemon fails to log that it is shutting down. -# Author: Robin Hack -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2015 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="cronie" - -rlJournalStart - rlPhaseStartSetup - rlAssertRpm $PACKAGE - rlServiceStop crond - rlPhaseEnd - - rlPhaseStartTest - start_time=$(timedatectl | grep "Local time" | awk '{print$4" "$5}') - rlServiceStart crond - sleep 20 - rlRun "journalctl --since \"$start_time\" | grep \"(CRON) INFO\"" 0 "cron startup" - rlServiceStop crond - # give dbus and cronie some time to shut down... - sleep 20 - rlRun "journalctl --since \"$start_time\" | grep \"(CRON) INFO (Shutting down)\"" 0 "cron shutdown" - # DEBUG - journalctl _COMM=cron --since="$start_time" - rlPhaseEnd - - rlPhaseStartCleanup - rlServiceRestore crond - #avoid systemd failing to start crond due start-limit - sleep 10 - rlPhaseEnd -rlJournalPrintText -rlJournalEnd diff --git a/tests/crond-is-missing-RELRO-flags/Makefile b/tests/crond-is-missing-RELRO-flags/Makefile deleted file mode 100644 index 87a9651..0000000 --- a/tests/crond-is-missing-RELRO-flags/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /CoreOS/cronie/Regression/crond-is-missing-RELRO-flags -# Description: Test for crond is missing RELRO flags -# Author: Martin Cermak -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2011 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/cronie/Regression/crond-is-missing-RELRO-flags -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: Martin Cermak " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: Test for crond is missing RELRO flags" >> $(METADATA) - @echo "Type: Regression" >> $(METADATA) - @echo "TestTime: 15m" >> $(METADATA) - @echo "RunFor: cronie" >> $(METADATA) - @echo "Requires: cronie elfutils" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/crond-is-missing-RELRO-flags/PURPOSE b/tests/crond-is-missing-RELRO-flags/PURPOSE deleted file mode 100644 index 1ea8ffc..0000000 --- a/tests/crond-is-missing-RELRO-flags/PURPOSE +++ /dev/null @@ -1,5 +0,0 @@ -PURPOSE of /CoreOS/cronie/Regression/crond-is-missing-RELRO-flags -Description: Test for crond is missing RELRO flags -Author: Martin Cermak -Bug summary: crond is missing RELRO flags - diff --git a/tests/crond-is-missing-RELRO-flags/runtest.sh b/tests/crond-is-missing-RELRO-flags/runtest.sh deleted file mode 100644 index c6b55df..0000000 --- a/tests/crond-is-missing-RELRO-flags/runtest.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /CoreOS/cronie/Regression/crond-is-missing-RELRO-flags -# Description: Test for crond is missing RELRO flags -# Author: Martin Cermak -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2011 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 || exit 1 -. /usr/share/beakerlib/beakerlib.sh || exit 1 - -PACKAGE="cronie" - -rlJournalStart - rlPhaseStartSetup - rlAssertRpm $PACKAGE - rlPhaseEnd - - rlPhaseStartTest - rlRun "eu-readelf -l /usr/sbin/crond | fgrep -q 'GNU_RELRO'" 0 "Binary was compiled with RELRO." - rlPhaseEnd -rlJournalEnd diff --git a/tests/crond-subtask-abnormal-termination-removes-pid-file-in-error/Makefile b/tests/crond-subtask-abnormal-termination-removes-pid-file-in-error/Makefile deleted file mode 100644 index 729126c..0000000 --- a/tests/crond-subtask-abnormal-termination-removes-pid-file-in-error/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /CoreOS/cronie/Regression/crond-subtask-abnormal-termination-removes-pid-file-in-error -# Description: Test for crond subtask abnormal termination removes pid -# Author: Robin Hack -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2015 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/cronie/Regression/crond-subtask-abnormal-termination-removes-pid-file-in-error -export TESTVERSION=1.0 - -BUILT_FILES= - -FILES=$(METADATA) runtest.sh Makefile PURPOSE crontab-job run-job.sh - -.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: Robin Hack " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: Test for crond subtask abnormal termination removes pid" >> $(METADATA) - @echo "Type: Regression" >> $(METADATA) - @echo "TestTime: 20m" >> $(METADATA) - @echo "RunFor: cronie" >> $(METADATA) - @echo "Requires: cronie" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2+" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/crond-subtask-abnormal-termination-removes-pid-file-in-error/PURPOSE b/tests/crond-subtask-abnormal-termination-removes-pid-file-in-error/PURPOSE deleted file mode 100644 index 3bc1db0..0000000 --- a/tests/crond-subtask-abnormal-termination-removes-pid-file-in-error/PURPOSE +++ /dev/null @@ -1,4 +0,0 @@ -PURPOSE of /CoreOS/cronie/Regression/crond-subtask-abnormal-termination-removes-pid-file-in-error -Description: Test for crond subtask abnormal termination removes pid -Author: Robin Hack -Bug summary: crond subtask abnormal termination removes pid file in error diff --git a/tests/crond-subtask-abnormal-termination-removes-pid-file-in-error/crontab-job b/tests/crond-subtask-abnormal-termination-removes-pid-file-in-error/crontab-job deleted file mode 100644 index 390ab9b..0000000 --- a/tests/crond-subtask-abnormal-termination-removes-pid-file-in-error/crontab-job +++ /dev/null @@ -1 +0,0 @@ -*/1 * * * * /tmp/run-job.sh diff --git a/tests/crond-subtask-abnormal-termination-removes-pid-file-in-error/run-job.sh b/tests/crond-subtask-abnormal-termination-removes-pid-file-in-error/run-job.sh deleted file mode 100644 index 265e8db..0000000 --- a/tests/crond-subtask-abnormal-termination-removes-pid-file-in-error/run-job.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -if [ -s /tmp/run-job.lock ]; then - exit 0 -fi - -echo $PPID > /tmp/run-job.lock -sleep 1234567 -exit 0 diff --git a/tests/crond-subtask-abnormal-termination-removes-pid-file-in-error/runtest.sh b/tests/crond-subtask-abnormal-termination-removes-pid-file-in-error/runtest.sh deleted file mode 100644 index caaa895..0000000 --- a/tests/crond-subtask-abnormal-termination-removes-pid-file-in-error/runtest.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/bash -# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /CoreOS/cronie/Regression/crond-subtask-abnormal-termination-removes-pid-file-in-error -# Description: Test for crond subtask abnormal termination removes pid -# Author: Robin Hack -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2015 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="cronie" - -rlJournalStart - rlPhaseStartSetup - rlAssertRpm $PACKAGE - - rlRun "cp ./run-job.sh /tmp/" - rlRun "chmod +x /tmp/run-job.sh" - rm -f /tmp/run-job.lock - - rlServiceStop crond - rlServiceStart crond - rlRun "crontab -u root ./crontab-job" - rlRun "sleep 60" 0 "Wait for cron job to run" - rlPhaseEnd - - rlPhaseStartTest - if [ -s /var/run/crond.pid ]; then - rlPass "Crond pid file exists"; - else - rlFail "Cront pid file doesn't exists or is empty" - fi - - # /tmp/run-job.lock contains PPID of my job - rlRun "kill -SIGTERM $(cat /tmp/run-job.lock)" - - # Cut and pasta! Check file again! - # We love boiler plate code in our tests! - if [ -s /var/run/crond.pid ]; then - rlPass "Crond pid file exists"; - else - rlFail "Cront pid file doesn't exists or is empty" - fi - rlPhaseEnd - - rlPhaseStartCleanup - killall sleep - crontab -u root -r - rm -f /tmp/run-job.sh - rm -f /tmp/run-job.lock - - rlServiceStop crond - rlServiceRestore crond - #avoid systemd failing to start crond due start-limit - sleep 10 - rlPhaseEnd -rlJournalPrintText -rlJournalEnd diff --git a/tests/cronie-jobs-environment/Makefile b/tests/cronie-jobs-environment/Makefile deleted file mode 100644 index c2a43a8..0000000 --- a/tests/cronie-jobs-environment/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /CoreOS/cronie/Regression/cronie-jobs-environment -# Description: testing EUID with jobs are executed and if LANG is correctly set -# Author: Jakub Prokes -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2013 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/cronie/Regression/cronie-jobs-environment -export TESTVERSION=1.0 - -BUILT_FILES= - -FILES=$(METADATA) runtest.sh Makefile PURPOSE libfaketime-0.9.1.tar.gz crontab.temp cron_test.sh - -.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: Jakub Prokes " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: testing EUID with jobs are executed and if LANG is correctly set" >> $(METADATA) - @echo "Type: Regression" >> $(METADATA) - @echo "TestTime: 10m" >> $(METADATA) - @echo "RunFor: cronie" >> $(METADATA) - @echo "Requires: cronie" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/cronie-jobs-environment/PURPOSE b/tests/cronie-jobs-environment/PURPOSE deleted file mode 100644 index 6ef4539..0000000 --- a/tests/cronie-jobs-environment/PURPOSE +++ /dev/null @@ -1,3 +0,0 @@ -PURPOSE of /CoreOS/cronie/Regression/cronie-jobs-environment -Description: testing EUID with jobs are executed and if LANG is correctly set -Author: Jakub Prokes diff --git a/tests/cronie-jobs-environment/cron_test.sh b/tests/cronie-jobs-environment/cron_test.sh deleted file mode 100644 index 6a82d15..0000000 --- a/tests/cronie-jobs-environment/cron_test.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -printf "LANG=$LANG\n" > /tmp/cronie-jobs-environment.log; -printf "EUID=$EUID\n" >> /tmp/cronie-jobs-environment.log; - diff --git a/tests/cronie-jobs-environment/crontab.temp b/tests/cronie-jobs-environment/crontab.temp deleted file mode 100644 index 643879d..0000000 --- a/tests/cronie-jobs-environment/crontab.temp +++ /dev/null @@ -1,12 +0,0 @@ -# Example of job definition: -# .---------------- minute (0 - 59) -# | .------------- hour (0 - 23) -# | | .---------- day of month (1 - 31) -# | | | .------- month (1 - 12) OR jan,feb,mar,apr ... -# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat -# | | | | | -# * * * * * command to be executed - -CRON_CORRECT_MAIL_HEADER=1 - -* * * * * %TMPDIR/cron_test.sh diff --git a/tests/cronie-jobs-environment/libfaketime-0.9.1.tar.gz b/tests/cronie-jobs-environment/libfaketime-0.9.1.tar.gz deleted file mode 100644 index 9913d21..0000000 Binary files a/tests/cronie-jobs-environment/libfaketime-0.9.1.tar.gz and /dev/null differ diff --git a/tests/cronie-jobs-environment/runtest.sh b/tests/cronie-jobs-environment/runtest.sh deleted file mode 100644 index c6d83ac..0000000 --- a/tests/cronie-jobs-environment/runtest.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /CoreOS/cronie/Regression/cronie-jobs-environment -# Description: testing EUID with jobs are executed and if LANG is correctly set -# Author: Jakub Prokes -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2013 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 Beaker environment -. /usr/bin/rhts-environment.sh || exit 1 -. /usr/share/beakerlib/beakerlib.sh || exit 1 - - -## Is nice to know when things going wrong -trap 'errorHandler ${LINENO}' ERR; -function errorHandler() { - local code="${?}"; - local lineNO="$1"; - - case $code in - 127) - rlFail "Command not found on line $lineNO" - ;; - *) - rlFail "Unhandled error $code near line $lineNO"; - ;; - esac -} - -function makeUser() { - local userName="$(tr -dc "[:lower:]" < /dev/urandom | head -c 5 | sed 's/^/qa_/')"; - while getent passwd $userName; do - userName="$(tr -dc "[:lower:]" < /dev/urandom | head -c 5 | sed 's/^/qa_/')"; - done - useradd -d $tmpDir $userName; - echo $userName; -} - - -PACKAGE="cronie" -declare -r LIBFAKETTIMEPACKAGE="libfaketime-0.9.1.tar.gz"; -declare -r LIBFAKETIME="libfaketime.so.1"; - -rlJournalStart - rlPhaseStartSetup "Setup test environment" - rlAssertRpm $PACKAGE - rlRun "tmpDir=\$(mktemp -d)" 0 "Creating tmp directory"; - testDir="$(pwd)"; - rlRun "chmod 755 $tmpDir" 0 "Setting permissions for tmp directory"; - ls -lahdZ $tmpDir; - rlRun "pushd $tmpDir" - testUser="$(makeUser)"; - rlRun "getent passwd $testUser" 0 "Test user $testUser created"; - rlServiceStop crond; - rlPhaseEnd - - rlPhaseStartSetup "Prepare libfaketime"; - rlRun "cp ${testDir}/$LIBFAKETTIMEPACKAGE ./" 0 "Get library sources"; - rlRun "tar -xvzf $LIBFAKETTIMEPACKAGE" 0 "Unpack library sources"; - pushd ${LIBFAKETTIMEPACKAGE%.tar.gz}; - rlRun "make &>/dev/null" 0 "Building library from sources"; - rlRun "cp ./src/$LIBFAKETIME ../" 0 "Coping library to working directory"; - popd; - LD_PRELOAD=./libfaketime.so.1 FAKETIME='1994-07-29 12:00:01' date +%G | { year="$(cat)"; [[ $year -eq 1994 ]]; }; - rlAssert0 "Library preloading working well" $?; - rlPhaseEnd - - rlPhaseStartSetup "Prepare tests"; - rlRun "sed 's#%TMPDIR#$tmpDir#' $testDir/crontab.temp > crontab.source" #0 "Crontab prepared from template"; - rlRun "crontab -u $testUser crontab.source" 0 "Set crontab for test user"; - crontab -lu $testUser; - rlRun "cp $testDir/cron_test.sh ./" 0 "Copyed script for cron job"; - rlRun "chmod a+x cron_test.sh" 0 "Permissions to executed set"; - rlRun "[[ -e /var/spool/mail/$testUser ]] && printf '' > /var/spool/mail/$testUser" 0 "Clean up mails" - rlLog "Execute crond with faked time"; - LD_PRELOAD=./libfaketime.so.1 FAKETIME='@1994-07-29 12:12:50' /usr/sbin/crond -n -x sch & - cronPID=$!; - pstree -Aph - rlRun "kill -0 $cronPID" 0 "crond is running"; - rlLog "Security timeout for 30 sec to ensure all configs are loaded and crontab is succesfully processed"; - sleep 30; - rlPhaseEnd - - rlPhaseStartTest "cronie drops \$LANG and never passes it on to jobs run" - rlRun "[[ $(sed -n '/^LANG/s/LANG=//p' /tmp/cronie-jobs-environment.log) = $LANG ]]" 0 "LANG is set" - rlPhaseEnd - - rlPhaseStartTest "cronie doesn't drop privileges before popen" - rlRun "[[ $(sed -n '/^EUID/s/EUID=//p' /tmp/cronie-jobs-environment.log) -eq $(id -u $testUser) ]]" 0 \ - "Crontab is executed with correct EUID"; - rlPhaseEnd - - rlPhaseStartCleanup - rlRun "kill $cronPID" 0 "Terminating crond" - rlRun "crontab -ru $testUser" 0 "Crontab removed" - rlRun "popd" - rlRun "rm -r $tmpDir" 0 "Removing tmp directory" - rlRun "userdel -rf $testUser"; - rlServiceRestore crond; - #avoid systemd failing to start crond due start-limit - sleep 10 - rlPhaseEnd -rlJournalPrintText -rlJournalEnd diff --git a/tests/crontab-can-invoke-lookup-for-nonexisted-user/Makefile b/tests/crontab-can-invoke-lookup-for-nonexisted-user/Makefile deleted file mode 100644 index 78b55ab..0000000 --- a/tests/crontab-can-invoke-lookup-for-nonexisted-user/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /CoreOS/cronie/Regression/crontab-can-invoke-lookup-for-nonexisted-user -# Description: Test for Cron does uid lookups for non-existent users -# Author: Jakub Prokes -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# 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/. -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -export TEST=/CoreOS/cronie/Regression/crontab-can-invoke-lookup-for-nonexisted-user -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: Jakub Prokes " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: Test for Cron does uid lookups for non-existent users" >> $(METADATA) - @echo "Type: Regression" >> $(METADATA) - @echo "TestTime: 10m" >> $(METADATA) - @echo "RunFor: cronie" >> $(METADATA) - @echo "Requires: cronie" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2+" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/crontab-can-invoke-lookup-for-nonexisted-user/PURPOSE b/tests/crontab-can-invoke-lookup-for-nonexisted-user/PURPOSE deleted file mode 100644 index 056f3fb..0000000 --- a/tests/crontab-can-invoke-lookup-for-nonexisted-user/PURPOSE +++ /dev/null @@ -1,4 +0,0 @@ -PURPOSE of /CoreOS/cronie/Regression/crontab-can-invoke-lookup-for-nonexisted-user -Description: Test for Cron does uid lookups for non-existent users -Author: Jakub Prokes -Bug summary: Cron does uid lookups for non-existent users diff --git a/tests/crontab-can-invoke-lookup-for-nonexisted-user/runtest.sh b/tests/crontab-can-invoke-lookup-for-nonexisted-user/runtest.sh deleted file mode 100644 index 7387dd1..0000000 --- a/tests/crontab-can-invoke-lookup-for-nonexisted-user/runtest.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/bash -# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k ft=beakerlib -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /CoreOS/cronie/Regression/crontab-can-invoke-lookup-for-nonexisted-user -# Description: Test for Cron does uid lookups for non-existent users -# Author: Jakub Prokes -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# 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/bin/rhts-environment.sh || exit 1 -. /usr/share/beakerlib/beakerlib.sh || exit 1 - -PACKAGE="cronie" -declare -ri EXIT_FAILURE=1; -declare -ri EXIT_SUCCESS=0; -declare -r reportAllErrors=no; - -function isTrue() { - local string="$@"; - local oldOpt="shopt -p nocasematch"; - local -i rc=1; - - shopt -s nocasematch; - [[ -z "$string" ]] && return 1; - - case $string in - yes) rc=0;; - true) rc=0;; - ano) rc=0;; - 1) rc=0;; - jo) rc=0;; - yeah) rc=0;; - y) rc=0;; - a) rc=0;; - esac; - eval $oldOpt; - return $rc; -} - -## Is nice to know when things going wrong -function errorHandler() { - local code="${?}"; - local lineNO="$1"; - - case $code in - 127) - rlFail "Command not found on line $lineNO" - ;; - *) - isTrue $reportAllErrors && rlFail "Unhandled error $code near line $lineNO"; - ;; - esac -} - - -rlJournalStart - trap 'errorHandler ${LINENO}' ERR; - rlPhaseStart FAIL "Setup" - rlAssertRpm $PACKAGE; - rlRun "rlServiceStop 'crond'" - echo > /var/log/cron - rlRun "rlServiceStart 'crond'" - rlPhaseEnd - - rlPhaseStartTest - rlRun "sleep 61 | crontab -" & - sleep 5 - fileName="$(ls /var/spool/cron/ | grep 'tmp' | head -n 1)"; - ls -lah /var/spool/cron/; - rlRun "[[ -n '$fileName' ]]" 0 "$fileName found"; - rlRun "wait"; - rlRun "grep 'ORPHAN' /var/log/cron | grep '$fileName'" 1 ; - tail -n 20 /var/log/cron; - rlPhaseEnd - - rlPhaseStart WARN "Cleanup" - rlRun "rlServiceRestore 'crond'" - #avoid systemd failing to start crond due start-limit - sleep 10 - rlPhaseEnd - rlJournalPrintText - trap - ERR; -rlJournalEnd diff --git a/tests/crontab-has-wrong-permissions/Makefile b/tests/crontab-has-wrong-permissions/Makefile deleted file mode 100644 index fd02095..0000000 --- a/tests/crontab-has-wrong-permissions/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /CoreOS/cronie/Regression/crontab-has-wrong-permissions -# Description: What the test does -# Author: Jakub Prokes -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2013 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/cronie/Regression/crontab-has-wrong-permissions -export TESTVERSION=1.1 - -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: Jakub Prokes " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: What the test does" >> $(METADATA) - @echo "Type: Regression" >> $(METADATA) - @echo "TestTime: 5m" >> $(METADATA) - @echo "RunFor: cronie" >> $(METADATA) - @echo "Requires: cronie" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/crontab-has-wrong-permissions/PURPOSE b/tests/crontab-has-wrong-permissions/PURPOSE deleted file mode 100644 index 61f54cb..0000000 --- a/tests/crontab-has-wrong-permissions/PURPOSE +++ /dev/null @@ -1,3 +0,0 @@ -PURPOSE of /CoreOS/cronie/Regression/crontab-has-wrong-permissions -Description: What the test does -Author: Jakub Prokes diff --git a/tests/crontab-has-wrong-permissions/runtest.sh b/tests/crontab-has-wrong-permissions/runtest.sh deleted file mode 100644 index 6a72dd2..0000000 --- a/tests/crontab-has-wrong-permissions/runtest.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash -# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /CoreOS/cronie/Regression/crontab-has-wrong-permissions -# Description: What the test does -# Author: Jakub Prokes -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2013 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 Beaker environment -. /usr/bin/rhts-environment.sh || exit 1 -. /usr/share/beakerlib/beakerlib.sh || exit 1 - -PACKAGES="cronie vixie-cron" - -function myAssertRpms() { - rlRun "rpm -q $*" $((${#@}-1)) "One of required packages was found"; -} - - -rlJournalStart - rlPhaseStartSetup - myAssertRpms $PACKAGES - rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" - rlRun "pushd $TmpDir" - rlPhaseEnd - - rlPhaseStartTest - rlRun "[[ $(stat /usr/bin/crontab -c \"%a\") -eq 4755 ]]" - rlPhaseEnd - - rlPhaseStartCleanup - rlRun "popd" - rlRun "rm -r $TmpDir" 0 "Removing tmp directory" - rlPhaseEnd -rlJournalPrintText -rlJournalEnd diff --git a/tests/echos-OK-twice-in-init-script/Makefile b/tests/echos-OK-twice-in-init-script/Makefile deleted file mode 100644 index dec6383..0000000 --- a/tests/echos-OK-twice-in-init-script/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /CoreOS/cronie/Regression/echos-OK-twice-in-init-script -# Description: Test for echos "OK" twice in init script -# Author: Martin Cermak -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2011 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/cronie/Regression/echos-OK-twice-in-init-script -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: Martin Cermak " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: Test for echos \"OK\" twice in init script" >> $(METADATA) - @echo "Type: Regression" >> $(METADATA) - @echo "TestTime: 15m" >> $(METADATA) - @echo "RunFor: cronie" >> $(METADATA) - @echo "Requires: cronie" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/echos-OK-twice-in-init-script/PURPOSE b/tests/echos-OK-twice-in-init-script/PURPOSE deleted file mode 100644 index 9a334d7..0000000 --- a/tests/echos-OK-twice-in-init-script/PURPOSE +++ /dev/null @@ -1,4 +0,0 @@ -PURPOSE of /CoreOS/cronie/Regression/echos-OK-twice-in-init-script -Description: Test for echos "OK" twice in init script -Author: Martin Cermak - diff --git a/tests/echos-OK-twice-in-init-script/runtest.sh b/tests/echos-OK-twice-in-init-script/runtest.sh deleted file mode 100644 index 54afa80..0000000 --- a/tests/echos-OK-twice-in-init-script/runtest.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash -# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /CoreOS/cronie/Regression/echos-OK-twice-in-init-script -# Description: Test for echos "OK" twice in init script -# Author: Martin Cermak -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2011 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/lib/beakerlib/beakerlib.sh - -PACKAGE="cronie" - -rlJournalStart - rlPhaseStartSetup - rlAssertRpm $PACKAGE - rlRun "TEMPDIR=\`mktemp -d\`" 0 "Creating tmp directory" - rlRun "pushd $TEMPDIR" - - rlFileBackup "/etc/rc.d/init.d/crond" - rlServiceStop crond - -cat > /etc/rc.d/init.d/functions2 <> $TEMPDIR/log.txt -} -EOF1 - rlRun "cat /etc/rc.d/init.d/functions2" - - sed -i "s/^\..*$/\0\n\. \/etc\/rc\.d\/init\.d\/functions2/" /etc/rc.d/init.d/crond - rlRun "grep ^\\\. /etc/rc.d/init.d/crond" - rlPhaseEnd - - rlPhaseStartTest - rlAssertNotExists log.txt - rlServiceStart crond - rlAssertExists log.txt - - rlRun "TIMES_PRINTED_OK=`grep OK log.txt | wc -l`" - rlRun "test $TIMES_PRINTED_OK -eq 1" - - rlServiceStop crond - rlPhaseEnd - - rlPhaseStartCleanup - rlBundleLogs TESTLOGS /etc/rc.d/init.d/functions2 /etc/rc.d/init.d/crond - rlRun "rm -f /etc/rc.d/init.d/functions2" - rlFileRestore - rlServiceRestore crond - rlRun "popd" - rlRun "rm -r $TEMPDIR" 0 "Removing tmp directory" - #avoid systemd failing to start crond due start-limit - sleep 10 - rlPhaseEnd -rlJournalEnd diff --git a/tests/init-script-failure/Makefile b/tests/init-script-failure/Makefile deleted file mode 100644 index 49b556c..0000000 --- a/tests/init-script-failure/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /CoreOS/cronie/Regression/init-script-failure -# Description: Testing some init script failures -# Author: Jakub Prokes -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2013 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/cronie/Regression/init-script-failure -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: Jakub Prokes " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: Testing some init script failures" >> $(METADATA) - @echo "Type: Regression" >> $(METADATA) - @echo "TestTime: 5m" >> $(METADATA) - @echo "RunFor: cronie" >> $(METADATA) - @echo "Requires: cronie" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/init-script-failure/PURPOSE b/tests/init-script-failure/PURPOSE deleted file mode 100644 index 81de15d..0000000 --- a/tests/init-script-failure/PURPOSE +++ /dev/null @@ -1,3 +0,0 @@ -PURPOSE of /CoreOS/cronie/Regression/init-script-failure -Description: Testing some init script failures -Author: Jakub Prokes diff --git a/tests/init-script-failure/runtest.sh b/tests/init-script-failure/runtest.sh deleted file mode 100644 index c0f6d02..0000000 --- a/tests/init-script-failure/runtest.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash -# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /CoreOS/cronie/Regression/init-script-failure -# Description: Testing some init script failures -# Author: Jakub Prokes -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2013 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 Beaker environment -. /usr/bin/rhts-environment.sh || exit 1 -. /usr/share/beakerlib/beakerlib.sh || exit 1 - -PACKAGE="cronie" - -function makeUser() { - local userName="$(tr -dc "[:lower:]" < /dev/urandom | head -c 5 | sed 's/^/qa_/')"; - while getent passwd $userName; do - userName="$(tr -dc "[:lower:]" < /dev/urandom | head -c 5 | sed 's/^/qa_/')"; - done - useradd -d $tmpDir $userName; - echo $userName; -} - -rlJournalStart - rlPhaseStartSetup - rlAssertRpm $PACKAGE - rlServiceStop crond - rlRun "tmpDir=\$(mktemp -d)" 0 "Creating tmp directory"; - testUser="$(makeUser)"; - rlPhaseEnd - - rlPhaseStartTest "Service restart needlessly reports failure" - rlRun -s "service crond restart" - rlAssertNotGrep "FAILED" $rlRun_LOG - rlPhaseEnd - - if ! rpm -q systemd &>/dev/null; then - rlPhaseStartTest "Check service restart exit code" - su -l $testUser -c "service crond restart"; - rlAssertEquals "Expected result of call initscript by unprivileged user is 4" $? 4 - rlPhaseEnd - fi - - rlPhaseStartCleanup - rm -f $rlRun_LOG - rm -rf $tmpDir; - userdel -rf $testUser; - rlServiceRestore crond - #avoid systemd failing to start crond due start-limit - sleep 10 - rlPhaseEnd -rlJournalPrintText -rlJournalEnd diff --git a/tests/init-scripts-LSB/Makefile b/tests/init-scripts-LSB/Makefile deleted file mode 100644 index 712f909..0000000 --- a/tests/init-scripts-LSB/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /CoreOS/cronie/Sanity/init-script-LSB -# Description: Init script should meet LSB specifications -# Author: Yulia Kopkova -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2009 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/cronie/Sanity/init-script-LSB -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: Petr Sklenar " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: Init script should meet LSB specifications" >> $(METADATA) - @echo "Type: Sanity" >> $(METADATA) - @echo "TestTime: 5m" >> $(METADATA) - @echo "RunFor: cronie" >> $(METADATA) - @echo "Requires: cronie" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - rhts-lint $(METADATA) diff --git a/tests/init-scripts-LSB/PURPOSE b/tests/init-scripts-LSB/PURPOSE deleted file mode 100644 index 26efe1c..0000000 --- a/tests/init-scripts-LSB/PURPOSE +++ /dev/null @@ -1,3 +0,0 @@ -PURPOSE of /CoreOS/cronie/Sanity/init-script-LSB -Description: Init script should meet LSB specifications -Author: Yulia Kopkova diff --git a/tests/init-scripts-LSB/runtest.sh b/tests/init-scripts-LSB/runtest.sh deleted file mode 100644 index 7b72ea7..0000000 --- a/tests/init-scripts-LSB/runtest.sh +++ /dev/null @@ -1,186 +0,0 @@ -#!/bin/bash -# vim: dict=/usr/share/rhts-library/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /CoreOS/cronie/Sanity/init-script-LSB -# Description: Init script should meet LSB specifications -# Author: Jan Scotka , Yulia Kopkova -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2009 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/rhts-library/rhtslib.sh - -PACKAGE="cronie" - -SERVICE="crond"; -reportAllErrors=no; - -function isTrue() { - local string="$@"; - local oldOpt="shopt -p nocasematch"; - local -i rc=1; - - shopt -s nocasematch; - [[ -z "$string" ]] && return 1; - - case $string in - yes) rc=0;; - true) rc=0;; - ano) rc=0;; - 1) rc=0;; - jo) rc=0;; - yeah) rc=0;; - y) rc=0;; - a) rc=0;; - esac; - eval $oldOpt; - return $rc; -} - -isTrue no && echo Yes || echo No; - -## Is nice to know when things going wrong -function errorHandler() { - local code="${?}"; - local lineNO="$1"; - - case $code in - 127) - rlFail "Command not found on line $lineNO" - ;; - *) - isTrue $reportAllErrors && rlFail "Unhandled error $code near line $lineNO"; - ;; - esac -} - -function getUserName() { - local userName="qa_$(tr -dc "[:lower:]" < /dev/urandom | head -c 5)"; - echo "$userName" >&2;⏎ - if getent passwd $userName &>/dev/null; then - getUserName; - return $? - fi - if [[ -n "$userName" ]]; then - echo "$userName"; - return $EXIT_SUCCESS; - else - return $EXIT_FAILURE; - fi -} - - -rlJournalStart -trap 'errorHandler ${LINENO}' ERR; - rlPhaseStartSetup - rlAssertRpm $PACKAGE - rlRun "tmpDir=\$(mktemp -d)" 0 "Creating tmp directory"; - testUser="$(getUserName || rlDie "Cannot get username")" - rlLog "${testUser}" - rlRun "useradd -d $tmpDir $testUser"; - pushd $tmpDir; - rlServiceStop $SERVICE - rlPhaseEnd - - rlPhaseStartTest "starts the service" - rlRun "service $SERVICE start" 0 " Service must start without problem" - rlRun "service $SERVICE status" 0 " Then Status command " - rlRun "service $SERVICE start" 0 " Already started service " - rlRun "service $SERVICE status" 0 " Again status command " - rlPhaseEnd - - rlPhaseStartTest "restart the service" - firstPid=$(ps h -C $SERVICE -o pid); - rlRun "service $SERVICE restart" 0 " Restarting of service" - rlRun "service $SERVICE status" 0 " Status command " - secondPid=$(ps h -C $SERVICE -o pid); - rlRun "[[ -n $firstPid ]] && [[ -n $secondPid ]] && [[ $firstPid -ne $secondPid ]]" 0 \ - "Pids are different after restart"; - rlPhaseEnd - - rlPhaseStartTest "stop the service" - rlRun "service $SERVICE stop" 0 " Stopping service " - rlRun "service $SERVICE status" 3 " Status of stopped service " || true - rlRun "service $SERVICE stop" 0 " Stopping service again " - rlRun "service $SERVICE status" 3 " Status of stopped service " || true - rlPhaseEnd - - if ! rlIsRHEL ">=7"; then - rlPhaseStartTest "pid file" - rlServiceStart $SERVICE - rlAssertExists "/var/run/$SERVICE.pid" "Pid file /var/run/$SERVICE.pid must exist" - sleep 1 - rlRun "kill -9 `pidof crond`" 0 "Kill $SERVICE" - sleep 10 - rlRun "service $SERVICE status" 1 " Existing pid file, but service not started " || true; - sleep 1 - rlRun "rm -fv /var/run/$SERVICE.pid" 0 "Remove .pid file" - rlPhaseEnd - - rlPhaseStartTest "lock file" - rlAssertExists "/var/lock/subsys/$SERVICE" "Lock file /var/lock/subsys/$SERVICE must exist" - rlRun "service $SERVICE status" 2 " Existing lock file, but service not started " || true; - rlServiceStop $SERVICE - rlPhaseEnd - fi - - rlPhaseStartTest "insufficient rights" - rlRun "service $SERVICE start " 0 " Starting service for restarting under nonpriv user " - rlRun "su $testUser -c 'service $SERVICE restart'" \ - $(rpm -q systemd &>/dev/null && echo 1 || echo 4) \ - "Insufficient rights, restarting service under nonprivileged user must fail"; - rlPhaseEnd - - rlPhaseStartTest "operations" - rlRun "service $SERVICE start" 0 " Service have to implement start function " - rlRun "service $SERVICE restart" 0 " Service have to implement restart function " - rlRun "service $SERVICE status" 0 " Service have to implement status function " - rlRun "service $SERVICE reload" 0 " Service have to implement reload function " - rlRun "service $SERVICE force-reload" 0 " Service have to implement force-reload function " - rlRun "service $SERVICE condrestart" 0 " Service have to implement condrestart function " - if ! rlIsRHEL ">=7"; then - rlRun "service $SERVICE try-restart" 0 " Service have to implement try-restart function " - fi - rlPhaseEnd - - rlPhaseStartTest "nonexisting operations" - rlRun "service $SERVICE noexistop" 2 " Testing proper return code when nonexisting function"; - rlRun "service $SERVICE stopex" 2 " Testing proper return code when nonexisting function"; - rlRun "service $SERVICE foo" 2 " Testing proper return code when nonexisting function" || true - rlPhaseEnd - - rlPhaseEnd - - rlPhaseStartCleanup - rlServiceRestore $SERVICE - rlRun "getent passwd $testUser"; - popd tmpDir; - rlRun "userdel -fr $testUser" 0 "Remove test user"; -# rlRun "rm -rf $testDir"; - #avoid systemd failing to start crond due start-limit - sleep 10 - rlPhaseEnd - -rlJournalPrintText -trap - ERR; -rlJournalEnd diff --git a/tests/ldap-users/Makefile b/tests/ldap-users/Makefile deleted file mode 100644 index e1967a1..0000000 --- a/tests/ldap-users/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /CoreOS/cronie/Regression/ldap-users -# Description: Test for cronie not creating jobs for ldap users if ldap -# Author: Jakub Prokes -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# 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/. -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -export TEST=/CoreOS/cronie/Regression/ldap-users -export TESTVERSION=1.0 - -BUILT_FILES= - -FILES=$(METADATA) runtest.sh Makefile PURPOSE data.ldif slapd.conf user1.cron - -.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: Jakub Prokes " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: Test for cronie not creating jobs for ldap users if ldap" >> $(METADATA) - @echo "Type: Regression" >> $(METADATA) - @echo "TestTime: 10m" >> $(METADATA) - @echo "RunFor: cronie openldap" >> $(METADATA) - @echo "Requires: cronie authconfig openldap openldap-servers openldap-clients sssd sssd-ldap" >> $(METADATA) - @echo "RhtsRequires: library(authconfig/basic)" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2+" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/ldap-users/PURPOSE b/tests/ldap-users/PURPOSE deleted file mode 100644 index 786822b..0000000 --- a/tests/ldap-users/PURPOSE +++ /dev/null @@ -1,5 +0,0 @@ -PURPOSE of /CoreOS/cronie/Regression/ldap-users -Description: Test for cronie not creating jobs for ldap users if ldap -Author: Jakub Prokes -Bug summary: cronie not creating jobs for ldap users if ldap server is temporarily down. - diff --git a/tests/ldap-users/data.ldif b/tests/ldap-users/data.ldif deleted file mode 100644 index 9d8836a..0000000 --- a/tests/ldap-users/data.ldif +++ /dev/null @@ -1,26 +0,0 @@ -dn: dc=foo,dc=bar,dc=com -dc: foo -objectClass: top -objectClass: domain - -dn: ou=people,dc=foo,dc=bar,dc=com -ou: people -objectClass: top -objectClass: organizationalUnit - -dn: uid=user1,ou=people,dc=foo,dc=bar,dc=com -uid: user1 -cn: user1 -objectClass: account -objectClass: posixAccount -objectClass: top -objectClass: shadowAccount -userPassword: {CRYPT}hebc0ErNA0uXY -shadowLastChange: 14460 -shadowMax: 99999 -shadowWarning: 7 -loginShell: /bin/bash -uidNumber: 1001 -gidNumber: 1000 -homeDirectory: /home/ldap/user1 -gecos: user1 diff --git a/tests/ldap-users/runtest.sh b/tests/ldap-users/runtest.sh deleted file mode 100644 index 4de269b..0000000 --- a/tests/ldap-users/runtest.sh +++ /dev/null @@ -1,133 +0,0 @@ -#!/bin/bash -# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /CoreOS/cronie/Regression/ldap-users -# Description: Test for cronie not creating jobs for ldap users if ldap -# Author: Jakub Prokes -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# 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/bin/rhts-environment.sh || exit 1 -. /usr/share/beakerlib/beakerlib.sh || exit 1 - -PACKAGE="cronie" - -rlJournalStart - rlPhaseStart FAIL "General Setup" - rlAssertRpm $PACKAGE - rlRun "tmpDir=\$(mktemp -d)" 0 "Creating tmp directory" - rlRun "testDir=\"$(pwd)\"" - rlRun "pushd $tmpDir" - rlRun "rlImport --all" - rlServiceStart "crond" - rlFileBackup /var/log/cron - echo > /var/log/cron - /bin/kill -HUP $(cat /var/run/syslogd.pid) - rlRun "getent passwd user1" 2 - rlPhaseEnd - - rlPhaseStart FAIL "LDAP Server Setup" - rlServiceStop "slapd" - rlFileBackup --clean "/etc/openldap" - rlFileBackup --clean "/var/run/openldap" - rlFileBackup --clean "/var/lib/ldap" - rlRun "rm -rf /etc/openldap/slapd.d/* /var/lib/ldap/* /var/run/openldap/*" 0 "Cleaning LDAP directories" - rlRun "slapadd -l ${testDir}/data.ldif -f ${testDir}/slapd.conf" 0 "Importing testing user into LDAP" - rlRun "chown ldap:ldap /var/run/openldap/*" 0 "Fixing permissions on '/var/run/openldap/*'" - rlRun "restorecon -Rv /etc/" 0 "Fixing SELinux contexts" - rlRun "slaptest -f ${testDir}/slapd.conf -F /etc/openldap/slapd.d" 0 "Importing LDAP configuration" - rlRun "chown -R ldap:ldap /etc/openldap/slapd.d" 0 "Fixing permissions on '/etc/openldap/slapd.d'" - rlServiceStart "slapd" - rlPhaseEnd - - rlPhaseStart FAIL "LDAP auth setup" - rlServiceStop "sssd" - rlRun "authconfig_setup" - rlRun "authconfig --savebackup=CoreOS_cronie_Regression_ldap-users" - rlRun "authconfig --enableldap --enableldapauth --ldapserver=ldap://127.0.0.1/ \ - --ldapbasedn=dc=foo,dc=bar,dc=com --update" - rlRun "getent passwd user1" - rlRun "mkdir -p /home/ldap/user1" - rlRun "chown user1 /home/ldap/user1" - rlPhaseEnd - - rlPhaseStartTest - rlRun "su user1 -c 'crontab ${testDir}/user1.cron'" 0 "Creating user cronjob" && \ - cat ${testDir}/user1.cron; - rlFileBackup /etc/crontab - rlRun "rlServiceStop slapd" - rlRun "service sssd stop" - rlRun "rm -rf /var/lib/sss/db/*" - rlRun "service sssd start" - rlRun "getent passwd user1" 2 - rlRun "echo \"* * * * * user1 /bin/echo foo > /tmp/cron.out\" > /etc/crontab" 0 \ - "Create record in system crontab" - cat /etc/crontab - rlRun "service crond restart" - rlRun "rlServiceStart slapd" - rlRun "service sssd stop" - rlRun "rm -rf /var/lib/sss/db/*" - rlRun "service sssd start" - waitCounter=60; - echo "Waiting for LDAP" - while ! getent passwd user1; do - sleep 1; - echo -n . - [[ waitCounter -le 0 ]] && break; - waitCounter=$((waitCounter-1)); - done - echo; - rlRun "getent passwd user1" - rm -f /home/ldap/user1/cron.out - echo "Waiting for cronjob execution" - sleep 65; - if rlRun "[[ -f /home/ldap/user1/cron.out ]]" 0 "User cronjob executed successfully"; then - rlAssertGrep "foo" /home/ldap/user1/cron.out; - fi - if rlRun "[[ -f /tmp/cron.out ]]" 0 "Crontab cronjob executed successfully"; then - rlAssertGrep "foo" /tmp/cron.out; - fi - rlRun "service crond stop" - cat /var/log/cron - rlPhaseEnd - - rlPhaseStart WARN "Cleanup" - rlRun "service crond restart" - rlRun "crontab -r -u user1" - rlRun "rlServiceStop slapd" - rlRun "authconfig --disableldap --disableldapauth --update" - rlRun "authconfig --restorebackup=CoreOS_cronie_Regression_ldap-users" - rlRun "authconfig_cleanup" - rlRun "popd" - rlRun "rm -r $tmpDir" 0 "Removing tmp directory" - rlRun "rm -r /home/ldap/user1" - rlRun "rm -r /home/ldap" - rlFileRestore - rlServiceRestore slapd - rlServiceRestore sssd - /bin/kill -HUP $(cat /var/run/syslogd.pid) - rlServiceRestore crond - #avoid systemd failing to start crond due start-limit - sleep 10 - rlPhaseEnd -rlJournalPrintText -rlJournalEnd diff --git a/tests/ldap-users/slapd.conf b/tests/ldap-users/slapd.conf deleted file mode 100644 index 97b3c2d..0000000 --- a/tests/ldap-users/slapd.conf +++ /dev/null @@ -1,32 +0,0 @@ -include /etc/openldap/schema/core.schema -include /etc/openldap/schema/cosine.schema -include /etc/openldap/schema/inetorgperson.schema -include /etc/openldap/schema/nis.schema - -allow bind_v2 - -pidfile /var/run/openldap/slapd.pid -argsfile /var/run/openldap/slapd.args - -database bdb -suffix "dc=foo,dc=bar,dc=com" -rootdn "cn=admin,dc=foo,dc=bar,dc=com" - -# Password is 'x'. -rootpw {SSHA}GPhzu7pTYP4I+nGeujpBkODiPxX0v8n8 - -directory /var/run/openldap/ - -index objectClass eq,pres -index ou,cn,mail,surname,givenname eq,pres,sub -index uidNumber,gidNumber,loginShell eq,pres -index uid,memberUid eq,pres,sub -index nisMapName,nisMapEntry eq,pres,sub -index entryCSN,entryUUID eq - -access to attrs=shadowLastChange,userPassword - by self write - by * auth - -access to * - by * read diff --git a/tests/ldap-users/user1.cron b/tests/ldap-users/user1.cron deleted file mode 100644 index 20d07a4..0000000 --- a/tests/ldap-users/user1.cron +++ /dev/null @@ -1,10 +0,0 @@ -# Example of job definition: -# .---------------- minute (0 - 59) -# | .------------- hour (0 - 23) -# | | .---------- day of month (1 - 31) -# | | | .------- month (1 - 12) OR jan,feb,mar,apr ... -# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat -# | | | | | -# * * * * * command to be executed - - * * * * * /bin/echo foo > $HOME/cron.out diff --git a/tests/only-one-running-instance-in-time/Makefile b/tests/only-one-running-instance-in-time/Makefile deleted file mode 100644 index 25272de..0000000 --- a/tests/only-one-running-instance-in-time/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /CoreOS/cronie/Regression/only-one-running-instance-in-time -# Description: When crond is running in multiple instance, then cron jobs are executed multiple times. Is neccesary to prevent multiple instances of crond running in time. -# Author: Jakub Prokes -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2013 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/cronie/Regression/only-one-running-instance-in-time -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: Jakub Prokes " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: When crond is running in multiple instance, then cron jobs are executed multiple times. Is neccesary to prevent multiple instances of crond running in time." >> $(METADATA) - @echo "Type: Regression" >> $(METADATA) - @echo "TestTime: 5m" >> $(METADATA) - @echo "RunFor: cronie" >> $(METADATA) - @echo "Requires: cronie" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/only-one-running-instance-in-time/PURPOSE b/tests/only-one-running-instance-in-time/PURPOSE deleted file mode 100644 index 7928fc9..0000000 --- a/tests/only-one-running-instance-in-time/PURPOSE +++ /dev/null @@ -1,3 +0,0 @@ -PURPOSE of /CoreOS/cronie/Regression/only-one-running-instance-in-time -Description: When crond is running in multiple instance, then cron jobs are executed multiple times. Is neccesary to prevent multiple instances of crond running in time. -Author: Jakub Prokes diff --git a/tests/only-one-running-instance-in-time/runtest.sh b/tests/only-one-running-instance-in-time/runtest.sh deleted file mode 100644 index 7d7e8cb..0000000 --- a/tests/only-one-running-instance-in-time/runtest.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash -# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /CoreOS/cronie/Regression/only-one-running-instance-in-time -# Description: When crond is running in multiple instance, then cron jobs are executed multiple times. Is neccesary to prevent multiple instances of crond running in time. -# Author: Jakub Prokes -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2013 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 Beaker environment -. /usr/bin/rhts-environment.sh || exit 1 -. /usr/share/beakerlib/beakerlib.sh || exit 1 - -PACKAGE="cronie" - -rlJournalStart - rlPhaseStartSetup - rlServiceStart crond - rlPhaseEnd - - rlPhaseStartTest - rlRun "kill -0 $(cat /var/run/crond.pid)" 0 "Service crond is running"; - rlRun "/usr/sbin/crond" 1 "Executing another instance fail"; - rlAssertEquals "There is stil one instance of crond" $(ps h -C crond -o pid | wc -l) 1; - rlPhaseEnd - - rlPhaseStartCleanup - rlServiceRestore crond - #avoid systemd failing to start crond due start-limit - sleep 10 - rlPhaseEnd -rlJournalPrintText -rlJournalEnd diff --git a/tests/run-with-syslog-flag/Makefile b/tests/run-with-syslog-flag/Makefile deleted file mode 100644 index bc16c08..0000000 --- a/tests/run-with-syslog-flag/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /CoreOS/cronie/Regression/run-with-syslog-flag -# Description: Test for cronie has a bug when run with syslog flag -# Author: Jakub Prokes -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# 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/. -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -export TEST=/CoreOS/cronie/Regression/run-with-syslog-flag -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: Jakub Prokes " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: Test for cronie has a bug when run with syslog flag" >> $(METADATA) - @echo "Type: Regression" >> $(METADATA) - @echo "TestTime: 10m" >> $(METADATA) - @echo "RunFor: cronie" >> $(METADATA) - @echo "Requires: cronie rsyslog" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2+" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/run-with-syslog-flag/PURPOSE b/tests/run-with-syslog-flag/PURPOSE deleted file mode 100644 index bd80d4b..0000000 --- a/tests/run-with-syslog-flag/PURPOSE +++ /dev/null @@ -1,4 +0,0 @@ -PURPOSE of /CoreOS/cronie/Regression/run-with-syslog-flag -Description: Test for cronie has a bug when run with syslog flag -Author: Jakub Prokes -Bug summary: cronie has a bug when run with syslog flag diff --git a/tests/run-with-syslog-flag/runtest.sh b/tests/run-with-syslog-flag/runtest.sh deleted file mode 100644 index 1770208..0000000 --- a/tests/run-with-syslog-flag/runtest.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/bash -# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /CoreOS/cronie/Regression/run-with-syslog-flag -# Description: Test for cronie has a bug when run with syslog flag -# Author: Jakub Prokes -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# 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/bin/rhts-environment.sh || exit 1 -. /usr/share/beakerlib/beakerlib.sh || exit 1 - -PACKAGE="cronie" -declare -r sysConfig="/etc/sysconfig/crond"; -declare -r cronJobFile=/etc/cron.d/testjob - -rlJournalStart - rlPhaseStart FAIL "Setup" - ## nasty hack for journalctl - export PAGER="" - rlAssertRpm $PACKAGE - rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" - rlRun "pushd $TmpDir" - rlServiceStart rsyslog - rlPhaseEnd - - rlPhaseStartTest - rlFileBackup ${sysConfig}; - crondOpts="$(sed -n '/^\s*CRONDARGS/s/^\s*CRONDARGS\s*=//p' ${sysConfig})"; - rlLog "Old CRONDARGS=\"${crondOpts}\""; - if echo "$crondOpts" | grep '"'; then - ## strip trailing quotes - crondOpts="$(echo "$crondOpts" | sed 's/\(^"\)\|\("$\)//g')"; - fi - crondOpts="$crondOpts -s -m off"; - rlLog "New CRONDARGS=\"${crondOpts}\""; - echo "CRONDARGS=\"${crondOpts}\"" > ${sysConfig}; - phrase="$(tr -dc 'a-zA-Z0-9' < /dev/urandom | head -c 32)"; - echo "* * * * * root /bin/echo $phrase" > ${cronJobFile}; - cp /var/log/cron ./oldLog; - [[ -f ./oldLog ]] || touch ./oldLog; - rlServiceStop crond; - sleep 1 - rlServiceStart crond; - sleep 65; - rlRun "diff ./oldLog /var/log/cron |grep -v '/bin/echo' \ - | grep '$phrase'" 0 "Output is logged correctly." \ - || rlLog "$(tail -n 5 /var/log/cron)" - rlPhaseEnd - - rlPhaseStart WARN "Cleanup" - rlRun "rm ${cronJobFile}"; - rlFileRestore; - rlRun "rlServiceRestore crond"; - rlServiceRestore rsyslog - rlRun "popd" - rlRun "rm -r $TmpDir" 0 "Removing tmp directory" - #avoid systemd failing to start crond due start-limit - sleep 10 - rlPhaseEnd -rlJournalPrintText -rlJournalEnd diff --git a/tests/tests.yml b/tests/tests.yml deleted file mode 100644 index a1167e8..0000000 --- a/tests/tests.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -# Tests to run in a classic environment -- hosts: localhost - roles: - - role: standard-test-beakerlib - tags: - - classic - tests: - - anacron-segfaults-with-certain-config-data - - anacron-segfaults-with-certain-config-data-2 - - Can-t-remove-crontab-from-expired-accounts - - Cron-does-uid-lookups-for-non-existent-users - - cron-daemon-fails-to-log-that-it-is-shutting-down - - crond-is-missing-RELRO-flags - - crond-subtask-abnormal-termination-removes-pid-file-in-error - - config-parsing-issue - - cronie-jobs-environment - - crontab-can-invoke-lookup-for-nonexisted-user - - crontab-has-wrong-permissions -# - echos-OK-twice-in-init-script Does not work on Fedora-26 - - init-script-failure -# - init-scripts-LSB Does not work on Fedora-26 -# - ldap-users Does not work on Fedora-26 -# - MAILTO-problem-with-anacron Does not work on Fedora-26 - - Make-crontab-a-PIE - - only-one-running-instance-in-time - - run-with-syslog-flag - - usr-bin-crontab-has-wrong-permissions - required_packages: - - authconfig # ldap-users needs this package - - findutils # beakerlib needs find command - - elfutils # crond-is-missing-RELRO-flags needs eu-readelf tool - - gcc # cronie-jobs-environment needs gcc command - - openldap # ldap-users needs this package - - openldap-servers # ldap-users needs this package - - openldap-clients # ldap-users needs this package - - procps-ng # multiple tests need ps and pidof commands - - psmisc # multiple tests need killall command - - rsyslog # run-with-syslog-flag requires this package - - sendmail # MAILTO-problem-with-anacron needs sendmail command - - sssd # ldap-users needs this package - - sssd-ldap # ldap-users needs this package - -# Tests to run in a container environment -- hosts: localhost - roles: - - role: standard-test-beakerlib - tags: - - container - tests: - - Can-t-remove-crontab-from-expired-accounts - - Make-crontab-a-PIE - - config-parsing-issue - - crond-is-missing-RELRO-flags - - crontab-has-wrong-permissions - - usr-bin-crontab-has-wrong-permissions - required_packages: - - cronie # everything needs cronie package - - findutils # beakerlib needs find command - - procps-ng # multiple tests need ps and pidof commands - - psmisc # multiple tests need killall command - - elfutils # multiple tests need eu-readelf tool - -# Tests to run in an Atomic Host VM -- hosts: localhost - roles: - - role: standard-test-beakerlib - tags: - - atomic - tests: - - Can-t-remove-crontab-from-expired-accounts - - Make-crontab-a-PIE - - config-parsing-issue - - crond-is-missing-RELRO-flags - - crontab-has-wrong-permissions - - usr-bin-crontab-has-wrong-permissions - required_packages: - - cronie # everything needs cronie package - - findutils # beakerlib needs find command - - procps-ng # multiple tests need ps and pidof commands - - psmisc # multiple tests need killall command - - elfutils # multiple tests need eu-readelf tool diff --git a/tests/usr-bin-crontab-has-wrong-permissions/Makefile b/tests/usr-bin-crontab-has-wrong-permissions/Makefile deleted file mode 100644 index f76a672..0000000 --- a/tests/usr-bin-crontab-has-wrong-permissions/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /CoreOS/cronie/Regression/usr-bin-crontab-has-wrong-permissions -# Description: Test for /usr/bin/crontab has wrong permissions -# Author: Martin Cermak -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2011 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/cronie/Regression/usr-bin-crontab-has-wrong-permissions -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: Martin Cermak " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: Test for /usr/bin/crontab has wrong permissions" >> $(METADATA) - @echo "Type: Regression" >> $(METADATA) - @echo "TestTime: 15m" >> $(METADATA) - @echo "RunFor: cronie" >> $(METADATA) - @echo "Requires: cronie" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/usr-bin-crontab-has-wrong-permissions/PURPOSE b/tests/usr-bin-crontab-has-wrong-permissions/PURPOSE deleted file mode 100644 index fb2bd73..0000000 --- a/tests/usr-bin-crontab-has-wrong-permissions/PURPOSE +++ /dev/null @@ -1,5 +0,0 @@ -PURPOSE of /CoreOS/cronie/Regression/usr-bin-crontab-has-wrong-permissions -Description: Test for /usr/bin/crontab has wrong permissions -Author: Martin Cermak -Bug summary: /usr/bin/crontab has wrong permissions - diff --git a/tests/usr-bin-crontab-has-wrong-permissions/runtest.sh b/tests/usr-bin-crontab-has-wrong-permissions/runtest.sh deleted file mode 100644 index 5540876..0000000 --- a/tests/usr-bin-crontab-has-wrong-permissions/runtest.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /CoreOS/cronie/Regression/usr-bin-crontab-has-wrong-permissions -# Description: Test for /usr/bin/crontab has wrong permissions -# Author: Martin Cermak -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2011 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/lib/beakerlib/beakerlib.sh - -PACKAGE="cronie" - -rlJournalStart - rlPhaseStartSetup - rlAssertRpm $PACKAGE - rlPhaseEnd - - rlPhaseStartTest - rlRun "test `stat -c %a /usr/bin/crontab` -eq 4755" - rlPhaseEnd -rlJournalEnd -rlJournalPrintText