Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Bug 1515236 - Add a test that SSLKEYLOGFILE and SSLDEBUGFILE init pro…
…perly r=mt There is a new test here because the keylog unittest sets the environment variable for SSLKEYLOG and NSPR provides no mechanism (cross-platform-wise) to actually delete an environment variable, so I made another file for the base uninitialized case. --HG-- extra : absorb_source : e5c5d2f90dfcc860079054ba8c799758faeb8d51 extra : transplant_source : %FFY%5E5%A6%D6%89%1E%87%BA%2B%04%1F%85R%F3%7F%AF%D2v
- Loading branch information
Showing
5 changed files
with
143 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | ||
/* vim: set ts=2 et sw=2 tw=80: */ | ||
/* 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 <cstdlib> | ||
#include <fstream> | ||
#include <sstream> | ||
|
||
#include "gtest_utils.h" | ||
#include "tls_connect.h" | ||
|
||
namespace nss_test { | ||
|
||
extern "C" { | ||
extern FILE* ssl_trace_iob; | ||
|
||
#ifdef NSS_ALLOW_SSLKEYLOGFILE | ||
extern FILE* ssl_keylog_iob; | ||
#endif | ||
} | ||
|
||
// These tests ensure that when the associated environment variables are unset | ||
// that the lazily-initialized defaults are what they are supposed to be. | ||
|
||
#ifdef DEBUG | ||
TEST_P(TlsConnectGeneric, DebugEnvTraceFileNotSet) { | ||
char* ev = PR_GetEnvSecure("SSLDEBUGFILE"); | ||
if (ev && ev[0]) { | ||
// note: should use GTEST_SKIP when GTest gets updated to support it | ||
return; | ||
} | ||
|
||
Connect(); | ||
EXPECT_EQ(stderr, ssl_trace_iob); | ||
} | ||
#endif | ||
|
||
#ifdef NSS_ALLOW_SSLKEYLOGFILE | ||
TEST_P(TlsConnectGeneric, DebugEnvKeylogFileNotSet) { | ||
char* ev = PR_GetEnvSecure("SSLKEYLOGFILE"); | ||
if (ev && ev[0]) { | ||
// note: should use GTEST_SKIP when GTest gets updated to support it | ||
return; | ||
} | ||
|
||
Connect(); | ||
EXPECT_EQ(nullptr, ssl_keylog_iob); | ||
} | ||
#endif | ||
|
||
} // namespace nss_test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters