Skip to content

Commit 010dd20

Browse files
authored
Merge pull request #1163 from reyoung/feature/fix_error_msg_in_test_configHelpers
Fix bugs in config_helpers unittest.
2 parents 92d75f1 + a5c1658 commit 010dd20

File tree

2 files changed

+15
-20
lines changed

2 files changed

+15
-20
lines changed

python/paddle/trainer_config_helpers/tests/CMakeLists.txt

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,10 @@ add_test(NAME test_reset_hook
99
${PYTHON_EXECUTABLE} ${PROJ_ROOT}/python/paddle/trainer_config_helpers/tests/test_reset_hook.py
1010
WORKING_DIRECTORY ${PROJ_ROOT}/python/paddle)
1111

12-
if (PROTOBUF_3)
13-
add_paddle_exe(protobuf_equal
14-
ProtobufEqualMain.cpp)
15-
add_test(NAME test_layerHelpers
16-
COMMAND
17-
${PROJ_ROOT}/python/paddle/trainer_config_helpers/tests/configs/run_tests.sh ${PYTHON_EXECUTABLE}
18-
${CMAKE_CURRENT_BINARY_DIR}/protobuf_equal
19-
)
20-
else()
21-
add_test(NAME test_layerHelpers
22-
COMMAND
23-
${PROJ_ROOT}/python/paddle/trainer_config_helpers/tests/configs/run_tests.sh ${PYTHON_EXECUTABLE}
24-
)
25-
endif()
12+
add_paddle_exe(protobuf_equal
13+
ProtobufEqualMain.cpp)
14+
add_test(NAME test_layerHelpers
15+
COMMAND
16+
${PROJ_ROOT}/python/paddle/trainer_config_helpers/tests/configs/run_tests.sh ${PYTHON_EXECUTABLE}
17+
${CMAKE_CURRENT_BINARY_DIR}/protobuf_equal
18+
)

python/paddle/trainer_config_helpers/tests/configs/run_tests.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@
22
cd `dirname $0`
33

44
set -e
5+
PYTHON_EXEC=$1
6+
COMPARE_PROTO_UTIL=$2
57

68
protostr=`dirname $0`/protostr
79

810
files=`ls $protostr | grep -v "unittest"`
911

10-
./generate_protostr.sh $1
12+
./generate_protostr.sh ${PYTHON_EXEC}
1113

1214
. ./file_list.sh
1315

14-
if [ -z $1 ]; then
16+
if [ -z ${COMPARE_PROTO_UTIL} ]; then
1517
for file in $files
1618
do
1719
base_protostr=$protostr/$file
@@ -22,20 +24,20 @@ if [ -z $1 ]; then
2224
else
2325
for file in ${configs[*]}
2426
do
25-
if ! $1 $protostr/$file.protostr $protostr/$file.protostr.unittest; then
27+
if ! ${COMPARE_PROTO_UTIL} $protostr/$file.protostr $protostr/$file.protostr.unittest; then
2628
diff $protostr/$file.protostr $protostr/$file.protostr.unittest -u
2729
fi
28-
if ! $1 $protostr/$file.protostr $protostr/$file.protostr.non_file_config.unittest; then
30+
if ! ${COMPARE_PROTO_UTIL} $protostr/$file.protostr $protostr/$file.protostr.non_file_config.unittest; then
2931
diff $protostr/$file.protostr $protostr/$file.protostr.non_file_config.unittest -u
3032
fi
3133
done
3234

3335
for file in ${whole_configs[*]}
3436
do
35-
if ! $1 $protostr/$file.protostr $protostr/$file.protostr.unittest --whole; then
37+
if ! ${COMPARE_PROTO_UTIL} $protostr/$file.protostr $protostr/$file.protostr.unittest --whole; then
3638
diff $protostr/$file.protostr $protostr/$file.protostr.unittest -u
3739
fi
38-
if ! $1 $protostr/$file.protostr $protostr/$file.protostr.non_file_config.unittest --whole; then
40+
if ! ${COMPARE_PROTO_UTIL} $protostr/$file.protostr $protostr/$file.protostr.non_file_config.unittest --whole; then
3941
diff $protostr/$file.protostr $protostr/$file.protostr.non_file_config.unittest -u
4042
fi
4143
done

0 commit comments

Comments
 (0)