[CRIU] [crtools-bot for Andrey Vagin ] zdtm.sh: detect leaked
descriptors
Cyrill Gorcunov
gorcunov at openvz.org
Fri Feb 17 06:20:16 EST 2012
The commit is pushed to "master" and will appear on git://github.com/cyrillos/crtools.git
------>
commit 986fa1ab86d56e2e2f92baf0fe62437f995ed400
Author: Andrey Vagin <avagin at openvz.org>
Date: Fri Feb 17 11:01:08 2012 +0300
zdtm.sh: detect leaked descriptors
Signed-off-by: Andrey Vagin <avagin at openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
test/zdtm.sh | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/test/zdtm.sh b/test/zdtm.sh
index 40a73d5..36c494b 100644
--- a/test/zdtm.sh
+++ b/test/zdtm.sh
@@ -49,6 +49,21 @@ CRTOOLS=`pwd`/`dirname $0`/../crtools
test -x $CRTOOLS || exit 1
ARGS=""
+save_fds()
+{
+ ls -l /proc/$1/fd | sed 's/\(-> \(pipe\|socket\)\):.*/\1/' > $2
+}
+
+diff_fds()
+{
+ if ! diff -up $1 $2; then
+ echo ERROR: Sets of descriptors are differ:
+ echo $1
+ echo $2
+ return 1
+ fi
+}
+
run_test()
{
local test=$ZP/$1
@@ -67,12 +82,14 @@ run_test()
echo Dump $pid
mkdir -p $ddump
+ save_fds $pid $ddump/dump.fd
setsid $CRTOOLS dump -D $ddump -o dump.log -t $pid $args $ARGS || {
echo WARNING: process $tname is left running for your debugging needs
return 1
}
-
if expr " $ARGS" : ' -s'; then
+ save_fds $pid $ddump/dump.fd.after
+ diff_fds $ddump/dump.fd $ddump/dump.fd.after || return 1
killall -CONT $tname
else
while :; do
@@ -83,6 +100,9 @@ run_test()
echo Restore $pid
setsid $CRTOOLS restore -D $ddump -o restore.log -d -t $pid $args || return 2
+
+ save_fds $pid $ddump/restore.fd
+ diff_fds $ddump/dump.fd $ddump/restore.fd || return 2
fi
echo Check results $pid
More information about the CRIU
mailing list