未验证 提交 0b3c2296 编写于 作者: Y YUNSHEN XIE 提交者: GitHub

Prec on mac (#31382)

* add precision on mac

* added judge

* match file_ut.json on mac

* fix code format error

* fix code format error

* fix error caused by length of ut_lists exceeds the limit

* fix format error,notest,test=cpu

* fix code format error

* add windows judge on get_pr_ut
上级 23d96cf2
...@@ -607,7 +607,16 @@ EOF ...@@ -607,7 +607,16 @@ EOF
echo "Unittests with nightly labels are only run at night" echo "Unittests with nightly labels are only run at night"
echo "=========================================" echo "========================================="
fi fi
bash $PADDLE_ROOT/tools/check_added_ut.sh
get_precision_ut_mac
if [[ "$on_precision" == "0" ]];then
ctest -E "($disable_ut_quickly)" -LE ${nightly_label} --output-on-failure -j $2 | tee $tmpfile ctest -E "($disable_ut_quickly)" -LE ${nightly_label} --output-on-failure -j $2 | tee $tmpfile
else
ctest -R "($UT_list_prec)" -E "($disable_ut_quickly)" -LE ${nightly_label} --output-on-failure -j $2 | tee $tmpfile
tmpfile_rand=`date +%s%N`
tmpfile=$tmp_dir/$tmpfile_rand
ctest -R "($UT_list_prec_1)" -E "($disable_ut_quickly)" -LE ${nightly_label} --output-on-failure -j $2 | tee $tmpfile
fi
failed_test_lists='' failed_test_lists=''
collect_failed_tests collect_failed_tests
mactest_error=0 mactest_error=0
...@@ -672,6 +681,42 @@ EOF ...@@ -672,6 +681,42 @@ EOF
fi fi
} }
function get_precision_ut_mac() {
on_precision=0
set -x
UT_list=$(ctest -N | awk -F ': ' '{print $2}' | sed '/^$/d' | sed '$d')
precison_cases=""
if [ ${PRECISION_TEST:-OFF} == "ON" ]; then
python3.7 $PADDLE_ROOT/tools/get_pr_ut.py
if [[ -f "ut_list" ]]; then
set +x
echo "PREC length: "`wc -l ut_list`
precision_cases=`cat ut_list`
set -x
fi
fi
if [ ${PRECISION_TEST:-OFF} == "ON" ] && [[ "$precision_cases" != "" ]];then
UT_list_re=''
on_precision=1
re=$(cat ut_list|awk -F ' ' '{print }' | awk 'BEGIN{ all_str=""}{if (all_str==""){all_str=$1}else{all_str=all_str"$|^"$1}} END{print "^"all_str"$"}')
UT_list_prec_1='ut_list_prec2'
for case in $UT_list; do
flag=$(echo $case|grep -oE $re)
if [ -n "$flag" ];then
if [ -z "$UT_list_prec" ];then
UT_list_prec="^$case$"
elif [[ "${#UT_list_prec}" -gt 10000 ]];then
UT_list_prec_1="$UT_list_prec_1|^$case$"
else
UT_list_prec="$UT_list_prec|^$case$"
fi
else
echo ${case} "won't run in PRECISION_TEST mode."
fi
done
fi
}
function fetch_upstream_develop_if_not_exist() { function fetch_upstream_develop_if_not_exist() {
UPSTREAM_URL='https://github.com/PaddlePaddle/Paddle' UPSTREAM_URL='https://github.com/PaddlePaddle/Paddle'
origin_upstream_url=`git remote -v | awk '{print $1, $2}' | uniq | grep upstream | awk '{print $2}'` origin_upstream_url=`git remote -v | awk '{print $1, $2}' | uniq | grep upstream | awk '{print $2}'`
......
...@@ -20,6 +20,7 @@ import sys ...@@ -20,6 +20,7 @@ import sys
import time import time
import subprocess import subprocess
import requests import requests
import platform
from github import Github from github import Github
PADDLE_ROOT = os.getenv('PADDLE_ROOT', '/paddle/') PADDLE_ROOT = os.getenv('PADDLE_ROOT', '/paddle/')
...@@ -210,6 +211,10 @@ class PRChecker(object): ...@@ -210,6 +211,10 @@ class PRChecker(object):
with open('file_ut.json' + self.suffix) as jsonfile: with open('file_ut.json' + self.suffix) as jsonfile:
file_ut_map = json.load(jsonfile) file_ut_map = json.load(jsonfile)
for f in self.get_pr_files(): for f in self.get_pr_files():
current_system = platform.system()
if current_system == "Darwin" or current_system == "Windows":
f = f.replace(PADDLE_ROOT, '/paddle/', 1)
f = f.replace('//', '/')
if f not in file_ut_map: if f not in file_ut_map:
if f.endswith('.md'): if f.endswith('.md'):
ut_list.append('md_placeholder') ut_list.append('md_placeholder')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册