63 lines
1.7 KiB
Bash
63 lines
1.7 KiB
Bash
#!/bin/bash
|
|
|
|
function check_prior_crashes() {
|
|
rlAssert0 "No prior crashes recorded" $(abrt-cli list 2> /dev/null | wc -l)
|
|
if [ ! "_$(abrt-cli list 2> /dev/null | wc -l)" == "_0" ]; then
|
|
abrt-cli list
|
|
rlDie "Won't proceed"
|
|
fi
|
|
}
|
|
|
|
function create_custom_event() {
|
|
rlLog "Creating custom test event"
|
|
cat > /etc/libreport/events.d/test_event.conf << _EOF_
|
|
EVENT=notify
|
|
echo "ABRT tests - EVENT=notify - $DUMP_DIR"
|
|
touch /tmp/abrt-done
|
|
true
|
|
EVENT=notify-dup
|
|
echo "ABRT tests - EVENT=notify-dup - $DUMP_DIR"
|
|
touch /tmp/abrt-done
|
|
true
|
|
_EOF_
|
|
}
|
|
|
|
function remove_custom_event() {
|
|
rlLog "Removing custom test event"
|
|
rm -f /etc/libreport/events.d/test_event.conf
|
|
rm -f /tmp/abrt-done
|
|
}
|
|
|
|
function wait_for_hooks() {
|
|
rlLog "Waiting for all hooks to end"
|
|
# Wait at least 1 second
|
|
sleep 1
|
|
local c=0
|
|
while [ ! -f "/tmp/abrt-done" ]; do
|
|
sleep 0.1
|
|
let c=$c+1
|
|
if [ $c -gt 3000 ]; then
|
|
rlFail "Timeout"
|
|
break
|
|
fi
|
|
done
|
|
t=$( echo "scale=2; ($c/10)+1" | bc )
|
|
rlLog "Hooks ended in $t seconds"
|
|
}
|
|
|
|
function get_crash_path() {
|
|
rlLog "Get crash path"
|
|
rlAssertGreater "Crash recorded" $(abrt-cli list 2> /dev/null | wc -l) 0
|
|
crash_PATH="$(abrt-cli list 2> /dev/null | grep Directory | awk '{ print $2 }' | tail -n1)"
|
|
if [ ! -d "$crash_PATH" ]; then
|
|
echo "Dump location listing:"
|
|
ls -l $ABRT_CONF_DUMP_LOCATION
|
|
echo "abrt-cli list:"
|
|
abrt-cli list
|
|
echo "Syslog:"
|
|
print_syslog 10
|
|
rlFail "No crash dir generated, this shouldn't happen"
|
|
fi
|
|
rlLog "PATH = $crash_PATH"
|
|
}
|