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 1280846 - tests: adjust gtests to compile under modular builds, r…
…=franziskus --HG-- extra : histedit_source : fb4abd45b84a6ecbde7a5de16131b033066f8c11
- Loading branch information
Showing
17 changed files
with
229 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* -*- 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/. */ | ||
|
||
#ifndef scoped_ptrs_util_h__ | ||
#define scoped_ptrs_util_h__ | ||
|
||
#include <memory> | ||
#include "pkcs11uri.h" | ||
#include "secoid.h" | ||
|
||
struct ScopedDelete { | ||
void operator()(SECAlgorithmID* id) { SECOID_DestroyAlgorithmID(id, true); } | ||
void operator()(SECItem* item) { SECITEM_FreeItem(item, true); } | ||
void operator()(PK11URI* uri) { PK11URI_DestroyURI(uri); } | ||
void operator()(PLArenaPool* arena) { PORT_FreeArena(arena, PR_FALSE); } | ||
}; | ||
|
||
template <class T> | ||
struct ScopedMaybeDelete { | ||
void operator()(T* ptr) { | ||
if (ptr) { | ||
ScopedDelete del; | ||
del(ptr); | ||
} | ||
} | ||
}; | ||
|
||
#define SCOPED(x) typedef std::unique_ptr<x, ScopedMaybeDelete<x> > Scoped##x | ||
|
||
SCOPED(SECAlgorithmID); | ||
SCOPED(SECItem); | ||
SCOPED(PK11URI); | ||
|
||
#undef SCOPED | ||
|
||
#endif // scoped_ptrs_util_h__ |
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,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; | ||
} |
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
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
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
Oops, something went wrong.