Ejemplo n.º 1
0
 TestingSetup() {
     fPrintToDebugger = true; // don't want to write to debug.log file
     noui_connect();
     bitdb.MakeMock();
     pathTemp = GetTempPath() / strprintf("test_gaycoin_%lu_%i", (unsigned long)GetTime(), (int)(GetRand(100000)));
     boost::filesystem::create_directories(pathTemp);
     mapArgs["-datadir"] = pathTemp.string();
     pblocktree = new CBlockTreeDB(1 << 20, true);
     pcoinsdbview = new CCoinsViewDB(1 << 23, true);
     pcoinsTip = new CCoinsViewCache(*pcoinsdbview);
     InitBlockIndex();
     bool fFirstRun;
     pwalletMain = new CWallet("wallet.dat");
     pwalletMain->LoadWallet(fFirstRun);
     RegisterWallet(pwalletMain);
     nScriptCheckThreads = 3;
     for (int i=0; i < nScriptCheckThreads-1; i++)
         threadGroup.create_thread(&ThreadScriptCheck);
 }
Ejemplo n.º 2
0
    TestingSetup() {
        fPrintToDebugLog = false; // don't want to write to debug.log file
        noui_connect();
#ifdef ENABLE_WALLET
        bitcoin_bitdb.MakeMock();
        bitcredit_bitdb.MakeMock();
        deposit_bitdb.MakeMock();
#endif
        pathTemp = GetTempPath() / strprintf("test_credits_%lu_%i", (unsigned long)GetTime(), (int)(GetRand(100000)));
        boost::filesystem::create_directories(pathTemp);
        mapArgs["-datadir"] = pathTemp.string();

        bitcredit_pblocktree = new Credits_CBlockTreeDB(1 << 20, true);
        bitcredit_pcoinsdbview = new Credits_CCoinsViewDB(1 << 23, true);
        credits_pcoinsTip = new Credits_CCoinsViewCache(*bitcredit_pcoinsdbview);

        bitcoin_pblocktree = new Bitcoin_CBlockTreeDB(1 << 20, true);
        bitcoin_pcoinsdbview = new Bitcoin_CCoinsViewDB(1 << 23, true);
        bitcoin_pcoinsTip = new Bitcoin_CCoinsViewCache(*bitcoin_pcoinsdbview);

        Bitcoin_InitBlockIndex();
        Credits_InitBlockIndex();

#ifdef ENABLE_WALLET
        bool fFirstRun;
        bitcoin_pwalletMain = new Bitcoin_CWallet("bitcoin_wallet.dat");
        bitcoin_pwalletMain->LoadWallet(fFirstRun);
        Bitcoin_RegisterWallet(bitcoin_pwalletMain);

        bitcredit_pwalletMain = new Credits_CWallet("credits_wallet.dat", &bitcredit_bitdb);
        bitcredit_pwalletMain->LoadWallet(fFirstRun, bitcredit_nAccountingEntryNumber);
        Bitcredit_RegisterWallet(bitcredit_pwalletMain);

        deposit_pwalletMain = new Credits_CWallet("deposit_wallet.dat", &deposit_bitdb);
        deposit_pwalletMain->LoadWallet(fFirstRun, deposit_nAccountingEntryNumber);
        Bitcredit_RegisterWallet(deposit_pwalletMain);
#endif
        bitcredit_nScriptCheckThreads = 3;
        for (int i=0; i < bitcredit_nScriptCheckThreads-1; i++)
            threadGroup.create_thread(&Bitcredit_ThreadScriptCheck);
        Bitcredit_RegisterNodeSignals(Credits_NetParams()->GetNodeSignals());
    }
Ejemplo n.º 3
0
std::tuple<bool, boost::thread*> RunDacrs(int argc, char* argv[]) {
	boost::thread* detectShutdownThread = NULL;
	static boost::thread_group threadGroup;
	SetupEnvironment();

	bool fRet = false;

	// Connect Dacrsd signal handlers
	noui_connect();

	fRet = AppInit(argc, argv, threadGroup);

	detectShutdownThread = new boost::thread(boost::bind(&DetectShutdownThread, &threadGroup));

	if (!fRet) {
		if (detectShutdownThread)
			detectShutdownThread->interrupt();

		threadGroup.interrupt_all();
	}
	return std::make_tuple(fRet, detectShutdownThread);
}
Ejemplo n.º 4
0
// This is all you need to run all the tests
int main(int argc, char *argv[])
{
    ECC_Start();
    SetupEnvironment();
    SetupNetworking();
    SelectParams(CBaseChainParams::MAIN);
    noui_connect();

    bool fInvalid = false;

    // Don't remove this, it's needed to access
    // QCoreApplication:: in the tests
    QCoreApplication app(argc, argv);
    app.setApplicationName("Dash-Qt-test");

    SSL_library_init();

    URITests test1;
    if (QTest::qExec(&test1) != 0)
        fInvalid = true;
#ifdef ENABLE_WALLET
    PaymentServerTests test2;
    if (QTest::qExec(&test2) != 0)
        fInvalid = true;
#endif
    RPCNestedTests test3;
    if (QTest::qExec(&test3) != 0)
        fInvalid = true;

    CompatTests test4;
    if (QTest::qExec(&test4) != 0)
        fInvalid = true;

    TrafficGraphDataTests test5;
    if (QTest::qExec(&test5) != 0)
        fInvalid = true;
    ECC_Stop();
    return fInvalid;
}
Ejemplo n.º 5
0
 TestingSetup() {
     //fPrintToDebugLog = false; // don't want to write to debug.log file
     
     //pathTemp = GetTempPath() / strprintf("test_LEOcoin_%lu_%i", (unsigned long)GetTime(), (int)(GetRand(100000)));
     pathTemp = GetTempPath() / "test_LEOcoin";
     //printf("pathTemp %s\n", pathTemp.string().c_str());
     boost::filesystem::create_directories(pathTemp);
     mapArgs["-datadir"] = pathTemp.string();
     
     fDebug = true;
     fDebugSmsg = true;
     fDebugChain = true;
     fDebugRingSig = true;
     fDebugPoS = true;
     
     noui_connect();
     bitdb.MakeMock();
     
     LoadBlockIndex(true);
     pwalletMain = new CWallet("walletUT.dat");
     pwalletMain->LoadWallet();
     RegisterWallet(pwalletMain);
 }
Ejemplo n.º 6
0
// This is all you need to run all the tests
int main(int argc, char *argv[])
{
    SetupEnvironment();
    SetupNetworking();
    SelectParams(CBaseChainParams::MAIN);
    noui_connect();
    ClearDatadirCache();
    fs::path pathTemp = fs::temp_directory_path() / strprintf("test_bitcoin-qt_%lu_%i", (unsigned long)GetTime(), (int)GetRand(100000));
    fs::create_directories(pathTemp);
    gArgs.ForceSetArg("-datadir", pathTemp.string());

    bool fInvalid = false;

    // Prefer the "minimal" platform for the test instead of the normal default
    // platform ("xcb", "windows", or "cocoa") so tests can't unintentionally
    // interfere with any background GUIs and don't require extra resources.
    #if defined(WIN32)
        _putenv_s("QT_QPA_PLATFORM", "minimal");
    #else
        setenv("QT_QPA_PLATFORM", "minimal", 0);
    #endif

    // Don't remove this, it's needed to access
    // QApplication:: and QCoreApplication:: in the tests
    QApplication app(argc, argv);
    app.setApplicationName("Bitcoin-Qt-test");

    SSL_library_init();

    URITests test1;
    if (QTest::qExec(&test1) != 0) {
        fInvalid = true;
    }
#if defined(ENABLE_WALLET) && defined(ENABLE_BIP70)
    PaymentServerTests test2;
    if (QTest::qExec(&test2) != 0) {
        fInvalid = true;
    }
#endif
    RPCNestedTests test3;
    if (QTest::qExec(&test3) != 0) {
        fInvalid = true;
    }
    CompatTests test4;
    if (QTest::qExec(&test4) != 0) {
        fInvalid = true;
    }
#ifdef ENABLE_WALLET
    WalletTests test5;
    if (QTest::qExec(&test5) != 0) {
        fInvalid = true;
    }
    AddressBookTests test6;
    if (QTest::qExec(&test6) != 0) {
        fInvalid = true;
    }
#endif

    fs::remove_all(pathTemp);

    return fInvalid;
}