Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add googletest to write unit tests for pi.proto #49

Merged
merged 1 commit into from
Oct 31, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add googletest to write unit tests for pi.proto
Added it as a submodule rather than copying whole code, but using my own
makefile. Only compiled when running 'make check' and if configure was
run with '--with-proto' (since we are only going to write unit tests for
pi.proto and proto frontend at first).
antoninbas committed Oct 28, 2016
commit bb8a2edfd002fed7e2938845b7edc1b6bcca5249
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "proto/googleapis"]
path = proto/googleapis
url = https://github.com/googleapis/googleapis.git
[submodule "third_party/googletest"]
path = third_party/googletest
url = https://github.com/google/googletest
3 changes: 3 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -43,6 +43,9 @@ AS_IF([test "$with_proto" = yes && test "$want_fe_cpp" = no], [
AM_CONDITIONAL([WITH_FE_CPP], [test "$want_fe_cpp" = yes])

AM_CONDITIONAL([WITH_PROTO], [test "$with_proto" = yes])
# may add other conditions later for GTEST to be compiled if we use GTEST
# somewhere else
AM_CONDITIONAL([WITH_GTEST], [test "$with_proto" = yes])
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with_gtest?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, with_proto
the comment explains that if googletest is used for something else than testing pi.proto, another condition can be added; right now it is only used for pi.proto so we only build it then


AC_ARG_WITH([internal-rpc],
AS_HELP_STRING([--with-internal-rpc],
2 changes: 1 addition & 1 deletion proto/Makefile.am
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ $(srcdir)/google/rpc/code.proto \
$(srcdir)/device.proto \
$(srcdir)/resource.proto

EXTRA_DIST = $(protos) google
EXTRA_DIST = $(protos)

proto_cpp_files = \
cpp_out/pi.pb.cc \
4 changes: 4 additions & 0 deletions third_party/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} -I m4

if WITH_GTEST
include gtest.am
endif

SUBDIRS = cJSON unity
1 change: 1 addition & 0 deletions third_party/googletest
Submodule googletest added at ecd530
45 changes: 45 additions & 0 deletions third_party/gtest.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
check_LTLIBRARIES = libgtest.la

libgtest_la_CPPFLAGS = \
-I$(srcdir)/googletest/googletest/include \
-I$(srcdir)/googletest/googletest

EXTRA_DIST = \
googletest/googletest/include/gtest/gtest-printers.h \
googletest/googletest/include/gtest/gtest-test-part.h \
googletest/googletest/include/gtest/internal/custom/gtest-printers.h \
googletest/googletest/include/gtest/internal/custom/gtest.h \
googletest/googletest/include/gtest/internal/custom/gtest-port.h \
googletest/googletest/include/gtest/internal/gtest-internal.h \
googletest/googletest/include/gtest/internal/gtest-port-arch.h \
googletest/googletest/include/gtest/internal/gtest-port.h \
googletest/googletest/include/gtest/internal/gtest-type-util.h \
googletest/googletest/include/gtest/internal/gtest-tuple.h \
googletest/googletest/include/gtest/internal/gtest-linked_ptr.h \
googletest/googletest/include/gtest/internal/gtest-string.h \
googletest/googletest/include/gtest/internal/gtest-filepath.h \
googletest/googletest/include/gtest/internal/gtest-param-util.h \
googletest/googletest/include/gtest/internal/gtest-death-test-internal.h \
googletest/googletest/include/gtest/internal/gtest-param-util-generated.h \
googletest/googletest/include/gtest/gtest-param-test.h \
googletest/googletest/include/gtest/gtest-typed-test.h \
googletest/googletest/include/gtest/gtest-message.h \
googletest/googletest/include/gtest/gtest_prod.h \
googletest/googletest/include/gtest/gtest_pred_impl.h \
googletest/googletest/include/gtest/gtest-spi.h \
googletest/googletest/include/gtest/gtest-death-test.h

EXTRA_DIST += \
googletest/googletest/src/gtest-test-part.cc \
googletest/googletest/src/gtest-filepath.cc \
googletest/googletest/src/gtest-typed-test.cc \
googletest/googletest/src/gtest-port.cc \
googletest/googletest/src/gtest_main.cc \
googletest/googletest/src/gtest-death-test.cc \
googletest/googletest/src/gtest.cc \
googletest/googletest/src/gtest-printers.cc \
googletest/googletest/src/gtest-internal-inl.h

libgtest_la_SOURCES = \
googletest/googletest/src/gtest-all.cc \
googletest/googletest/include/gtest/gtest.h