Skip to content
Snippets Groups Projects
Commit de984fed authored by Kamil Dudka's avatar Kamil Dudka
Browse files

test: run each test in its own directory

Closes #132
parent 79a89866
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -89,7 +89,8 @@ EXTRA_DIST = \
DISTCLEANFILES = \
test.ACL \
test.SELINUX \
test.example
test.example \
test-????/*
 
TESTS_ENVIRONMENT = \
test $(top_srcdir) = $(top_builddir) || ln -fs $(top_srcdir)/test/* . ; \
Loading
Loading
Loading
Loading
@@ -14,10 +14,11 @@ test.log.1.Z 1 zero
EOF
 
(echo "gzip -f -9") | diff -u - compress-args
egrep -q '^LOGROTATE_COMPRESSED_FILENAME=.+/test/test.log.1$' compress-env
egrep -q '^LOGROTATE_COMPRESSED_FILENAME=.+/test.log.1$' compress-env
if [ $? != 0 ]; then
echo "LOGROTATE_COMPRESSED_FILENAME environment variable not found."
cat compress-env++ exit 3
cat compress-env
exit 3
fi
 
SYSLOG_TESTS=0
Loading
Loading
Loading
Loading
@@ -6,10 +6,10 @@ cleanup 59
 
# ------------------------------- Test 59 ------------------------------------
# Test renamecopy in debug mode, nothing should happen
preptest test.log 58 1 0
preptest test.log 59 1 0
touch test.log.1
touch test.log.2
$RLR test-config.58 --force -d 2>/dev/null
$RLR test-config.59 --force -d 2>/dev/null
 
checkoutput <<EOF
test.log 0 zero
Loading
Loading
Loading
Loading
@@ -6,13 +6,13 @@ cleanup 60
 
# ------------------------------- Test 60 ------------------------------------
# Test we log debug output using -l option when passed.
preptest test.log 61 1 0
preptest test.log 60 1 0
 
$RLR test-config.61 --force -l ./logrotate.log
$RLR test-config.60 --force -l ./logrotate.log
 
DATESTRING=$(/bin/date +%Y-%m-%d-%H)
 
grep "reading config file test-config.61" logrotate.log >/dev/null
grep "reading config file test-config.60" logrotate.log >/dev/null
if [ $? != 0 ]; then
echo "There is no log output in logrotate.log"
exit 3
Loading
Loading
Loading
Loading
@@ -6,7 +6,7 @@ cleanup 62
 
# ------------------------------- Test 62 ------------------------------------
# Rotate sparse file
preptest test.log 24 1 0
preptest test.log 62 1 0
 
printf zero > test.log
truncate -s 10M test.log
Loading
Loading
@@ -16,7 +16,7 @@ cp test.log test.example
 
SIZE_SPARSE_OLD=$(du test.log|awk '{print $1}')
SIZE_OLD=$(du --apparent-size test.log|awk '{print $1}')
$RLR test-config.24 --force
$RLR test-config.62 --force
SIZE_NEW=$(du --apparent-size test.log.1|awk '{print $1}')
SIZE_SPARSE_NEW=$(du test.log.1|awk '{print $1}')
 
Loading
Loading
Loading
Loading
@@ -6,7 +6,7 @@ cleanup 63
 
# ------------------------------- Test 63 ------------------------------------
# Rotate sparse file, no data should be lost when hole is in the end of file
preptest test.log 24 1 0
preptest test.log 63 1 0
 
printf zero > test.log
truncate -s 10M test.log
Loading
Loading
@@ -15,7 +15,7 @@ cp test.log test.example
 
SIZE_SPARSE_OLD=$(du test.log|awk '{print $1}')
SIZE_OLD=$(du --apparent-size test.log|awk '{print $1}')
$RLR test-config.24 --force
$RLR test-config.63 --force
SIZE_NEW=$(du --apparent-size test.log.1|awk '{print $1}')
SIZE_SPARSE_NEW=$(du test.log.1|awk '{print $1}')
 
Loading
Loading
Loading
Loading
@@ -14,6 +14,7 @@ if [ -z "$ACL_TESTS" ]; then
if [ $ACL_TESTS = 1 ]; then
# It seems we can run the ACL tests, but was logrotate compiled WITH_ACL=yes ?
# See the Makefile, "pretest" part, for more information
import "test.ACL"
if [ -f ./test.ACL ]; then
ACL_TESTS=`cat ./test.ACL`
if [ $ACL_TESTS = 0 ]; then
Loading
Loading
Loading
Loading
@@ -13,6 +13,7 @@ if [ -z "$SELINUX_TESTS" ]; then
if [ $SELINUX_TESTS = 1 ]; then
# It seems we can run the ACL tests, but was logrotate compiled WITH_ACL=yes ?
# See the Makefile, "pretest" part, for more information
import "test.SELINUX"
if [ -f ./test.SELINUX ]; then
SELINUX_TESTS=`cat ./test.SELINUX`
if [ $SELINUX_TESTS = 0 ]; then
Loading
Loading
# common variables and functions for legacy tests
LOGROTATE="$(readlink -f $LOGROTATE)"
RLR="$LOGROTATE -m ./mailer -s state"
 
TESTDIR="$(basename "$0" .sh)"
mkdir -p "$TESTDIR"
cd "$TESTDIR" || exit $?
TESTNUM="$(printf "%s\n" "$TESTDIR" | sed -e 's/^test-0*//')"
import() {
[ -e "$1" ] && return
[ -e "../$1" ] || return
ln -s "../$1"
}
import "compress"
import "compress-error"
import "mailer"
import "test-common-acl.sh"
import "test-common-selinux.sh"
import "test-config.$TESTNUM.in"
cleanup() {
rm -f test*.log* anothertest*.log* state test-config. scriptout mail-out compress-args compress-env different*.log*
rm -f $(ls | egrep '^test-config.[0-9]+$')
Loading
Loading
test-config.58.in
\ No newline at end of file
test-config.61.in
\ No newline at end of file
test-config.24.in
\ No newline at end of file
test-config.24.in
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment