[LTP] [PATCH 1/1] logrotate: Remove test

Petr Vorel pvorel@suse.cz
Tue Dec 3 11:05:40 CET 2024


logrotate is an userspace tool, which has it's own testsuite [1].
LTP is meant for kernel testing, therefore remove the test.

[1] https://github.com/logrotate/logrotate/tree/main/test

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 runtest/commands                              |   1 -
 .../commands/logrotate/00_Descriptions.txt    |   2 -
 testcases/commands/logrotate/Makefile         |  31 ----
 .../commands/logrotate/logrotate_tests.sh     | 139 ------------------
 4 files changed, 173 deletions(-)
 delete mode 100644 testcases/commands/logrotate/00_Descriptions.txt
 delete mode 100644 testcases/commands/logrotate/Makefile
 delete mode 100755 testcases/commands/logrotate/logrotate_tests.sh

diff --git a/runtest/commands b/runtest/commands
index 5ec2c3b699..cfbaf214c8 100644
--- a/runtest/commands
+++ b/runtest/commands
@@ -5,7 +5,6 @@ ldd01_sh ldd01.sh
 nm01_sh nm01.sh
 file01_sh file01.sh
 tar01_sh  tar_tests.sh
-logrotate_sh export TCdat=$LTPROOT/testcases/bin; logrotate_tests.sh
 cpio01_sh cpio_tests.sh
 unzip01_sh unzip01.sh
 gzip01_sh gzip_tests.sh
diff --git a/testcases/commands/logrotate/00_Descriptions.txt b/testcases/commands/logrotate/00_Descriptions.txt
deleted file mode 100644
index 07ffcd3e6a..0000000000
--- a/testcases/commands/logrotate/00_Descriptions.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-logrotate01
-	test basic functionality of logrotate. use logrotate -f <config> to force rotation. 1. rotate /var/log/tst_logfile file. 2. compresses it.
diff --git a/testcases/commands/logrotate/Makefile b/testcases/commands/logrotate/Makefile
deleted file mode 100644
index c3a701b87d..0000000000
--- a/testcases/commands/logrotate/Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-#    commands/logrotate testcases Makefile.
-#
-#    Copyright (C) 2009, Cisco Systems 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, write to the Free Software Foundation, Inc.,
-#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Ngie Cooper, July 2009
-#
-
-top_srcdir		?= ../../..
-
-include $(top_srcdir)/include/mk/env_pre.mk
-
-INSTALL_TARGETS		:= logrotate_tests.sh
-
-MAKE_TARGETS		:=
-
-include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/commands/logrotate/logrotate_tests.sh b/testcases/commands/logrotate/logrotate_tests.sh
deleted file mode 100755
index 0aa9f12e12..0000000000
--- a/testcases/commands/logrotate/logrotate_tests.sh
+++ /dev/null
@@ -1,139 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) International Business Machines Corp., 2001
-# Copyright (c) Linux Test Project, 2002-2024
-# Author: Manoj Iyer <manjo@mail.utexas.edu>
-#
-# Test Basic functionality of logrotate command.
-#
-# Test #1
-# Test that logrotate logrotate will rotate the logfile according to the
-# specifications in the config file.
-# - Create a config file that will rotate the /var/log/tst_logfile file.
-# - Use force option to force logrotate to cause the log file to be rotated.
-# - Compress the file after rotation.
-#
-# Test #2
-# Test that logrotate logrotate will rotate the logfile if the logfile
-# exceeds a certain size.
-# - Create a config file that will rotate the /var/log/tst_largelogfile.
-# - Run logrotate in a cron job that runs every minute.
-# - Add messages to the logfile until it gets rotated when a re-dittermined size
-#   is reached.
-
-TST_NEEDS_CMDS="crontab file grep logrotate"
-TST_TESTFUNC=test
-TST_NEEDS_ROOT=1
-TST_NEEDS_TMPDIR=1
-TST_CNT=2
-TST_SETUP=setup
-TST_CLEANUP=cleanup
-
-PERMISSION=
-
-setup()
-{
-	local group="syslog"
-
-	grep -q $group /etc/group || group="root"
-	PERMISSION="su root $group"
-}
-
-cleanup()
-{
-	(crontab -l | grep -v tst_largelog) | crontab -
-	rm -rf /var/log/tst_logfile*
-	rm -rf /var/log/tst_largelogfile*
-}
-
-check_log()
-{
-	local file="$1"
-
-	EXPECT_PASS [ -f "$file" ]
-
-	if ! file "$file" | grep -q "gzip compressed data"; then
-		tst_res TFAIL "Failed to create a compressed file"
-	fi
-}
-
-test1()
-{
-	cat >tst_logrotate.conf <<-EOF
-        #****** Begin Config file *******
-        # create new (empty) log files after rotating old ones
-        create
-
-        # compress the log files
-        compress
-
-        /var/log/tst_logfile {
-                $PERMISSION
-                rotate 5
-                weekly
-        }
-        #****** End Config file *******
-	EOF
-
-	cat >/var/log/tst_logfile <<-EOF
-        #****** Begin Log File ********
-        # This is a dummy log file.
-        #****** End Log File ********
-	EOF
-
-	for i in $(seq 10); do
-		echo "This a dummy log file used to test logrotate command." >> /var/log/tst_logfile
-	done
-
-	ROD rm -f /var/log/tst_logfile.*
-	ROD chmod 644 tst_logrotate.conf
-	ROD logrotate -fv tst_logrotate.conf > tst_logrotate.out 2>&1
-
-	EXPECT_PASS grep -q "reading config file tst_logrotate.conf" tst_logrotate.out
-	EXPECT_PASS grep -q "forced from command line (5 rotations)" tst_logrotate.out
-	EXPECT_PASS grep -E -q "compressing new|log with" tst_logrotate.out
-
-	check_log /var/log/tst_logfile.1.gz
-}
-
-test2()
-{
-	cat >tst_largelog.conf <<-EOF
-        # create new (empty) log files after rotating old ones
-        create
-        # compress the log files
-        compress
-        /var/log/tst_largelogfile {
-            $PERMISSION
-            rotate 5
-            size=2k
-        }
-	EOF
-
-	ROD chmod 644 tst_largelog.conf
-
-	cat >/var/log/tst_largelogfile <<-EOF
-        # This is a psuedo-log file. This file will grow to a 2k size before
-        # getting rotated.
-	EOF
-
-	for i in $(seq 75); do
-		echo "Some text for testing rotation" >> /var/log/tst_largelogfile
-	done
-
-	# cron job for logrotating
-	(crontab -l 2>/dev/null; echo \
-		"* * * * * $(command -v logrotate) $(pwd)/tst_largelog.conf") | crontab -
-	if [ $? -ne 0 ]; then
-		tst_brk TBROK "Failed to create a cron job"
-	fi
-
-	# 5 sec for cron job to start, 1 min for logrotate to rotate the logs
-	tst_res TINFO "sleep 1 min to wait for rotating logs"
-	tst_sleep 65s
-
-	check_log /var/log/tst_largelogfile.1.gz
-}
-
-. tst_test.sh
-tst_run
-- 
2.45.2



More information about the ltp mailing list