Bug 1057584 - Add gtest framework and initial tests optionally (2/4). Build Changes. r=rrelyea
--- a/coreconf/ruleset.mk
+++ b/coreconf/ruleset.mk
@@ -107,21 +107,25 @@ endif
ifdef PROGRAMS
PROGRAMS := $(addprefix $(OBJDIR)/, $(PROGRAMS:%=%$(JDK_DEBUG_SUFFIX)$(PROG_SUFFIX)))
endif
ifndef TARGETS
TARGETS = $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM)
endif
+# Make both .cpp and .cc work.
+CPPSRCS1 = $(CPPSRCS:.cpp=$(OBJ_SUFFIX))
+CPPSRCS2 = $(CPPSRCS1:.cc=$(OBJ_SUFFIX))
+
ifndef OBJS
SIMPLE_OBJS = $(JRI_STUB_CFILES) \
$(addsuffix $(OBJ_SUFFIX), $(JMC_GEN)) \
$(CSRCS:.c=$(OBJ_SUFFIX)) \
- $(CPPSRCS:.cpp=$(OBJ_SUFFIX)) \
+ $(CPPSRCS2) \
$(ASFILES:$(ASM_SUFFIX)=$(OBJ_SUFFIX)) \
$(BUILT_CSRCS:.c=$(OBJ_SUFFIX)) \
$(BUILT_CPPSRCS:.cpp=$(OBJ_SUFFIX)) \
$(BUILT_ASFILES:$(ASM_SUFFIX)=$(OBJ_SUFFIX))
OBJS = $(addprefix $(OBJDIR)/$(PROG_PREFIX), $(SIMPLE_OBJS))
endif
ifndef BUILT_SRCS
new file mode 100644
--- /dev/null
+++ b/external_tests/Makefile
@@ -0,0 +1,44 @@
+#! gmake
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#######################################################################
+# (1) Include initial platform-independent assignments (MANDATORY). #
+#######################################################################
+
+include manifest.mn
+
+#######################################################################
+# (2) Include "global" configuration information. (OPTIONAL) #
+#######################################################################
+
+include $(CORE_DEPTH)/coreconf/config.mk
+
+#######################################################################
+# (3) Include "component" configuration information. (OPTIONAL) #
+#######################################################################
+
+
+
+#######################################################################
+# (4) Include "local" platform-dependent assignments (OPTIONAL). #
+#######################################################################
+
+
+#######################################################################
+# (5) Execute "global" rules. (OPTIONAL) #
+#######################################################################
+
+include $(CORE_DEPTH)/coreconf/rules.mk
+
+#######################################################################
+# (6) Execute "component" rules. (OPTIONAL) #
+#######################################################################
+
+
+
+#######################################################################
+# (7) Execute "local" rules. (OPTIONAL). #
+#######################################################################
new file mode 100644
--- /dev/null
+++ b/external_tests/google_test/Makefile
@@ -0,0 +1,45 @@
+#! gmake
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#######################################################################
+# (1) Include initial platform-independent assignments (MANDATORY). #
+#######################################################################
+
+include manifest.mn
+
+#######################################################################
+# (2) Include "global" configuration information. (OPTIONAL) #
+#######################################################################
+
+include $(CORE_DEPTH)/coreconf/config.mk
+
+#######################################################################
+# (3) Include "component" configuration information. (OPTIONAL) #
+#######################################################################
+
+
+
+#######################################################################
+# (4) Include "local" platform-dependent assignments (OPTIONAL). #
+#######################################################################
+
+
+#######################################################################
+# (5) Execute "global" rules. (OPTIONAL) #
+#######################################################################
+
+include $(CORE_DEPTH)/coreconf/rules.mk
+
+#######################################################################
+# (6) Execute "component" rules. (OPTIONAL) #
+#######################################################################
+
+
+#######################################################################
+# (7) Execute "local" rules. (OPTIONAL). #
+#######################################################################
+
+MKSHLIB = $(CCC) $(DSO_LDOPTS) $(DARWIN_SDK_SHLIBFLAGS)
new file mode 100644
--- /dev/null
+++ b/external_tests/google_test/manifest.mn
@@ -0,0 +1,22 @@
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+CORE_DEPTH = ../..
+
+MODULE = gtest
+LIBRARY_NAME = gtest
+LIBRARY_VERSION = 1
+
+INCLUDES += -Igtest/include/ -Igtest
+
+CPPSRCS = \
+ gtest/src/gtest-all.cc \
+ $(NULL)
+
+
+EXPORTS = \
+ $(NULL)
+
+
+
new file mode 100644
--- /dev/null
+++ b/external_tests/manifest.mn
@@ -0,0 +1,11 @@
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+CORE_DEPTH = ..
+DEPTH = ..
+
+DIRS = \
+ google_test \
+ ssl_gtest \
+ $(NULL)
new file mode 100644
--- /dev/null
+++ b/external_tests/ssl_gtest/Makefile
@@ -0,0 +1,48 @@
+#! gmake
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#######################################################################
+# (1) Include initial platform-independent assignments (MANDATORY). #
+#######################################################################
+
+include manifest.mn
+
+#######################################################################
+# (2) Include "global" configuration information. (OPTIONAL) #
+#######################################################################
+
+include $(CORE_DEPTH)/coreconf/config.mk
+
+#######################################################################
+# (3) Include "component" configuration information. (OPTIONAL) #
+#######################################################################
+
+
+#######################################################################
+# (4) Include "local" platform-dependent assignments (OPTIONAL). #
+#######################################################################
+
+include ../../cmd/platlibs.mk
+
+#######################################################################
+# (5) Execute "global" rules. (OPTIONAL) #
+#######################################################################
+
+include $(CORE_DEPTH)/coreconf/rules.mk
+
+#######################################################################
+# (6) Execute "component" rules. (OPTIONAL) #
+#######################################################################
+
+
+#######################################################################
+# (7) Execute "local" rules. (OPTIONAL). #
+#######################################################################
+
+MKPROG = $(CXX)
+CFLAGS += -std=c++0x
+include ../../cmd/platrules.mk
+
new file mode 100644
--- /dev/null
+++ b/external_tests/ssl_gtest/manifest.mn
@@ -0,0 +1,21 @@
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+CORE_DEPTH = ../..
+DEPTH = ../..
+MODULE = nss
+
+CPPSRCS = \
+ ssl_loopback_unittest.cc \
+ ssl_gtest.cc \
+ test_io.cc \
+ tls_parser.cc \
+ $(NULL)
+
+INCLUDES += -I$(CORE_DEPTH)/external_tests/google_test/gtest/include
+
+REQUIRES = nspr nss libdbm gtest
+
+PROGRAM = ssl_gtest
+EXTRA_LIBS = $(DIST)/lib/$(LIB_PREFIX)gtest.$(LIB_SUFFIX)
--- a/manifest.mn
+++ b/manifest.mn
@@ -6,8 +6,12 @@ CORE_DEPTH = .
DEPTH = .
IMPORTS = nspr20/v4.8 \
$(NULL)
RELEASE = nss
DIRS = coreconf lib cmd
+
+ifdef NSS_BUILD_GTESTS
+DIRS += external_tests
+endif