From f215a7877ab98700a4877dc6b701fe7d9cb48461 Mon Sep 17 00:00:00 2001 From: "yi.wu" Date: Thu, 14 Jun 2018 16:08:20 +0800 Subject: [PATCH] add script --- .../unittests/test_listen_and_serv_op.py | 2 - tools/check_ctest_hung.py | 43 +++++++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 tools/check_ctest_hung.py diff --git a/python/paddle/fluid/tests/unittests/test_listen_and_serv_op.py b/python/paddle/fluid/tests/unittests/test_listen_and_serv_op.py index 86f18731fe8..d1d709551c7 100644 --- a/python/paddle/fluid/tests/unittests/test_listen_and_serv_op.py +++ b/python/paddle/fluid/tests/unittests/test_listen_and_serv_op.py @@ -92,7 +92,6 @@ class TestListenAndServOp(OpTest): pid = self._start_pserver(False, True) self._wait_ps_ready(pid) - print("send kill signal, ", pid) # raise SIGTERM to pserver os.kill(pid, signal.SIGTERM) @@ -100,7 +99,6 @@ class TestListenAndServOp(OpTest): pid = self._start_pserver(False, False) self._wait_ps_ready(pid) - print("send kill signal, ", pid) # raise SIGTERM to pserver os.kill(pid, signal.SIGTERM) diff --git a/tools/check_ctest_hung.py b/tools/check_ctest_hung.py new file mode 100644 index 00000000000..162e3b29438 --- /dev/null +++ b/tools/check_ctest_hung.py @@ -0,0 +1,43 @@ +# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import sys +import re + + +def escape(input): + o = input.replace("\n", "") + o = o.replace("\r", "") + return o + + +def main(): + logfile = sys.argv[1] + started = set() + passed = set() + with open(logfile, "r") as fn: + for l in fn.readlines(): + if l.find("Test ") != -1 and \ + l.find("Passed") != -1: + m = re.search("Test\s+#[0-9]*\:\s([a-z0-9_]+)", escape(l)) + passed.add(m.group(1)) + if l.find("Start ") != -1: + start_parts = escape(l).split(" ") + m = re.search("Start\s+[0-9]+\:\s([a-z0-9_]+)", escape(l)) + started.add(m.group(1)) + print "Diff: ", started - passed + + +if __name__ == "__main__": + main() -- GitLab