未验证 提交 7a15e640 编写于 作者: C chalsliu 提交者: GitHub

Support precision test for new ut

上级 173c22ae
......@@ -294,6 +294,10 @@ function cmake_gen() {
cmake_base $1
}
function cmake_gen_in_current_dir() {
cmake_base $1
}
function abort(){
echo "Your change doesn't follow PaddlePaddle's code style." 1>&2
echo "Please use pre-commit to check what is wrong." 1>&2
......@@ -1777,6 +1781,9 @@ function main() {
cmake_gen)
cmake_gen ${PYTHON_ABI:-""}
;;
cmake_gen_in_current_dir)
cmake_gen_in_current_dir ${PYTHON_ABI:-""}
;;
gen_fluid_lib)
gen_fluid_lib ${parallel_number}
;;
......
#!/bin/bash
# Copyright (c) 2020 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.
set -e
if [ -z ${BRANCH} ]; then
BRANCH="develop"
fi
PADDLE_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}")/../" && pwd )"
CURDIR=`pwd`
cd $PADDLE_ROOT
cp $PADDLE_ROOT/paddle/scripts/paddle_build.sh $PADDLE_ROOT/paddle/scripts/paddle_build_pre.sh
CURBRANCH=`git rev-parse --abbrev-ref HEAD`
git checkout -b prec_added_ut upstream/${BRANCH}
mkdir prec_build
cd prec_build
bash $PADDLE_ROOT/paddle/scripts/paddle_build_pre.sh cmake_gen_in_current_dir >prebuild.log 2>&1
ctest -N | awk -F ':' '{print $2}' | sed '/^$/d' | sed '$d' | sed 's/ //g' > /$PADDLE_ROOT/br-ut
cd $PADDLE_ROOT/build
ctest -N | awk -F ':' '{print $2}' | sed '/^$/d' | sed '$d' | sed 's/ //g' > /$PADDLE_ROOT/pr-ut
cd /$PADDLE_ROOT
grep -F -x -v -f br-ut pr-ut > /$PADDLE_ROOT/added_ut
echo "New-UT:"
cat /$PADDLE_ROOT/added_ut
rm -rf prec_build
rm /$PADDLE_ROOT/br-ut /$PADDLE_ROOT/pr-ut $PADDLE_ROOT/paddle/scripts/paddle_build_pre.sh
git checkout $CURBRANCH
git branch -D prec_added_ut
cd $CURDIR
......@@ -51,6 +51,7 @@ class PRChecker(object):
def get_pr_ut(self):
""" Get unit tests in pull request. """
check_added_ut = False
ut_list = []
file_ut_map = None
cmd = 'wget -q --no-check-certificate https://sys-p0.bj.bcebos.com/prec/file_ut.json'
......@@ -58,10 +59,14 @@ class PRChecker(object):
with open('file_ut.json') as jsonfile:
file_ut_map = json.load(jsonfile)
for f in self.get_pr_files():
if f not in file_ut_map:
return ''
if f.endswith('.h') or f.endswith('.cu'):
return ''
if f not in file_ut_map:
if f.find('test_') != -1 or f.find('_test') != -1:
check_added_ut = True
continue
else:
return ''
else:
ut_list.extend(file_ut_map.get(f))
ut_list = list(set(ut_list))
......@@ -71,6 +76,14 @@ class PRChecker(object):
for ut in delta:
ut_list.append(ut.rstrip('\r\n'))
if check_added_ut:
cmd = 'bash {}/tools/check_added_ut.sh'.format(PADDLE_ROOT)
os.system(cmd)
with open('{}/added_ut'.format(PADDLE_ROOT)) as utfile:
for ut in utfile:
ut_list.append(ut.rstrip('\r\n'))
return ' '.join(ut_list)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册