Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
9b94773a
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9b94773a
编写于
12月 11, 2016
作者:
Y
Yi Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add gtest
上级
8013d17d
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
72 addition
and
6 deletion
+72
-6
WORKSPACE
WORKSPACE
+14
-0
doc/getstarted/build_and_install/docker_install_en.rst
doc/getstarted/build_and_install/docker_install_en.rst
+3
-2
third_party/gtest.BUILD
third_party/gtest.BUILD
+14
-0
third_party/protobuf_test/BUILD
third_party/protobuf_test/BUILD
+11
-0
third_party/protobuf_test/example.proto
third_party/protobuf_test/example.proto
+1
-1
third_party/protobuf_test/example_lib.cc
third_party/protobuf_test/example_lib.cc
+7
-2
third_party/protobuf_test/example_lib.h
third_party/protobuf_test/example_lib.h
+7
-1
third_party/protobuf_test/example_lib_test.cc
third_party/protobuf_test/example_lib_test.cc
+15
-0
未找到文件。
WORKSPACE
浏览文件 @
9b94773a
# External dependency to grpc-enabled Google-styleprotobuf bulding
# rules. This method comes from
# https://github.com/pubref/rules_protobuf#usage.
git_repository
(
name
=
"org_pubref_rules_protobuf"
,
remote
=
"https://github.com/pubref/rules_protobuf"
,
tag
=
"v0.7.1"
,
)
# External dependency to gtest 1.7.0. This method comes from
# https://www.bazel.io/versions/master/docs/tutorial/cpp.html.
new_http_archive
(
name
=
"gtest"
,
url
=
"https://github.com/google/googletest/archive/release-1.7.0.zip"
,
sha256
=
"b58cb7547a28b2c718d1e38aee18a3659c9e3ff52440297e965f5edffe34b6d0"
,
build_file
=
"third_party/gtest.BUILD"
,
strip_prefix
=
"googletest-release-1.7.0"
,
)
load
(
"@org_pubref_rules_protobuf//cpp:rules.bzl"
,
"cpp_proto_repositories"
)
cpp_proto_repositories
()
doc/getstarted/build_and_install/docker_install_en.rst
浏览文件 @
9b94773a
...
...
@@ -161,12 +161,13 @@ The general development workflow with Docker and Bazel is as follows:
cd /paddle # where paddle source code has been mounted into the container
mkdir -p build
cd build
cmake ..
cmake
-DWITH_TESTING=ON
..
make -j `nproc`
CTEST_OUTPUT_ON_FAILURE=1 ctest
or Bazel in the container:
.. code-block:: bash
cd /paddle
bazel
build
...
bazel
test
...
third_party/gtest.BUILD
0 → 100644
浏览文件 @
9b94773a
cc_library(
name = "main",
srcs = glob(
["src/*.cc"],
exclude = ["src/gtest-all.cc"]
),
hdrs = glob([
"include/**/*.h",
"src/*.h"
]),
copts = ["-Iexternal/gtest/include"],
linkopts = ["-pthread"],
visibility = ["//visibility:public"],
)
third_party/protobuf_test/BUILD
浏览文件 @
9b94773a
...
...
@@ -7,6 +7,7 @@ cpp_proto_library(
protos
=
[
"example.proto"
],
with_grpc
=
True
,
)
cc_library
(
...
...
@@ -15,3 +16,13 @@ cc_library(
hdrs
=
[
"example_lib.h"
],
deps
=
[
":example_proto"
],
)
cc_test
(
name
=
"example_lib_test"
,
srcs
=
[
"example_lib_test.cc"
],
copts
=
[
"-Iexternal/gtest/include"
],
deps
=
[
"@gtest//:main"
,
":example_lib"
,
],
)
third_party/protobuf_test/example.proto
浏览文件 @
9b94773a
syntax
=
"proto3"
;
package
protos
;
package
third_party
.
protobuf_test
;
message
Greeting
{
string
name
=
1
;
...
...
third_party/protobuf_test/example_lib.cc
浏览文件 @
9b94773a
#include "third_party/protobuf_test/example_lib.h"
#include <string>
std
::
string
get_greet
(
const
::
protos
::
Greeting
&
who
)
{
namespace
third_party
{
namespace
protobuf_test
{
std
::
string
get_greet
(
const
Greeting
&
who
)
{
return
"Hello "
+
who
.
name
();
}
}
// namespace protobuf_test
}
// namespace thrid_party
third_party/protobuf_test/example_lib.h
浏览文件 @
9b94773a
...
...
@@ -4,4 +4,10 @@
#include <string>
std
::
string
get_greet
(
const
::
protos
::
Greeting
&
who
);
namespace
third_party
{
namespace
protobuf_test
{
std
::
string
get_greet
(
const
Greeting
&
who
);
}
// namespace protobuf_test
}
// namespace third_party
third_party/protobuf_test/example_lib_test.cc
0 → 100644
浏览文件 @
9b94773a
#include "third_party/protobuf_test/example_lib.h"
#include "gtest/gtest.h"
namespace
third_party
{
namespace
protobuf_test
{
TEST
(
ProtobufTest
,
GetGreet
)
{
Greeting
g
;
g
.
set_name
(
"Paddle"
);
EXPECT_EQ
(
"Hello Paddle"
,
get_greet
(
g
));
}
}
// namespace protobuf_test
}
// namespace third_party
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录