From 0f78ddb90f6c3eb888a19e97a6e95f43155efe23 Mon Sep 17 00:00:00 2001 From: YUNSHEN XIE <1084314248@qq.com> Date: Tue, 1 Jun 2021 15:35:51 +0800 Subject: [PATCH] Fix path error on windows (#33122) * fix path error on windows when precision switch is turn on * fix error * Update get_pr_ut.py fix format error * Update get_pr_ut.py --- tools/get_pr_ut.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tools/get_pr_ut.py b/tools/get_pr_ut.py index 5d15443e384..78d9978c4bc 100644 --- a/tools/get_pr_ut.py +++ b/tools/get_pr_ut.py @@ -248,13 +248,15 @@ class PRChecker(object): return True def get_all_count(self): - os.system( - "cd %sbuild && ctest -N|grep 'Total Tests:' | awk -F ': ' '{print $2}' > testCount" - % PADDLE_ROOT) - f = open("%sbuild/testCount" % PADDLE_ROOT) - testCount = f.read() - f.close() - return int(testCount.strip()) + p = subprocess.Popen( + "cd {}build && ctest -N".format(PADDLE_ROOT), + shell=True, + stdout=subprocess.PIPE) + out, err = p.communicate() + for line in out.splitlines(): + if 'Total Tests:' in str(line): + all_counts = line.split()[-1] + return int(all_counts) def get_pr_ut(self): """ Get unit tests in pull request. """ -- GitLab