File kdump-avoid-test-races.patch of Package kdump.17231
From: Tomáš Chvátal <tchvatal@suse.com>
Date Sun, 26 Mar 2017 15:30:22 +0200
Subject: Allow paralel execution of tests by avoiding tmp clashes
References: bsc#1117652
Git-commit: 6e8460835e08a3885fb4898866a40397466d0675
Upstream: merged
Acked-by: Petr Tesarik <ptesarik@suse.com>
---
tests/delete_dumps.sh | 30 +++++++++++++++---------------
tests/listdir.sh | 8 ++++----
2 files changed, 19 insertions(+), 19 deletions(-)
--- a/tests/delete_dumps.sh
+++ b/tests/delete_dumps.sh
@@ -47,7 +47,7 @@ fi
. "$DIR/testdirs.sh"
-setup_testdir "$DIR/tmp" || exit 1
+setup_testdir "$DIR/tmp-delete_dumps" || exit 1
SORTDUMPS=$( LANG= sort <(
IFS=$'\n'
echo "${TESTKDUMP[*]}"
@@ -55,17 +55,17 @@ SORTDUMPS=$( LANG= sort <(
errors=0
-CONF="$DIR/tmp/kdump.conf"
+CONF="$DIR/tmp-delete_dumps/kdump.conf"
echo "Disable delete_dumps"
cat <<EOF >"$CONF"
-KDUMP_SAVEDIR="file:///$DIR/tmp"
+KDUMP_SAVEDIR="file:///$DIR/tmp-delete_dumps"
KDUMP_KEEP_OLD_DUMPS=0
EOF
"$KDUMPTOOL" -F "$CONF" delete_dumps || exit 1
for f in "${TESTKDUMP[@]}" "${TESTDIRS[@]}" "${TESTFILES[@]}"; do
- if ! test -e "$DIR/tmp/$f"; then
+ if ! test -e "$DIR/tmp-delete_dumps/$f"; then
echo "$f incorrectly deleted!" >&2
errors=$(( $errors+1 ))
fi
@@ -74,14 +74,14 @@ done
echo "Keep all existing dumps"
nkeep=${#TESTKDUMP[@]}
cat <<EOF >"$CONF"
-KDUMP_SAVEDIR="file:///$DIR/tmp"
+KDUMP_SAVEDIR="file:///$DIR/tmp-delete_dumps"
KDUMP_KEEP_OLD_DUMPS=$nkeep
EOF
"$KDUMPTOOL" -F "$CONF" delete_dumps || exit 1
for f in "${TESTKDUMP[@]}" "${TESTDIRS[@]}" "${TESTFILES[@]}"; do
- if ! test -e "$DIR/tmp/$f"; then
+ if ! test -e "$DIR/tmp-delete_dumps/$f"; then
echo "$f incorrectly deleted!" >&2
errors=$(( $errors+1 ))
fi
@@ -91,7 +91,7 @@ echo "Keep all but one dump"
nkeep=$(( ${#TESTKDUMP[@]} - 1 ))
cat <<EOF >"$CONF"
-KDUMP_SAVEDIR="file:///$DIR/tmp"
+KDUMP_SAVEDIR="file:///$DIR/tmp-delete_dumps"
KDUMP_KEEP_OLD_DUMPS=$nkeep
EOF
@@ -104,14 +104,14 @@ REMOVEDUMP=( $( echo "$SORTDUMPS" | head
IFS=save_ifs
for f in "${KEPTDUMP[@]}" "${TESTDIRS[@]}" "${TESTFILES[@]}"; do
- if ! test -e "$DIR/tmp/$f"; then
+ if ! test -e "$DIR/tmp-delete_dumps/$f"; then
echo "$f incorrectly deleted!" >&2
errors=$(( $errors+1 ))
fi
done
for f in "${REMOVEDUMP[@]}"; do
- if test -e "$DIR/tmp/$f"; then
+ if test -e "$DIR/tmp-delete_dumps/$f"; then
echo "$f incorrectly kept!" >&2
errors=$(( $errors+1 ))
fi
@@ -121,7 +121,7 @@ echo "Keep only 1 dump"
nkeep=1
cat <<EOF >"$CONF"
-KDUMP_SAVEDIR="file:///$DIR/tmp"
+KDUMP_SAVEDIR="file:///$DIR/tmp-delete_dumps"
KDUMP_KEEP_OLD_DUMPS=1
EOF
@@ -134,14 +134,14 @@ REMOVEDUMP=( $( echo "$SORTDUMPS" | head
IFS=save_ifs
for f in "${KEPTDUMP[@]}" "${TESTDIRS[@]}" "${TESTFILES[@]}"; do
- if ! test -e "$DIR/tmp/$f"; then
+ if ! test -e "$DIR/tmp-delete_dumps/$f"; then
echo "$f incorrectly deleted!" >&2
errors=$(( $errors+1 ))
fi
done
for f in "${REMOVEDUMP[@]}"; do
- if test -e "$DIR/tmp/$f"; then
+ if test -e "$DIR/tmp-delete_dumps/$f"; then
echo "$f incorrectly kept!" >&2
errors=$(( $errors+1 ))
fi
@@ -151,21 +151,21 @@ echo "Delete all dumps"
nkeep=1
cat <<EOF >"$CONF"
-KDUMP_SAVEDIR="file:///$DIR/tmp"
+KDUMP_SAVEDIR="file:///$DIR/tmp-delete_dumps"
KDUMP_KEEP_OLD_DUMPS=-1
EOF
"$KDUMPTOOL" -F "$CONF" delete_dumps || exit 1
for f in "${TESTDIRS[@]}" "${TESTFILES[@]}"; do
- if ! test -e "$DIR/tmp/$f"; then
+ if ! test -e "$DIR/tmp-delete_dumps/$f"; then
echo "$f incorrectly deleted!" >&2
errors=$(( $errors+1 ))
fi
done
for f in "${TESTKDUMP[@]}"; do
- if test -e "$DIR/tmp/$f"; then
+ if test -e "$DIR/tmp-delete_dumps/$f"; then
echo "$f incorrectly kept!" >&2
errors=$(( $errors+1 ))
fi
--- a/tests/listdir.sh
+++ b/tests/listdir.sh
@@ -47,7 +47,7 @@ fi
. "$DIR/testdirs.sh"
-setup_testdir "$DIR/tmp" || exit 1
+setup_testdir "$DIR/tmp-testdirs" || exit 1
errors=0
@@ -57,7 +57,7 @@ EXPECT=$( LANG= sort <(
echo "${TESTDIRS[*]}"
echo "${TESTFILES[*]}"
) )
-OUTPUT=$( "$LISTDIR" "$DIR/tmp" all || echo "*** testlistdir FAILED!" )
+OUTPUT=$( "$LISTDIR" "$DIR/tmp-testdirs" all || echo "*** testlistdir FAILED!" )
check_output
EXPECT=$( LANG= sort <(
@@ -65,14 +65,14 @@ EXPECT=$( LANG= sort <(
echo "${TESTKDUMP[*]}"
echo "${TESTDIRS[*]}"
) )
-OUTPUT=$( "$LISTDIR" "$DIR/tmp" dirs || echo "*** testlistdir FAILED!" )
+OUTPUT=$( "$LISTDIR" "$DIR/tmp-testdirs" dirs || echo "*** testlistdir FAILED!" )
check_output
EXPECT=$( LANG= sort <(
IFS=$'\n'
echo "${TESTKDUMP[*]}"
) )
-OUTPUT=$( "$LISTDIR" "$DIR/tmp" kdumpdirs || echo "*** testlistdir FAILED!" )
+OUTPUT=$( "$LISTDIR" "$DIR/tmp-testdirs" kdumpdirs || echo "*** testlistdir FAILED!" )
check_output
exit $errors