diff options
Diffstat (limited to 'security/nss/gtests/common/gtests.cc')
-rw-r--r-- | security/nss/gtests/common/gtests.cc | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/security/nss/gtests/common/gtests.cc b/security/nss/gtests/common/gtests.cc index bd5a97a8e..d0f21ee04 100644 --- a/security/nss/gtests/common/gtests.cc +++ b/security/nss/gtests/common/gtests.cc @@ -1,6 +1,5 @@ #include "nspr.h" #include "nss.h" -#include "ssl.h" #include <cstdlib> @@ -10,10 +9,23 @@ int main(int argc, char **argv) { ::testing::InitGoogleTest(&argc, argv); - if (NSS_NoDB_Init(nullptr) != SECSuccess) { - return 1; + const char *workdir = ""; + uint32_t flags = NSS_INIT_READONLY; + + for (int i = 0; i < argc; i++) { + if (!strcmp(argv[i], "-d")) { + if (i + 1 >= argc) { + PR_fprintf(PR_STDERR, "Usage: %s [-d <dir> [-w]]\n", argv[0]); + exit(2); + } + workdir = argv[i + 1]; + i++; + } else if (!strcmp(argv[i], "-w")) { + flags &= ~NSS_INIT_READONLY; + } } - if (NSS_SetDomesticPolicy() != SECSuccess) { + + if (NSS_Initialize(workdir, "", "", SECMOD_DB, flags) != SECSuccess) { return 1; } int rv = RUN_ALL_TESTS(); |