Auto merge of #1772 - str4d:temporary-gtest-bug-workaround, r=ebfull

Temporary gtest bug workaround

Replaces the previous partial fix from #1771 with a temporary workaround that prevents all issues.
This commit is contained in:
zkbot 2016-11-03 23:19:51 +00:00
commit 9752e57739
3 changed files with 15 additions and 11 deletions

View File

@ -8,7 +8,6 @@ zcash_gtest_SOURCES = \
gtest/main.cpp \
gtest/utils.cpp \
gtest/test_checktransaction.cpp \
gtest/test_checkblock.cpp \
gtest/json_test_vectors.cpp \
gtest/json_test_vectors.h \
gtest/test_foundersreward.cpp \
@ -28,6 +27,7 @@ zcash_gtest_SOURCES = \
gtest/test_txid.cpp \
gtest/test_libzcash_utils.cpp \
gtest/test_proofs.cpp \
gtest/test_checkblock.cpp \
wallet/gtest/test_wallet.cpp
zcash_gtest_CPPFLAGS = -DMULTICORE -fopenmp -DBINARY_OUTPUT -DCURVE_ALT_BN128 -DSTATIC

View File

@ -1,24 +1,14 @@
#include "gtest/gtest.h"
#include "crypto/common.h"
#include "wallet/db.h"
#include "libsnark/common/default_types/r1cs_ppzksnark_pp.hpp"
#include "libsnark/zk_proof_systems/ppzksnark/r1cs_ppzksnark/r1cs_ppzksnark.hpp"
#include <boost/filesystem.hpp>
int main(int argc, char **argv) {
assert(init_and_check_sodium() != -1);
libsnark::default_r1cs_ppzksnark_pp::init_public_params();
libsnark::inhibit_profiling_info = true;
libsnark::inhibit_profiling_counters = true;
// Get temporary and unique path for walletdb.
// bitdb.Open() only intialises once, so this dir is used for all tests.
// Note: / operator to append paths
boost::filesystem::path pathTemp = boost::filesystem::temp_directory_path() / boost::filesystem::unique_path();
boost::filesystem::create_directories(pathTemp);
bitdb.Open(pathTemp);
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();

View File

@ -5,6 +5,8 @@
#include "wallet/walletdb.h"
#include "util.h"
#include <boost/filesystem.hpp>
/**
* This test covers methods on CWallet
* GenerateNewZKey()
@ -71,6 +73,12 @@ TEST(wallet_zkeys_tests, store_and_load_zkeys) {
TEST(wallet_zkeys_tests, write_zkey_direct_to_db) {
SelectParams(CBaseChainParams::TESTNET);
// Get temporary and unique path for file.
// Note: / operator to append paths
boost::filesystem::path pathTemp = boost::filesystem::temp_directory_path() / boost::filesystem::unique_path();
boost::filesystem::create_directories(pathTemp);
mapArgs["-datadir"] = pathTemp.string();
bool fFirstRun;
CWallet wallet("wallet.dat");
ASSERT_EQ(DB_LOAD_OK, wallet.LoadWallet(fFirstRun));
@ -140,6 +148,12 @@ TEST(wallet_zkeys_tests, write_cryptedzkey_direct_to_db) {
SelectParams(CBaseChainParams::TESTNET);
// Get temporary and unique path for file.
// Note: / operator to append paths
boost::filesystem::path pathTemp = boost::filesystem::temp_directory_path() / boost::filesystem::unique_path();
boost::filesystem::create_directories(pathTemp);
mapArgs["-datadir"] = pathTemp.string();
bool fFirstRun;
CWallet wallet("wallet_crypted.dat");
ASSERT_EQ(DB_LOAD_OK, wallet.LoadWallet(fFirstRun));