Skip to content

Commit

Permalink
Merge pull request #1075 from AntelopeIO/fix_abi_test_check
Browse files Browse the repository at this point in the history
Fix test failure on fast machine (release builds)
  • Loading branch information
greg7mdp authored Apr 24, 2023
2 parents 48b6a4e + f5cb026 commit b67d174
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions unittests/api_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1072,10 +1072,10 @@ BOOST_AUTO_TEST_CASE(checktime_pause_max_trx_cpu_extended_test) { try {
dlog("elapsed ${e}us", ("e", dur) );
BOOST_CHECK( dur >= 24'999 ); // should never fail
BOOST_TEST( t.is_code_cached("pause"_n) );
// This assumes that loading the WASM takes at least 1.5 ms
// This assumes that loading the WASM takes at least 0.750 ms
// If this check fails but duration is >= 24'999 (previous check did not fail), then the check here is likely
// because WASM took less than 1.5 ms to load.
BOOST_CHECK_MESSAGE( dur > 26'500, "elapsed " << dur << "us" );
// because WASM took less than 0.750 ms to load.
BOOST_CHECK_MESSAGE( dur > 25'750, "elapsed " << dur << "us" );
BOOST_CHECK_MESSAGE( dur < 150'000, "elapsed " << dur << "us" ); // Should not run to block_cpu_usage deadline

// Test hitting max_transaction_time throws tx_cpu_usage_exceeded
Expand Down Expand Up @@ -1130,10 +1130,10 @@ BOOST_AUTO_TEST_CASE(checktime_pause_max_trx_extended_test) { try {
dlog("elapsed ${e}us", ("e", dur) );
BOOST_CHECK( dur >= 25'000 ); // should never fail
BOOST_TEST( t.is_code_cached("pause"_n) );
// This assumes that loading the WASM takes at least 1.5 ms
// This assumes that loading the WASM takes at least 0.750 ms
// If this check fails but duration is >= 25'000 (previous check did not fail), then the check here is likely
// because WASM took less than 1.5 ms to load.
BOOST_CHECK_MESSAGE( dur > 26'500, "elapsed " << dur << "us" );
// because WASM took less than 0.750 ms to load.
BOOST_CHECK_MESSAGE( dur > 25'750, "elapsed " << dur << "us" );
BOOST_CHECK_MESSAGE( dur < 250'000, "elapsed " << dur << "us" ); // Should not run to max_transaction_cpu_usage deadline

BOOST_REQUIRE_EQUAL( t.validate(), true );
Expand Down Expand Up @@ -1349,7 +1349,7 @@ BOOST_FIXTURE_TEST_CASE(checktime_hashing_fail, TESTER) { try {

//hit deadline exception, but cache the contract
BOOST_CHECK_EXCEPTION( call_test( *this, test_api_action<TEST_METHOD("test_checktime", "checktime_sha1_failure")>{},
5000, 10, 10 ),
5000, 8, 8 ),
deadline_exception, is_deadline_exception );

BOOST_TEST( is_code_cached("testapi"_n) );
Expand Down

0 comments on commit b67d174

Please sign in to comment.