Commit 96dd1d22 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

zdtm: Unlink link_remap files once dump complete

In case if only "dump" procedure is invoked we left service
"link_remap.%d" file(s) on disk. This prevents next "dump"
procedure of same test to fail because we hit the situation
where same named "link_remap.%d" already exist.

So, if test is passed with "-d" option we remove the link remap
file at the end.

Also with this patch we start passing --link-remap option
only for tests which have "unlink_" prefix in name. This applies
some limitation on how test could be named, thus maybe we need
more flexible solution here.

https://bugzilla.openvz.org/show_bug.cgi?id=2489Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 08837c63
...@@ -266,6 +266,13 @@ diff_fds() ...@@ -266,6 +266,13 @@ diff_fds()
run_test() run_test()
{ {
local test=$1 local test=$1
local linkremap=
#
# add option for unlinked files test
if [[ $1 =~ "unlink_" ]]; then
linkremap="--link-remap"
fi
[ -n "$MAINSTREAM_KERNEL" ] && echo $TEST_CR_KERNEL | grep -q ${test#ns/} && { [ -n "$MAINSTREAM_KERNEL" ] && echo $TEST_CR_KERNEL | grep -q ${test#ns/} && {
echo "Skip $test" echo "Skip $test"
...@@ -312,7 +319,8 @@ EOF ...@@ -312,7 +319,8 @@ EOF
mkdir -p $ddump mkdir -p $ddump
save_fds $PID $ddump/dump.fd save_fds $PID $ddump/dump.fd
setsid $CRTOOLS_CPT dump --file-locks --tcp-established --link-remap -x --evasive-devices -D $ddump -o dump.log -v 4 -t $PID $args $ARGS || { setsid $CRTOOLS_CPT dump $opts --file-locks --tcp-established $linkremap \
-x --evasive-devices -D $ddump -o dump.log -v 4 -t $PID $args $ARGS || {
echo WARNING: process $tname is left running for your debugging needs echo WARNING: process $tname is left running for your debugging needs
return 1 return 1
} }
...@@ -321,6 +329,10 @@ EOF ...@@ -321,6 +329,10 @@ EOF
save_fds $PID $ddump/dump.fd.after save_fds $PID $ddump/dump.fd.after
diff_fds $ddump/dump.fd $ddump/dump.fd.after || return 1 diff_fds $ddump/dump.fd $ddump/dump.fd.after || return 1
killall -CONT $tname killall -CONT $tname
if [[ $linkremap ]]; then
echo "remove ./$tdir/link_remap.*"
rm -f ./$tdir/link_remap.*
fi
else else
# Wait while tasks are dying, otherwise PIDs would be busy. # Wait while tasks are dying, otherwise PIDs would be busy.
for i in $ddump/core-*.img; do for i in $ddump/core-*.img; do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment