mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #6916 from ethereum/alsoViaYul
Allow extracted semantics tests to run with and without yul.
This commit is contained in:
commit
a4087d4b60
@ -45,9 +45,19 @@ SemanticTest::SemanticTest(string const& _filename, string const& _ipcPath, lang
|
|||||||
|
|
||||||
m_source = parseSourceAndSettings(file);
|
m_source = parseSourceAndSettings(file);
|
||||||
if (m_settings.count("compileViaYul"))
|
if (m_settings.count("compileViaYul"))
|
||||||
|
{
|
||||||
|
if (m_settings["compileViaYul"] == "also")
|
||||||
{
|
{
|
||||||
m_validatedSettings["compileViaYul"] = m_settings["compileViaYul"];
|
m_validatedSettings["compileViaYul"] = m_settings["compileViaYul"];
|
||||||
m_compileViaYul = true;
|
m_runWithYul = true;
|
||||||
|
m_runWithoutYul = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_validatedSettings["compileViaYul"] = "only";
|
||||||
|
m_runWithYul = true;
|
||||||
|
m_runWithoutYul = false;
|
||||||
|
}
|
||||||
m_settings.erase("compileViaYul");
|
m_settings.erase("compileViaYul");
|
||||||
}
|
}
|
||||||
parseExpectations(file);
|
parseExpectations(file);
|
||||||
@ -55,9 +65,14 @@ SemanticTest::SemanticTest(string const& _filename, string const& _ipcPath, lang
|
|||||||
|
|
||||||
TestCase::TestResult SemanticTest::run(ostream& _stream, string const& _linePrefix, bool _formatted)
|
TestCase::TestResult SemanticTest::run(ostream& _stream, string const& _linePrefix, bool _formatted)
|
||||||
{
|
{
|
||||||
|
for(bool compileViaYul: set<bool>{!m_runWithoutYul, m_runWithYul})
|
||||||
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
|
m_compileViaYul = compileViaYul;
|
||||||
|
if (compileViaYul)
|
||||||
|
AnsiColorized(_stream, _formatted, {BOLD, CYAN}) << _linePrefix << "Running via Yul:" << endl;
|
||||||
|
|
||||||
for (auto& test: m_tests)
|
for (auto& test: m_tests)
|
||||||
test.reset();
|
test.reset();
|
||||||
|
|
||||||
@ -115,8 +130,19 @@ TestCase::TestResult SemanticTest::run(ostream& _stream, string const& _linePref
|
|||||||
}
|
}
|
||||||
AnsiColorized(_stream, _formatted, {BOLD, RED}) << _linePrefix << endl << _linePrefix
|
AnsiColorized(_stream, _formatted, {BOLD, RED}) << _linePrefix << endl << _linePrefix
|
||||||
<< "Attention: Updates on the test will apply the detected format displayed." << endl;
|
<< "Attention: Updates on the test will apply the detected format displayed." << endl;
|
||||||
|
if (compileViaYul && m_runWithoutYul)
|
||||||
|
{
|
||||||
|
_stream << _linePrefix << endl << _linePrefix;
|
||||||
|
AnsiColorized(_stream, _formatted, {RED_BACKGROUND}) << "Note that the test passed without Yul.";
|
||||||
|
_stream << endl;
|
||||||
|
}
|
||||||
|
else if (!compileViaYul && m_runWithYul)
|
||||||
|
AnsiColorized(_stream, _formatted, {BOLD, YELLOW}) << _linePrefix << endl << _linePrefix
|
||||||
|
<< "Note that the test also has to pass via Yul." << endl;
|
||||||
return TestResult::Failure;
|
return TestResult::Failure;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return TestResult::Success;
|
return TestResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,6 +65,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
std::string m_source;
|
std::string m_source;
|
||||||
std::vector<TestFunctionCall> m_tests;
|
std::vector<TestFunctionCall> m_tests;
|
||||||
|
bool m_runWithYul = false;
|
||||||
|
bool m_runWithoutYul = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user