Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing Testcases when Logging is enabled #244

Merged
merged 3 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions test/assets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@
// workaround for name clash with stdlib
#define system qubicSystemStruct

// reduced size of logging buffer (512 MB instead of 8 GB)
#define LOG_BUFFER_SIZE (2*268435456ULL)

#include "assets/assets.h"
#include "contract_core/contract_exec.h"
#include "contract_core/qpi_asset_impl.h"
#include "logging/logging.h"

#include "test_util.h"

Expand All @@ -19,12 +23,14 @@ class AssetsTest : public AssetStorage
{
initAssets();
initCommonBuffers();
qLogger::initLogging();
}

~AssetsTest()
{
deinitCommonBuffers();
deinitAssets();
qLogger::deinitLogging();
}

static void clearUniverse()
Expand Down
10 changes: 8 additions & 2 deletions test/contract_qearn.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#define NO_UEFI

#include "contract_testing.h"

#include <random>
#include <map>

#include "contract_testing.h"

#define PRINT_TEST_INFO 0

// test config:
Expand Down Expand Up @@ -132,6 +132,7 @@ class ContractTestingQearn : protected ContractTesting
{
INIT_CONTRACT(QEARN);
initEmptySpectrum();
qLogger::initLogging();
rand64.seed(42);

for (unsigned int epChanges = 0; epChanges <= 52; ++epChanges)
Expand Down Expand Up @@ -165,6 +166,11 @@ class ContractTestingQearn : protected ContractTesting
}
}

~ContractTestingQearn()
{
qLogger::deinitLogging();
}

QearnChecker* getState()
{
return (QearnChecker*)contractStates[QEARN_CONTRACT_INDEX];
Expand Down
11 changes: 8 additions & 3 deletions test/contract_qvault.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#define NO_UEFI

#include "contract_testing.h"
#include "test_util.h"
#include <map>

#include <random>

#include "contract_testing.h"

static std::mt19937_64 rand64;
static constexpr uint64 QVAULT_QCAP_MAX_HOLDERS = 131072;
static constexpr uint64 QVAULT_ISSUE_ASSET_FEE = 1000000000ull;
Expand Down Expand Up @@ -263,6 +262,12 @@ class ContractTestingQvault : protected ContractTesting
callSystemProcedure(QVAULT_CONTRACT_INDEX, INITIALIZE);
INIT_CONTRACT(QX);
callSystemProcedure(QX_CONTRACT_INDEX, INITIALIZE);
qLogger::initLogging();
}

~ContractTestingQvault()
{
qLogger::deinitLogging();
}

QVAULTChecker* getState()
Expand Down
6 changes: 6 additions & 0 deletions test/contract_qx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ class ContractTestingQx : protected ContractTesting
initEmptyUniverse();
INIT_CONTRACT(QX);
callSystemProcedure(QX_CONTRACT_INDEX, INITIALIZE);
qLogger::initLogging();
}

~ContractTestingQx()
{
qLogger::deinitLogging();
}

QxChecker* getState()
Expand Down
5 changes: 5 additions & 0 deletions test/contract_testing.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@
// workaround for name clash with stdlib
#define system qubicSystemStruct

// reduced size of logging buffer (512 MB instead of 8 GB)
#define LOG_BUFFER_SIZE (2*268435456ULL)

#include "contract_core/contract_def.h"
#include "contract_core/contract_exec.h"

#include "contract_core/qpi_spectrum_impl.h"
#include "contract_core/qpi_asset_impl.h"
#include "contract_core/qpi_system_impl.h"

#include "logging/logging.h"

#include "test_util.h"


Expand Down
7 changes: 4 additions & 3 deletions test/spectrum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define system qubicSystemStruct

// enable some logging for testing
#include "../src/private_settings.h"
#include "private_settings.h"
#undef LOG_DUST_BURNINGS
#undef LOG_SPECTRUM_STATS
#define LOG_DUST_BURNINGS 1
Expand All @@ -18,11 +18,12 @@
#define LOG_BUFFER_SIZE (2*268435456ULL)

// also reduce size of logging tx index by reducing maximum number of ticks per epoch
#include "../src/public_settings.h"
#include "public_settings.h"
#undef MAX_NUMBER_OF_TICKS_PER_EPOCH
#define MAX_NUMBER_OF_TICKS_PER_EPOCH 3000

#include "../src/spectrum.h"
#include "spectrum.h"
#include "logging/logging.h"

#include <chrono>
#include <random>
Expand Down
5 changes: 5 additions & 0 deletions test/test.vcxproj.user
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,9 @@
<LocalDebuggerCommandArguments>--gtest_break_on_failure</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerCommandArguments>
</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>
Loading