summaryrefslogtreecommitdiff
path: root/gtests/common
diff options
context:
space:
mode:
authorDaiki Ueno <dueno@redhat.com>2017-06-01 10:47:30 +0200
committerDaiki Ueno <dueno@redhat.com>2017-06-01 10:47:30 +0200
commit2821ed9da4b05bceddb930961be28e07d320c7e6 (patch)
treec1b6358e1f44b6fe9f6ee33dbec494217357391c /gtests/common
parent3adde469bf542407a9f9a42593500af8bad76738 (diff)
downloadnss-hg-2821ed9da4b05bceddb930961be28e07d320c7e6.tar.gz
Bug 1280846 - tests: adjust gtests to compile under modular builds, r=franziskus
Diffstat (limited to 'gtests/common')
-rw-r--r--gtests/common/gtests-util.cc26
-rw-r--r--gtests/common/manifest.mn13
2 files changed, 33 insertions, 6 deletions
diff --git a/gtests/common/gtests-util.cc b/gtests/common/gtests-util.cc
new file mode 100644
index 000000000..e5eca06ec
--- /dev/null
+++ b/gtests/common/gtests-util.cc
@@ -0,0 +1,26 @@
+/* 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/. */
+
+#include "nspr.h"
+#include "secoid.h"
+
+#include <cstdlib>
+
+#define GTEST_HAS_RTTI 0
+#include "gtest/gtest.h"
+
+int main(int argc, char **argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+
+ if (SECOID_Init() != SECSuccess) {
+ return 1;
+ }
+ int rv = RUN_ALL_TESTS();
+
+ if (SECOID_Shutdown() != SECSuccess) {
+ return 1;
+ }
+
+ return rv;
+}
diff --git a/gtests/common/manifest.mn b/gtests/common/manifest.mn
index a40989bf7..5d36c269f 100644
--- a/gtests/common/manifest.mn
+++ b/gtests/common/manifest.mn
@@ -6,9 +6,13 @@ CORE_DEPTH = ../..
DEPTH = ../..
MODULE = nss
-CPPSRCS = \
- gtests.cc \
- $(NULL)
+LIBRARY_NAME = gtestutil
+
+ifeq ($(NSS_BUILD_UTIL_ONLY),1)
+CPPSRCS = gtests-util.cc
+else
+CPPSRCS = gtests.cc
+endif
INCLUDES += -I$(CORE_DEPTH)/gtests/google_test/gtest/include \
-I$(CORE_DEPTH)/gtests/common \
@@ -17,6 +21,3 @@ INCLUDES += -I$(CORE_DEPTH)/gtests/google_test/gtest/include \
REQUIRES = gtest
EXTRA_LIBS = $(DIST)/lib/$(LIB_PREFIX)gtest.$(LIB_SUFFIX)
-
-# NOTE: this is not actually used but required to build gtests.o
-PROGRAM = gtests