- related to trac#927
Signed-off-by: Jakub Filak <[email protected]>
---
tests/runtests/abrtd-inotify-flood/inotify_flooder.sh | 8 ++++++--
tests/runtests/aux/lib.sh | 16 +++++++++++++++-
tests/runtests/aux/run_in_order.sh | 10 +++++++---
tests/runtests/aux/runner.sh | 9 ++++++---
tests/runtests/dbus-elements-handling/runtest.sh | 19 ++++++++++---------
tests/runtests/upload-handling/runtest.sh | 3 ++-
6 files changed, 46 insertions(+), 19 deletions(-)
diff --git a/tests/runtests/abrtd-inotify-flood/inotify_flooder.sh
b/tests/runtests/abrtd-inotify-flood/inotify_flooder.sh
index 9f9e505..7a56fcb 100755
--- a/tests/runtests/abrtd-inotify-flood/inotify_flooder.sh
+++ b/tests/runtests/abrtd-inotify-flood/inotify_flooder.sh
@@ -1,10 +1,14 @@
#!/bin/sh
-stopfile="/var/spool/abrt/bogofile.stop.$$"
+. ../aux/lib.sh
+
+load_abrt_conf
+
+stopfile="$ABRT_CONF_DUMP_LOCATION/bogofile.stop.$$"
>"$stopfile"
f() {
- name="/var/spool/abrt/bogofile.$RANDOM"
+ name="$ABRT_CONF_DUMP_LOCATION/bogofile.$RANDOM"
while test -f "$stopfile"; do
rm "$name" >"$name"
done
diff --git a/tests/runtests/aux/lib.sh b/tests/runtests/aux/lib.sh
index 87d9ef1..8b3ac81 100644
--- a/tests/runtests/aux/lib.sh
+++ b/tests/runtests/aux/lib.sh
@@ -66,7 +66,21 @@ function generate_second_crash() {
will_abort
}
+function load_abrt_conf() {
+ ABRT_CONF_DUMP_LOCATION=`sed -n '/^DumpLocation[ \t]*=/ s/.*=[ \t]*//p'
@CONF_DIR@/abrt.conf 2>/dev/null`
+
+ if test -z "$ABRT_CONF_DUMP_LOCATION"; then
+ ABRT_CONF_DUMP_LOCATION=$( pkg-config abrt
--variable=defaultdumplocation )
+ fi
+
+ if test -z "$ABRT_CONF_DUMP_LOCATION"; then
+ ABRT_CONF_DUMP_LOCATION="/var/spool/abrt"
+ fi
+}
+
function prepare() {
- rm -f /var/spool/abrt/last-ccpp
+ load_abrt_conf
+
+ rm -f -- $ABRT_CONF_DUMP_LOCATION/last-ccpp
rm -f /tmp/abrt-done
}
diff --git a/tests/runtests/aux/run_in_order.sh
b/tests/runtests/aux/run_in_order.sh
index 8ec0623..b3b7c48 100755
--- a/tests/runtests/aux/run_in_order.sh
+++ b/tests/runtests/aux/run_in_order.sh
@@ -1,5 +1,9 @@
#!/bin/bash
+. ./aux/lib.sh
+
+load_abrt_conf
+
testlist=$(cat $TEST_LIST | grep '^[^#]\+$')
crit_test_fail=0
@@ -22,11 +26,11 @@ for test_dir in $testlist; do
sleep 1
# save post crashes
- if [ -d /var/spool/abrt ]; then
- n_post=$( find /var/spool/abrt/ -mindepth 1 -type d | wc -l )
+ if [ -d "$ABRT_CONF_DUMP_LOCATION" ]; then
+ n_post=$( find $ABRT_CONF_DUMP_LOCATION -mindepth 1 -type d | wc -l )
if [ $n_post -gt 0 ]; then
mkdir "$outdir/post_crashes"
- for dir in $( find /var/spool/abrt/ -mindepth 1 -type d ); do
+ for dir in $( find $ABRT_CONF_DUMP_LOCATION -mindepth 1 -type d
); do
mv "$dir" "$outdir/post_crashes/"
done
fi
diff --git a/tests/runtests/aux/runner.sh b/tests/runtests/aux/runner.sh
index 294a9da..1137d77 100755
--- a/tests/runtests/aux/runner.sh
+++ b/tests/runtests/aux/runner.sh
@@ -1,5 +1,9 @@
#!/bin/bash
+. ./aux/lib.sh
+
+load_abrt_conf
+
if [ $1 ]; then
# clenaup BEFORE every test
@@ -20,8 +24,7 @@ if [ $1 ]; then
rm -f /var/run/abrt/abrtd.pid
fi
- rm -f /var/spool/abrt/last-ccpp
- rm -f /tmp/abrt-done
+ prepare
if [ "${REINSTALL_BEFORE_EACH_TEST}" = "1" ]; then
echo 'REINSTALL_BEFORE_EACH_TEST set'
@@ -49,7 +52,7 @@ if [ $1 ]; then
fi
if [ "${CLEAN_SPOOL_BEFORE_EACH_TEST}" = "1" ]; then
- rm -rf /var/spool/abrt/*
+ rm -rf $ABRT_CONF_DUMP_LOCATION/*
fi
service abrtd start
diff --git a/tests/runtests/dbus-elements-handling/runtest.sh
b/tests/runtests/dbus-elements-handling/runtest.sh
index 1439585..c1cc23c 100755
--- a/tests/runtests/dbus-elements-handling/runtest.sh
+++ b/tests/runtests/dbus-elements-handling/runtest.sh
@@ -26,6 +26,7 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
. /usr/share/beakerlib/beakerlib.sh
+. ../aux/lib.sh
TEST="dbus-elements-handling"
PACKAGE="abrt"
@@ -166,13 +167,13 @@ rlJournalStart
export -f abrtDBusSetElement
export -f abrtDBusDelElement
export -f abrtDBusGetElement
- DUMP_LOCATION=`mktemp -d /var/spool/XXXXX`
# Set limit to 1Midk
rlRun "cp /etc/abrt/abrt.conf /etc/abrt/abrt.conf.bak" 0 "Create a
backup of abrt configuration"
rlRun "sed 's,^.*MaxCrashReportsSize.*=.*$,MaxCrashReportsSize=1,' -i
/etc/abrt/abrt.conf" 0 "Set limit for crash reports to 1MiB"
- rlRun "sed 's,^.*DumpLocation.*=.*$,DumpLocation=$DUMP_LOCATION,' -i
/etc/abrt/abrt.conf" 0 "Change the dump location"
rlRun "systemctl restart abrtd.service" 0 "Restart abrt service"
+ load_abrt_conf
+
rlLog "Create a problem data as the root user"
roots_problem=`abrtDBusNewProblem
deleted,to_be_deleted,changed,to_be_changed`
if echo $roots_problem | grep -s "org.freedesktop.problems.Failure";
then
@@ -180,7 +181,7 @@ rlJournalStart
fi
sleep 5
- roots_problem_path="$(abrt-cli list -f $DUMP_LOCATION | awk -v
id=$roots_problem '$0 ~ "Directory:.*"id { print $2 }')"
+ roots_problem_path="$(abrt-cli list -f $ABRT_CONF_DUMP_LOCATION | awk
-v id=$roots_problem '$0 ~ "Directory:.*"id { print $2 }')"
if [ -z "$roots_problem_path" ]; then
rlDie "Not found path"
fi
@@ -192,7 +193,7 @@ rlJournalStart
fi
sleep 5
- unprivilegeds_problem_path="$(abrt-cli list -f $DUMP_LOCATION | awk -v
id=$unprivilegeds_problem '$0 ~ "Directory:.*"id { print $2 }')"
+ unprivilegeds_problem_path="$(abrt-cli list -f
$ABRT_CONF_DUMP_LOCATION | awk -v id=$unprivilegeds_problem '$0 ~
"Directory:.*"id { print $2 }')"
if [ -z "$unprivilegeds_problem_path" ]; then
rlDie "Not found path"
fi
@@ -225,7 +226,7 @@ rlJournalStart
rlPhaseStartSetup
rlRun "systemctl stop abrtd.service" 0 "Stop abrtd before cleaning of
the dump location"
- rlRun "rm -rf $DUMP_LOCATION/*" 0 "Clean the dump location"
+ rlRun "rm -rf $ABRT_CONF_DUMP_LOCATION/*" 0 "Clean the dump location"
rlRun "systemctl start abrtd.service" 0 "Start abrtd after cleaning of
the dump location"
rlLog "Create a problem data as the root user"
@@ -235,7 +236,7 @@ rlJournalStart
fi
sleep 5
- roots_problem_path="$(abrt-cli list -f $DUMP_LOCATION | awk -v
id=$roots_problem '$0 ~ "Directory:.*"id { print $2 }')"
+ roots_problem_path="$(abrt-cli list -f $ABRT_CONF_DUMP_LOCATION | awk
-v id=$roots_problem '$0 ~ "Directory:.*"id { print $2 }')"
if [ -z "$roots_problem_path" ]; then
rlDie "Not found path problem path"
fi
@@ -247,7 +248,7 @@ rlJournalStart
fi
sleep 5
- unprivilegeds_problem_path="$(abrt-cli list -f $DUMP_LOCATION | awk -v
id=$unprivilegeds_problem '$0 ~ "Directory:.*"id { print $2 }')"
+ unprivilegeds_problem_path="$(abrt-cli list -f
$ABRT_CONF_DUMP_LOCATION | awk -v id=$unprivilegeds_problem '$0 ~
"Directory:.*"id { print $2 }')"
if [ -z "$unprivilegeds_problem_path" ]; then
rlDie "Not found path problem path"
fi
@@ -259,7 +260,7 @@ rlJournalStart
fi
sleep 5
- second_unprivilegeds_problem_path="$(abrt-cli list -f $DUMP_LOCATION |
awk -v id=$second_unprivilegeds_problem '$0 ~ "Directory:.*"id { print $2 }')"
+ second_unprivilegeds_problem_path="$(abrt-cli list -f
$ABRT_CONF_DUMP_LOCATION | awk -v id=$second_unprivilegeds_problem '$0 ~
"Directory:.*"id { print $2 }')"
if [ -z "$second_unprivilegeds_problem_path" ]; then
rlDie "Not found path problem path"
fi
@@ -292,7 +293,7 @@ rlJournalStart
rlRun "userdel -r abrtdbustestanother" 0 "Remove the another test user"
rlRun "mv /etc/abrt/abrt.conf.bak /etc/abrt/abrt.conf" 0 "Restore abrt
configuration"
rlRun "systemctl restart abrtd.service" 0 "Restart abrtd after
configuration changes"
- rlRun "rm -rf $DUMP_LOCATION"
+ rlRun "rm -rf -- $ABRT_CONF_DUMP_LOCATION/*"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd
diff --git a/tests/runtests/upload-handling/runtest.sh
b/tests/runtests/upload-handling/runtest.sh
index 220eadb..70b62e1 100755
--- a/tests/runtests/upload-handling/runtest.sh
+++ b/tests/runtests/upload-handling/runtest.sh
@@ -39,6 +39,7 @@ rlJournalStart
pushd $TmpDir
mkdir -p /var/spool/abrt-upload/
echo "WatchCrashdumpArchiveDir = /var/spool/abrt-upload/" >
/etc/abrt/abrt.conf
+ load_abrt_conf
rlRun "setsebool -P abrt_anon_write 1"
rlRun "service abrtd stop" 0 "Killing abrtd"
rlRun "service abrtd start" 0 "Starting abrtd"
@@ -50,7 +51,7 @@ rlJournalStart
wait_for_hooks
- rem_upload_dir=$( echo /var/spool/abrt/remote* )
+ rem_upload_dir=$( echo $ABRT_CONF_DUMP_LOCATION/remote* )
rlAssertExists "$rem_upload_dir/coredump"
# because of commit c43d2e7b890e48fd30e248f2d578f4bde81cc140 and
rhbz#839285
rlAssertExists "/var/spool/abrt-upload/upload.tar.gz"
--
1.8.1