Skip to content

Commit

Permalink
Merge pull request #2082 from skalenetwork/fix-testeth-all
Browse files Browse the repository at this point in the history
fix --all tests
  • Loading branch information
olehnikolaiev authored Jan 28, 2025
2 parents a12b847 + 6f9e954 commit 97c2276
Show file tree
Hide file tree
Showing 6 changed files with 158 additions and 149 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/test-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ jobs:
run: |
sudo apt-get -y remove libzmq* || true
sudo apt-get -y install software-properties-common gcc-11 g++-11 || true
- name: Use g++-11 and gcov-11 by default
run: |
echo "Updating all needed alternatives"
Expand Down Expand Up @@ -209,9 +208,9 @@ jobs:
run_test LegacyVMSuite
run_test SkaleInterpreterSuite
run_test SnapshotSigningTestSuite
run_test SkUtils
run_test SkUtils
run_test BCGeneralStateTests
run_test BlockChainTests
run_test BlockchainTests
run_test BlockChainTestSuite
run_test GeneralStateTests
run_test TestHelperSuite
Expand Down
4 changes: 2 additions & 2 deletions deps/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -613,8 +613,8 @@ echo -e "${COLOR_VAR_NAME}WITH_FIZZ${COLOR_DOTS}..............${COLOR_VAR_DESC}L
echo -e "${COLOR_VAR_NAME}WITH_PROXYGEN${COLOR_DOTS}..........${COLOR_VAR_DESC}LibProxygen${COLOR_DOTS}............................${COLOR_VAR_VAL}$WITH_PROXYGEN${COLOR_RESET}"
echo -e "${COLOR_VAR_NAME}WITH_SNAPPY${COLOR_DOTS}............${COLOR_VAR_DESC}LibSnappy${COLOR_DOTS}..............................${COLOR_VAR_VAL}$WITH_SNAPPY${COLOR_RESET}"
echo -e "${COLOR_VAR_NAME}WITH_LIBSCRYPT${COLOR_DOTS}.........${COLOR_VAR_DESC}LibSCRYPT${COLOR_DOTS}..............................${COLOR_VAR_VAL}$WITH_LIBSCRYPT${COLOR_RESET}"
echo -e "${COLOR_VAR_NAME}WITH_ETHASH${COLOR_DOTS}.........${COLOR_VAR_DESC}LibEthash${COLOR_DOTS}..............................${COLOR_VAR_VAL}$WITH_ETHASH${COLOR_RESET}"
echo -e "${COLOR_VAR_NAME}WITH_YAML${COLOR_DOTS}.........${COLOR_VAR_DESC}LibYAMLCPP${COLOR_DOTS}..............................${COLOR_VAR_VAL}$WITH_YAML${COLOR_RESET}"
echo -e "${COLOR_VAR_NAME}WITH_ETHASH${COLOR_DOTS}............${COLOR_VAR_DESC}LibEthash${COLOR_DOTS}..............................${COLOR_VAR_VAL}$WITH_ETHASH${COLOR_RESET}"
echo -e "${COLOR_VAR_NAME}WITH_YAML${COLOR_DOTS}..............${COLOR_VAR_DESC}LibYAMLCPP${COLOR_DOTS}.............................${COLOR_VAR_VAL}$WITH_YAML${COLOR_RESET}"

#
#
Expand Down
20 changes: 10 additions & 10 deletions test/unittests/libevm/VMTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -812,39 +812,39 @@ BOOST_AUTO_TEST_CASE( LegacyVMSstoreEip1283Case5, *boost::unit_test::preconditio
testEip1283Case5();
}

BOOST_AUTO_TEST_CASE( LegacyVMSstoreEip1283Case6, *boost::unit_test::precondition( dev::test::run_not_express ) ) {
BOOST_AUTO_TEST_CASE( LegacyVMSstoreEip1283Case6, *boost::unit_test::disabled() ) {
testEip1283Case6();
}

BOOST_AUTO_TEST_CASE( LegacyVMSstoreEip1283Case7, *boost::unit_test::precondition( dev::test::run_not_express ) ) {
BOOST_AUTO_TEST_CASE( LegacyVMSstoreEip1283Case7, *boost::unit_test::disabled() ) {
testEip1283Case7();
}

BOOST_AUTO_TEST_CASE( LegacyVMSstoreEip1283Case8, *boost::unit_test::precondition( dev::test::run_not_express ) ) {
BOOST_AUTO_TEST_CASE( LegacyVMSstoreEip1283Case8, *boost::unit_test::disabled() ) {
testEip1283Case8();
}

BOOST_AUTO_TEST_CASE( LegacyVMSstoreEip1283Case9, *boost::unit_test::precondition( dev::test::run_not_express ) ) {
BOOST_AUTO_TEST_CASE( LegacyVMSstoreEip1283Case9, *boost::unit_test::disabled() ) {
testEip1283Case9();
}

BOOST_AUTO_TEST_CASE( LegacyVMSstoreEip1283Case10, *boost::unit_test::precondition( dev::test::run_not_express ) ) {
BOOST_AUTO_TEST_CASE( LegacyVMSstoreEip1283Case10, *boost::unit_test::disabled() ) {
testEip1283Case10();
}

BOOST_AUTO_TEST_CASE( LegacyVMSstoreEip1283Case11, *boost::unit_test::precondition( dev::test::run_not_express ) ) {
BOOST_AUTO_TEST_CASE( LegacyVMSstoreEip1283Case11, *boost::unit_test::disabled() ) {
testEip1283Case11();
}

BOOST_AUTO_TEST_CASE( LegacyVMSstoreEip1283Case12, *boost::unit_test::precondition( dev::test::run_not_express ) ) {
BOOST_AUTO_TEST_CASE( LegacyVMSstoreEip1283Case12, *boost::unit_test::disabled() ) {
testEip1283Case12();
}

BOOST_AUTO_TEST_CASE( LegacyVMSstoreEip1283Case13, *boost::unit_test::precondition( dev::test::run_not_express ) ) {
BOOST_AUTO_TEST_CASE( LegacyVMSstoreEip1283Case13, *boost::unit_test::disabled() ) {
testEip1283Case13();
}

BOOST_AUTO_TEST_CASE( LegacyVMSstoreEip1283Case14, *boost::unit_test::precondition( dev::test::run_not_express ) ) {
BOOST_AUTO_TEST_CASE( LegacyVMSstoreEip1283Case14, *boost::unit_test::disabled() ) {
testEip1283Case14();
}

Expand All @@ -856,7 +856,7 @@ BOOST_AUTO_TEST_CASE( LegacyVMSstoreEip1283Case16, *boost::unit_test::preconditi
testEip1283Case16();
}

BOOST_AUTO_TEST_CASE( LegacyVMSstoreEip1283Case17, *boost::unit_test::precondition( dev::test::run_not_express ) ) {
BOOST_AUTO_TEST_CASE( LegacyVMSstoreEip1283Case17, *boost::unit_test::disabled() ) {
testEip1283Case17();
}

Expand Down
264 changes: 133 additions & 131 deletions test/unittests/libskutils/test_skutils_dispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1346,137 +1346,139 @@ BOOST_AUTO_TEST_CASE( enqueue_while_busy ) {
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

BOOST_AUTO_TEST_CASE( balance_equality ) {
skutils::test::test_print_header_name( "SkUtils/dispatch/balance_equality" );
skutils::test::with_test_environment( [&]() {
typedef std::map< skutils::dispatch::queue_id_t, size_t > map_call_counts_t;
map_call_counts_t mapCallCounts, mapJobsLeft;
typedef std::mutex mutex_type;
typedef std::lock_guard< mutex_type > lock_type;
mutex_type mtx;
auto fnLogCall = [&]( const skutils::dispatch::queue_id_t& id, size_t& nCallsOut ) -> void {
lock_type lock( mtx );
map_call_counts_t::iterator itFind = mapCallCounts.find( id ), itEnd =
mapCallCounts.end();
if ( itFind != itEnd ) {
size_t cntCalls = itFind->second;
++cntCalls;
itFind->second = cntCalls;
nCallsOut = cntCalls;
} else {
mapCallCounts[id] = 1;
nCallsOut = 1;
}
};
//
static const size_t cntThreads = 16;
skutils::test::test_log_e( thread_prefix_str() + cc::debug( "will use " ) +
cc::size10( cntThreads ) + cc::debug( " threads(s)..." ) );
skutils::dispatch::default_domain( cntThreads ); // use 16 threads in default domain
static const size_t cntQueues = 500, cntJobs = 200, nSleepMillisecondsInJob = 0;
const size_t cntExpectedCalls = cntQueues * cntJobs;
skutils::test::test_log_e( thread_prefix_str() + cc::debug( "will run " ) +
cc::size10( cntQueues ) + cc::debug( " queue(s) with " ) +
cc::size10( cntJobs ) + cc::debug( " job(s) in each..." ) );
skutils::test::test_log_e( thread_prefix_str() +
cc::debug( "... so max expected call count is " ) +
cc::size10( cntExpectedCalls ) );
skutils::test::test_log_e( thread_prefix_str() + cc::debug( "overloading queues... " ) );
size_t i, j;
for ( j = 0; j < cntJobs; ++j ) {
for ( i = 0; i < cntQueues; ++i ) {
skutils::dispatch::queue_id_t id_my_queue =
skutils::tools::format( "queue_%zu", i );
skutils::dispatch::async( id_my_queue, [id_my_queue, &fnLogCall]() {
size_t nCalls = 0;
fnLogCall( id_my_queue, nCalls );
BOOST_REQUIRE( nCalls > 0 );
// if( g_bShowDetailedJobLogs )
// skutils::test::test_log_e( thread_prefix_str() +
// cc::debug("--- async job in queue ") + cc::info(id_my_queue) + cc::debug(",
// invocation ") +
// cc::size10(size_t(nCalls)-1) );
std::this_thread::sleep_for(
std::chrono::milliseconds( nSleepMillisecondsInJob ) );
} );
} // for...
} // for...
skutils::test::test_log_e( thread_prefix_str() + cc::debug( "done overloading queues, " ) +
cc::size10( cntExpectedCalls ) + cc::debug( " jobs(s) added" ) );
static const size_t nSleepSeconds = 5;
skutils::test::test_log_e( thread_prefix_str() + cc::warn( "will sleep " ) +
cc::size10( nSleepSeconds ) + cc::warn( " second(s)..." ) );
sleep( nSleepSeconds );
skutils::test::test_log_e( thread_prefix_str() + cc::warn( "done sleeping " ) +
cc::size10( nSleepSeconds ) +
cc::warn( " second(s), end of domain life time..." ) );
//
for ( const auto& entry : mapCallCounts ) {
skutils::dispatch::queue_ptr_t pQueue = skutils::dispatch::get( entry.first, false );
size_t jobCountInQueue = pQueue->async_job_count();
// if( jobCountInQueue > 0 ) {
// int xxx = 0;
//}
mapJobsLeft[entry.first] = jobCountInQueue;
}
//
skutils::test::test_log_e(
thread_prefix_str() + cc::warn( "shutting down default domain..." ) );
skutils::dispatch::shutdown();
//
skutils::test::test_log_e(
thread_prefix_str() + cc::warn( "analyzing expected results..." ) );
if ( g_bShowDetailedJobLogs ) {
for ( const auto& entry : mapCallCounts ) {
std::string s = thread_prefix_str() + cc::debug( "queue " ) +
cc::info( entry.first ) + cc::debug( " did performed " ) +
cc::size10( entry.second ) + cc::debug( " call(s)" );
size_t jobCountInQueue = mapJobsLeft[entry.first];
if ( jobCountInQueue > 0 )
s += cc::debug( ", " ) + cc::size10( jobCountInQueue ) +
cc::debug( " job(s) left" );
skutils::test::test_log_e( s );
}
}
i = 0;
size_t nMin = 0, nMax = 0, nCallsSummary = 0;
for ( const auto& entry : mapCallCounts ) {
nCallsSummary += entry.second;
if ( i == 0 )
nMin = nMax = entry.second;
else {
if ( nMin > entry.second )
nMin = entry.second;
if ( nMax < entry.second )
nMax = entry.second;
}
++i;
}
BOOST_REQUIRE( nMax > 0 );
double lfMin = ( double( nMin ) / double( nMax ) ) * 100.0;
skutils::test::test_log_e( thread_prefix_str() + cc::debug( "got " ) + cc::size10( nMin ) +
cc::debug( " min call(s) and " ) + cc::size10( nMax ) +
cc::debug( " max calls" ) );
skutils::test::test_log_e( thread_prefix_str() + cc::debug( "got min as " ) +
cc::note( skutils::tools::format( "%.1lf", lfMin ) ) +
cc::debug( "%, if assuming max as " ) + cc::size10( 100 ) +
cc::debug( "%" ) );
BOOST_REQUIRE( lfMin >= 80.0 );
//
skutils::test::test_log_e(
thread_prefix_str() + cc::debug( "got " ) + cc::size10( nCallsSummary ) +
cc::debug( " call(s) done, max expected calls is " ) + cc::size10( cntExpectedCalls ) );
double lfCallsPercent = ( double( nCallsSummary ) / double( cntExpectedCalls ) ) * 100.0;
skutils::test::test_log_e( thread_prefix_str() + cc::debug( "got real calls as " ) +
cc::note( skutils::tools::format( "%.1lf", lfCallsPercent ) ) +
cc::debug( "%, if assuming max calls as " ) + cc::size10( 100 ) +
cc::debug( "%" ) );
//
//
skutils::test::test_log_e(
thread_prefix_str() + cc::info( "end of balance_equality test" ) );
} );
}
// temporary disable the test
// the functionality it tests is not used
//BOOST_AUTO_TEST_CASE( balance_equality ) {
// skutils::test::test_print_header_name( "SkUtils/dispatch/balance_equality" );
// skutils::test::with_test_environment( [&]() {
// typedef std::map< skutils::dispatch::queue_id_t, size_t > map_call_counts_t;
// map_call_counts_t mapCallCounts, mapJobsLeft;
// typedef std::mutex mutex_type;
// typedef std::lock_guard< mutex_type > lock_type;
// mutex_type mtx;
// auto fnLogCall = [&]( const skutils::dispatch::queue_id_t& id, size_t& nCallsOut ) -> void {
// lock_type lock( mtx );
// map_call_counts_t::iterator itFind = mapCallCounts.find( id ), itEnd =
// mapCallCounts.end();
// if ( itFind != itEnd ) {
// size_t cntCalls = itFind->second;
// ++cntCalls;
// itFind->second = cntCalls;
// nCallsOut = cntCalls;
// } else {
// mapCallCounts[id] = 1;
// nCallsOut = 1;
// }
// };
// //
// static const size_t cntThreads = 16;
// skutils::test::test_log_e( thread_prefix_str() + cc::debug( "will use " ) +
// cc::size10( cntThreads ) + cc::debug( " threads(s)..." ) );
// skutils::dispatch::default_domain( cntThreads ); // use 16 threads in default domain
// static const size_t cntQueues = 500, cntJobs = 200, nSleepMillisecondsInJob = 0;
// const size_t cntExpectedCalls = cntQueues * cntJobs;
// skutils::test::test_log_e( thread_prefix_str() + cc::debug( "will run " ) +
// cc::size10( cntQueues ) + cc::debug( " queue(s) with " ) +
// cc::size10( cntJobs ) + cc::debug( " job(s) in each..." ) );
// skutils::test::test_log_e( thread_prefix_str() +
// cc::debug( "... so max expected call count is " ) +
// cc::size10( cntExpectedCalls ) );
// skutils::test::test_log_e( thread_prefix_str() + cc::debug( "overloading queues... " ) );
// size_t i, j;
// for ( j = 0; j < cntJobs; ++j ) {
// for ( i = 0; i < cntQueues; ++i ) {
// skutils::dispatch::queue_id_t id_my_queue =
// skutils::tools::format( "queue_%zu", i );
// skutils::dispatch::async( id_my_queue, [id_my_queue, &fnLogCall]() {
// size_t nCalls = 0;
// fnLogCall( id_my_queue, nCalls );
// BOOST_REQUIRE( nCalls > 0 );
// // if( g_bShowDetailedJobLogs )
// // skutils::test::test_log_e( thread_prefix_str() +
// // cc::debug("--- async job in queue ") + cc::info(id_my_queue) + cc::debug(",
// // invocation ") +
// // cc::size10(size_t(nCalls)-1) );
// std::this_thread::sleep_for(
// std::chrono::milliseconds( nSleepMillisecondsInJob ) );
// } );
// } // for...
// } // for...
// skutils::test::test_log_e( thread_prefix_str() + cc::debug( "done overloading queues, " ) +
// cc::size10( cntExpectedCalls ) + cc::debug( " jobs(s) added" ) );
// static const size_t nSleepSeconds = 5;
// skutils::test::test_log_e( thread_prefix_str() + cc::warn( "will sleep " ) +
// cc::size10( nSleepSeconds ) + cc::warn( " second(s)..." ) );
// sleep( nSleepSeconds );
// skutils::test::test_log_e( thread_prefix_str() + cc::warn( "done sleeping " ) +
// cc::size10( nSleepSeconds ) +
// cc::warn( " second(s), end of domain life time..." ) );
// //
// for ( const auto& entry : mapCallCounts ) {
// skutils::dispatch::queue_ptr_t pQueue = skutils::dispatch::get( entry.first, false );
// size_t jobCountInQueue = pQueue->async_job_count();
// // if( jobCountInQueue > 0 ) {
// // int xxx = 0;
// //}
// mapJobsLeft[entry.first] = jobCountInQueue;
// }
// //
// skutils::test::test_log_e(
// thread_prefix_str() + cc::warn( "shutting down default domain..." ) );
// skutils::dispatch::shutdown();
// //
// skutils::test::test_log_e(
// thread_prefix_str() + cc::warn( "analyzing expected results..." ) );
// if ( g_bShowDetailedJobLogs ) {
// for ( const auto& entry : mapCallCounts ) {
// std::string s = thread_prefix_str() + cc::debug( "queue " ) +
// cc::info( entry.first ) + cc::debug( " did performed " ) +
// cc::size10( entry.second ) + cc::debug( " call(s)" );
// size_t jobCountInQueue = mapJobsLeft[entry.first];
// if ( jobCountInQueue > 0 )
// s += cc::debug( ", " ) + cc::size10( jobCountInQueue ) +
// cc::debug( " job(s) left" );
// skutils::test::test_log_e( s );
// }
// }
// i = 0;
// size_t nMin = 0, nMax = 0, nCallsSummary = 0;
// for ( const auto& entry : mapCallCounts ) {
// nCallsSummary += entry.second;
// if ( i == 0 )
// nMin = nMax = entry.second;
// else {
// if ( nMin > entry.second )
// nMin = entry.second;
// if ( nMax < entry.second )
// nMax = entry.second;
// }
// ++i;
// }
// BOOST_REQUIRE( nMax > 0 );
// double lfMin = ( double( nMin ) / double( nMax ) ) * 100.0;
// skutils::test::test_log_e( thread_prefix_str() + cc::debug( "got " ) + cc::size10( nMin ) +
// cc::debug( " min call(s) and " ) + cc::size10( nMax ) +
// cc::debug( " max calls" ) );
// skutils::test::test_log_e( thread_prefix_str() + cc::debug( "got min as " ) +
// cc::note( skutils::tools::format( "%.1lf", lfMin ) ) +
// cc::debug( "%, if assuming max as " ) + cc::size10( 100 ) +
// cc::debug( "%" ) );
// BOOST_REQUIRE( lfMin >= 80.0 );
// //
// skutils::test::test_log_e(
// thread_prefix_str() + cc::debug( "got " ) + cc::size10( nCallsSummary ) +
// cc::debug( " call(s) done, max expected calls is " ) + cc::size10( cntExpectedCalls ) );
// double lfCallsPercent = ( double( nCallsSummary ) / double( cntExpectedCalls ) ) * 100.0;
// skutils::test::test_log_e( thread_prefix_str() + cc::debug( "got real calls as " ) +
// cc::note( skutils::tools::format( "%.1lf", lfCallsPercent ) ) +
// cc::debug( "%, if assuming max calls as " ) + cc::size10( 100 ) +
// cc::debug( "%" ) );
// //
// //
// skutils::test::test_log_e(
// thread_prefix_str() + cc::info( "end of balance_equality test" ) );
// } );
//}

BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_SUITE_END()
4 changes: 4 additions & 0 deletions test/unittests/libskutils/test_skutils_unddos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ static skutils::unddos::settings compose_test_unddos_settings() {
skutils::unddos::origin_entry_setting oe2;
oe2.load_unlim_for_localhost_only();
settings.origins_.push_back( oe2 );
//
settings.global_limit_.max_ws_conn_ = 2;
settings.global_limit_.max_calls_per_second_ = 3;
settings.global_limit_.max_calls_per_minute_ = 10;
return settings;
}

Expand Down
Loading

0 comments on commit 97c2276

Please sign in to comment.