mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
AnalysisFramework: Move common setup to the framework
This commit is contained in:
parent
d2bfb2f737
commit
3fb2f1db88
@ -86,7 +86,12 @@ std::unique_ptr<CompilerStack> AnalysisFramework::createStack() const
|
|||||||
|
|
||||||
void AnalysisFramework::setupCompiler(CompilerStack& _compiler)
|
void AnalysisFramework::setupCompiler(CompilerStack& _compiler)
|
||||||
{
|
{
|
||||||
|
// These are just defaults based on the (global) CLI options.
|
||||||
|
// Technically, every TestCase should override these with values passed to it in TestCase::Config.
|
||||||
|
// In practice TestCase::Config always matches global config so most test cases don't care.
|
||||||
_compiler.setEVMVersion(solidity::test::CommonOptions::get().evmVersion());
|
_compiler.setEVMVersion(solidity::test::CommonOptions::get().evmVersion());
|
||||||
|
_compiler.setEOFVersion(solidity::test::CommonOptions::get().eofVersion());
|
||||||
|
_compiler.setOptimiserSettings(solidity::test::CommonOptions::get().optimize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnalysisFramework::executeCompilationPipeline()
|
void AnalysisFramework::executeCompilationPipeline()
|
||||||
|
@ -99,6 +99,7 @@ void GasTest::printUpdatedExpectations(std::ostream& _stream, std::string const&
|
|||||||
|
|
||||||
void GasTest::setupCompiler(CompilerStack& _compiler)
|
void GasTest::setupCompiler(CompilerStack& _compiler)
|
||||||
{
|
{
|
||||||
|
AnalysisFramework::setupCompiler(_compiler);
|
||||||
|
|
||||||
// Prerelease CBOR metadata varies in size due to changing version numbers and build dates.
|
// Prerelease CBOR metadata varies in size due to changing version numbers and build dates.
|
||||||
// This leads to volatile creation cost estimates. Therefore we force the compiler to
|
// This leads to volatile creation cost estimates. Therefore we force the compiler to
|
||||||
@ -112,6 +113,10 @@ void GasTest::setupCompiler(CompilerStack& _compiler)
|
|||||||
}
|
}
|
||||||
settings.expectedExecutionsPerDeployment = m_optimiseRuns;
|
settings.expectedExecutionsPerDeployment = m_optimiseRuns;
|
||||||
_compiler.setOptimiserSettings(settings);
|
_compiler.setOptimiserSettings(settings);
|
||||||
|
|
||||||
|
// Intentionally ignoring EVM version specified on the command line.
|
||||||
|
// Gas expectations are only valid for the default version.
|
||||||
|
_compiler.setEVMVersion(EVMVersion{});
|
||||||
}
|
}
|
||||||
|
|
||||||
TestCase::TestResult GasTest::run(std::ostream& _stream, std::string const& _linePrefix, bool _formatted)
|
TestCase::TestResult GasTest::run(std::ostream& _stream, std::string const& _linePrefix, bool _formatted)
|
||||||
|
@ -38,6 +38,8 @@ using namespace yul;
|
|||||||
|
|
||||||
void MemoryGuardTest::setupCompiler(CompilerStack& _compiler)
|
void MemoryGuardTest::setupCompiler(CompilerStack& _compiler)
|
||||||
{
|
{
|
||||||
|
AnalysisFramework::setupCompiler(_compiler);
|
||||||
|
|
||||||
_compiler.setViaIR(true);
|
_compiler.setViaIR(true);
|
||||||
_compiler.setOptimiserSettings(OptimiserSettings::none());
|
_compiler.setOptimiserSettings(OptimiserSettings::none());
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,8 @@ class SolidityCompilerFixture: protected AnalysisFramework
|
|||||||
{
|
{
|
||||||
void setupCompiler(CompilerStack& _compiler) override
|
void setupCompiler(CompilerStack& _compiler) override
|
||||||
{
|
{
|
||||||
|
AnalysisFramework::setupCompiler(_compiler);
|
||||||
|
|
||||||
// FIXME: This test was probably supposed to respect CommonOptions::get().optimize but
|
// FIXME: This test was probably supposed to respect CommonOptions::get().optimize but
|
||||||
// due to a bug it was always running with optimizer disabled and it does not pass with it.
|
// due to a bug it was always running with optimizer disabled and it does not pass with it.
|
||||||
_compiler.setOptimiserSettings(false);
|
_compiler.setOptimiserSettings(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user