From 14a37311829ec61d91e58348f45fd195244f6901 Mon Sep 17 00:00:00 2001 From: Djordje Mijovic Date: Thu, 4 Feb 2021 17:53:27 +0100 Subject: [PATCH] Don't run gas for ir if it is not explicitely added to expectations. --- test/libsolidity/SemanticTest.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/test/libsolidity/SemanticTest.cpp b/test/libsolidity/SemanticTest.cpp index 9d44f975d..d39c2c704 100644 --- a/test/libsolidity/SemanticTest.cpp +++ b/test/libsolidity/SemanticTest.cpp @@ -326,16 +326,21 @@ TestCase::TestResult SemanticTest::runTest( bool SemanticTest::checkGasCostExpectation(TestFunctionCall& io_test, bool _compileViaYul) const { - if (m_evmVersion != EVMVersion{} || solidity::test::CommonOptions::get().useABIEncoderV1) - return true; - string setting = (_compileViaYul ? "ir"s : "legacy"s) + (m_optimiserSettings == OptimiserSettings::full() ? "Optimized" : ""); + // We don't check gas if evm is not set to default version + // or in case we run abiencoderv1 + // or gas used less than threshold for enforcing feature + // or setting is "ir" and it's not included in expectations if ( - (!m_enforceGasCost || m_gasUsed < m_enforceGasCostMinValue) && - io_test.call().expectations.gasUsed.count(setting) == 0 + m_evmVersion != EVMVersion{} || + solidity::test::CommonOptions::get().useABIEncoderV1 || + ( + (!m_enforceGasCost || setting == "ir" || m_gasUsed < m_enforceGasCostMinValue) && + io_test.call().expectations.gasUsed.count(setting) == 0 + ) ) return true;