Remove canEnableViaYul logic and default to compiling also via yul.

This commit is contained in:
Daniel Kirchner 2022-05-19 19:21:19 +02:00
parent e93ad30e43
commit 788dc6b4c8
2 changed files with 4 additions and 24 deletions

View File

@ -71,7 +71,7 @@ SemanticTest::SemanticTest(
if (m_runWithABIEncoderV1Only && !solidity::test::CommonOptions::get().useABIEncoderV1)
m_shouldRun = false;
string compileViaYul = m_reader.stringSetting("compileViaYul", "default");
string compileViaYul = m_reader.stringSetting("compileViaYul", "also");
if (m_runWithABIEncoderV1Only && compileViaYul != "false")
BOOST_THROW_EXCEPTION(runtime_error(
"ABIEncoderV1Only tests cannot be run via yul, "
@ -345,7 +345,6 @@ TestCase::TestResult SemanticTest::runTest(
m_compileToEwasm = _isEwasmRun;
}
m_canEnableYulRun = false;
m_canEnableEwasmRun = false;
if (_isYulRun)
@ -465,18 +464,6 @@ TestCase::TestResult SemanticTest::runTest(
success &= test.call().expectedSideEffects == test.call().actualSideEffects;
}
if (!m_testCaseWantsYulRun && _isYulRun)
{
m_canEnableYulRun = success;
string message = success ?
"Test can pass via Yul, but marked with \"compileViaYul: false.\"" :
"Test compiles via Yul, but it gives different test results.";
AnsiColorized(_stream, _formatted, {BOLD, success ? YELLOW : MAGENTA}) <<
_linePrefix << endl <<
_linePrefix << message << endl;
return TestResult::Failure;
}
// Right now we have sometimes different test results in Yul vs. Ewasm.
// The main reason is that Ewasm just returns a failure in some cases.
// TODO: If Ewasm support got fully implemented, we could implement this in the same way as above.
@ -654,25 +641,19 @@ void SemanticTest::printUpdatedExpectations(ostream& _stream, string const&) con
void SemanticTest::printUpdatedSettings(ostream& _stream, string const& _linePrefix)
{
auto& settings = m_reader.settings();
if (settings.empty() && !m_canEnableYulRun)
if (settings.empty() && !m_canEnableEwasmRun)
return;
_stream << _linePrefix << "// ====" << endl;
if (m_canEnableEwasmRun)
{
soltestAssert(m_canEnableYulRun || m_testCaseWantsYulRun, "");
string compileViaYul = m_reader.stringSetting("compileViaYul", "");
if (!compileViaYul.empty())
_stream << _linePrefix << "// compileViaYul: " << compileViaYul << "\n";
soltestAssert(m_testCaseWantsYulRun, "");
_stream << _linePrefix << "// compileToEwasm: also\n";
}
else if (m_canEnableYulRun)
_stream << _linePrefix << "// compileViaYul: also\n";
for (auto const& [settingName, settingValue]: settings)
if (
!(settingName == "compileToEwasm" && m_canEnableEwasmRun) &&
!(settingName == "compileViaYul" && (m_canEnableYulRun || m_canEnableEwasmRun))
!(settingName == "compileToEwasm" && m_canEnableEwasmRun)
)
_stream << _linePrefix << "// " << settingName << ": " << settingValue<< endl;
}

View File

@ -101,7 +101,6 @@ private:
bool m_enforceCompileToEwasm = false;
bool m_runWithABIEncoderV1Only = false;
bool m_allowNonExistingFunctions = false;
bool m_canEnableYulRun = false;
bool m_canEnableEwasmRun = false;
bool m_gasCostFailure = false;
bool m_enforceGasCost = false;