check_added_ut.sh 2.7 KB
Newer Older
C
chalsliu 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#!/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.

17 18
set +e
set -x
Y
YUNSHEN XIE 已提交
19
SYSTEM=`uname -s`
C
chalsliu 已提交
20 21 22 23
if [ -z ${BRANCH} ]; then
    BRANCH="develop"
fi

24
export CI_SKIP_CPP_TEST=OFF
Y
YUNSHEN XIE 已提交
25 26 27 28 29
if [[ "$SYSTEM" == "Linux" ]] || [[ "$SYSTEM" == "Darwin" ]];then
    PADDLE_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}")/../" && pwd )"
elif [[ "$SYSTEM" == "Windows_NT" ]];then
    PADDLE_ROOT="$(cd "$PWD/../" && pwd )"
fi
C
chalsliu 已提交
30 31
CURDIR=`pwd`
cd $PADDLE_ROOT
Y
YUNSHEN XIE 已提交
32 33 34 35 36 37 38
if [[ "$SYSTEM" == "Linux" ]] || [[ "$SYSTEM" == "Darwin" ]];then
    cp $PADDLE_ROOT/paddle/scripts/paddle_build.sh $PADDLE_ROOT/paddle/scripts/paddle_build_pre.sh
elif [[ "$SYSTEM" == "Windows_NT" ]];then
    git remote | grep upstream
    if [ $? != 0 ]; then 
        git remote add upstream https://github.com/PaddlePaddle/Paddle.git
    fi
39
    git fetch upstream ${BRANCH}
Y
YUNSHEN XIE 已提交
40
fi
C
chalsliu 已提交
41
CURBRANCH=`git rev-parse --abbrev-ref HEAD`
42
echo $CURBRANCH
Y
YUNSHEN XIE 已提交
43 44 45
if [ `git branch | grep 'prec_added_ut'` ];then
    git branch -D 'prec_added_ut'
fi
C
chalsliu 已提交
46
git checkout -b prec_added_ut upstream/${BRANCH}
Y
YUNSHEN XIE 已提交
47
git branch
C
chalsliu 已提交
48 49
mkdir prec_build
cd prec_build
Y
YUNSHEN XIE 已提交
50 51 52
if [[ "$SYSTEM" == "Linux" ]] || [[ "$SYSTEM" == "Darwin" ]];then
    bash $PADDLE_ROOT/paddle/scripts/paddle_build_pre.sh cmake_gen_in_current_dir >prebuild.log 2>&1
elif [[ "$SYSTEM" == "Windows_NT" ]];then
53
    bash $PADDLE_ROOT/win_cmake.sh >prec_build.log 2>&1
Y
YUNSHEN XIE 已提交
54 55
fi
ctest -N | awk -F ':' '{print $2}' | sed '/^$/d' | sed '$d' | sed 's/ //g' | grep 'test' > $PADDLE_ROOT/br-ut
C
chalsliu 已提交
56
cd $PADDLE_ROOT/build
Y
YUNSHEN XIE 已提交
57
ctest -N | awk -F ':' '{print $2}' | sed '/^$/d' | sed '$d' | sed 's/ //g' | grep 'test' > $PADDLE_ROOT/pr-ut
58 59
cd $PADDLE_ROOT
grep -F -x -v -f br-ut pr-ut > $PADDLE_ROOT/added_ut
Y
YUNSHEN XIE 已提交
60 61 62
if [[ "$SYSTEM" == 'Linux' ]];then
    sort pr-ut |uniq -d > $PADDLE_ROOT/duplicate_ut
fi
C
chalsliu 已提交
63
echo "New-UT:"
64
cat $PADDLE_ROOT/added_ut
C
chalsliu 已提交
65
rm -rf prec_build
Y
YUNSHEN XIE 已提交
66 67 68
if [[ "$SYSTEM" == "Linux" ]] || [[ "$SYSTEM" == "Darwin" ]];then
    rm $PADDLE_ROOT/br-ut $PADDLE_ROOT/pr-ut $PADDLE_ROOT/paddle/scripts/paddle_build_pre.sh
elif [[ "$SYSTEM" == "Windows_NT" ]];then
Z
Zhou Wei 已提交
69
    rm $PADDLE_ROOT/br-ut $PADDLE_ROOT/pr-ut $PADDLE_ROOT/win_cmake.sh
Y
YUNSHEN XIE 已提交
70 71
fi
git checkout -f $CURBRANCH
72
echo $CURBRANCH
C
chalsliu 已提交
73 74
git branch -D prec_added_ut
cd $CURDIR
75
export CI_SKIP_CPP_TEST=