@@ -49,7 +49,6 @@ SemanticTest::SemanticTest(
49
49
string const & _filename,
50
50
langutil::EVMVersion _evmVersion,
51
51
vector<boost::filesystem::path> const & _vmPaths,
52
- bool _enforceViaYul,
53
52
bool _enforceCompileToEwasm,
54
53
bool _enforceGasCost,
55
54
u256 _enforceGasCostMinValue
@@ -60,27 +59,32 @@ SemanticTest::SemanticTest(
60
59
m_lineOffset(m_reader.lineNumber()),
61
60
m_builtins(makeBuiltins()),
62
61
m_sideEffectHooks(makeSideEffectHooks()),
63
- m_enforceViaYul(_enforceViaYul),
64
62
m_enforceCompileToEwasm(_enforceCompileToEwasm),
65
63
m_enforceGasCost(_enforceGasCost),
66
64
m_enforceGasCostMinValue(move(_enforceGasCostMinValue))
67
65
{
68
- static set<string> const compileViaYulAllowedValues{" also" , " true" , " false" , " default " };
66
+ static set<string> const compileViaYulAllowedValues{" also" , " true" , " false" };
69
67
static set<string> const yulRunTriggers{" also" , " true" };
70
68
static set<string> const legacyRunTriggers{" also" , " false" , " default" };
71
69
72
- string compileViaYul = m_reader.stringSetting (" compileViaYul" , " default" );
70
+ m_runWithABIEncoderV1Only = m_reader.boolSetting (" ABIEncoderV1Only" , false );
71
+ if (m_runWithABIEncoderV1Only && !solidity::test::CommonOptions::get ().useABIEncoderV1 )
72
+ m_shouldRun = false ;
73
+
74
+ string compileViaYul = m_reader.stringSetting (" compileViaYul" , " also" );
75
+ if (m_runWithABIEncoderV1Only && compileViaYul != " false" )
76
+ BOOST_THROW_EXCEPTION (runtime_error (
77
+ " ABIEncoderV1Only tests cannot be run via yul, "
78
+ " so they need to also specify ``compileViaYul: false``"
79
+ ));
73
80
if (!util::contains (compileViaYulAllowedValues, compileViaYul))
74
81
BOOST_THROW_EXCEPTION (runtime_error (" Invalid compileViaYul value: " + compileViaYul + " ." ));
75
82
m_testCaseWantsYulRun = util::contains (yulRunTriggers, compileViaYul);
76
83
m_testCaseWantsLegacyRun = util::contains (legacyRunTriggers, compileViaYul);
77
84
78
- // Do not enforce via yul and ewasm, if via yul was explicitly denied.
85
+ // Do not enforce ewasm, if via yul was explicitly denied.
79
86
if (compileViaYul == " false" )
80
- {
81
- m_enforceViaYul = false ;
82
87
m_enforceCompileToEwasm = false ;
83
- }
84
88
85
89
string compileToEwasm = m_reader.stringSetting (" compileToEwasm" , " false" );
86
90
if (compileToEwasm == " also" )
@@ -97,18 +101,6 @@ SemanticTest::SemanticTest(
97
101
if (m_testCaseWantsEwasmRun && !m_supportsEwasm)
98
102
m_testCaseWantsEwasmRun = false ;
99
103
100
- m_runWithABIEncoderV1Only = m_reader.boolSetting (" ABIEncoderV1Only" , false );
101
- if (m_runWithABIEncoderV1Only && !solidity::test::CommonOptions::get ().useABIEncoderV1 )
102
- m_shouldRun = false ;
103
-
104
- // Sanity check
105
- if (m_runWithABIEncoderV1Only && (compileViaYul == " true" || compileViaYul == " also" ))
106
- BOOST_THROW_EXCEPTION (runtime_error (
107
- " ABIEncoderV1Only can not be used with compileViaYul=" + compileViaYul +
108
- " , set it to false or omit the flag. The compileViaYul setting ignores the abicoder pragma"
109
- " and runs everything with ABICoder V2."
110
- ));
111
-
112
104
auto revertStrings = revertStringsFromString (m_reader.stringSetting (" revertStrings" , " default" ));
113
105
soltestAssert (revertStrings, " Invalid revertStrings setting." );
114
106
m_revertStrings = revertStrings.value ();
@@ -307,7 +299,7 @@ TestCase::TestResult SemanticTest::run(ostream& _stream, string const& _linePref
307
299
if (m_testCaseWantsLegacyRun)
308
300
result = runTest (_stream, _linePrefix, _formatted, false , false );
309
301
310
- if (( m_testCaseWantsYulRun || m_enforceViaYul) && result == TestResult::Success)
302
+ if (m_testCaseWantsYulRun && result == TestResult::Success)
311
303
result = runTest (_stream, _linePrefix, _formatted, true , false );
312
304
313
305
if ((m_testCaseWantsEwasmRun || m_enforceCompileToEwasm) && result == TestResult::Success)
@@ -353,7 +345,6 @@ TestCase::TestResult SemanticTest::runTest(
353
345
m_compileToEwasm = _isEwasmRun;
354
346
}
355
347
356
- m_canEnableYulRun = false ;
357
348
m_canEnableEwasmRun = false ;
358
349
359
350
if (_isYulRun)
@@ -473,18 +464,6 @@ TestCase::TestResult SemanticTest::runTest(
473
464
success &= test.call ().expectedSideEffects == test.call ().actualSideEffects ;
474
465
}
475
466
476
- if (!m_testCaseWantsYulRun && _isYulRun)
477
- {
478
- m_canEnableYulRun = success;
479
- string message = success ?
480
- " Test can pass via Yul, but marked with \" compileViaYul: false.\" " :
481
- " Test compiles via Yul, but it gives different test results." ;
482
- AnsiColorized (_stream, _formatted, {BOLD, success ? YELLOW : MAGENTA}) <<
483
- _linePrefix << endl <<
484
- _linePrefix << message << endl;
485
- return TestResult::Failure;
486
- }
487
-
488
467
// Right now we have sometimes different test results in Yul vs. Ewasm.
489
468
// The main reason is that Ewasm just returns a failure in some cases.
490
469
// TODO: If Ewasm support got fully implemented, we could implement this in the same way as above.
@@ -662,25 +641,19 @@ void SemanticTest::printUpdatedExpectations(ostream& _stream, string const&) con
662
641
void SemanticTest::printUpdatedSettings (ostream& _stream, string const & _linePrefix)
663
642
{
664
643
auto & settings = m_reader.settings ();
665
- if (settings.empty () && !m_canEnableYulRun )
644
+ if (settings.empty () && !m_canEnableEwasmRun )
666
645
return ;
667
646
668
647
_stream << _linePrefix << " // ====" << endl;
669
648
if (m_canEnableEwasmRun)
670
649
{
671
- soltestAssert (m_canEnableYulRun || m_testCaseWantsYulRun, " " );
672
- string compileViaYul = m_reader.stringSetting (" compileViaYul" , " " );
673
- if (!compileViaYul.empty ())
674
- _stream << _linePrefix << " // compileViaYul: " << compileViaYul << " \n " ;
650
+ soltestAssert (m_testCaseWantsYulRun, " " );
675
651
_stream << _linePrefix << " // compileToEwasm: also\n " ;
676
652
}
677
- else if (m_canEnableYulRun)
678
- _stream << _linePrefix << " // compileViaYul: also\n " ;
679
653
680
654
for (auto const & [settingName, settingValue]: settings)
681
655
if (
682
- !(settingName == " compileToEwasm" && m_canEnableEwasmRun) &&
683
- !(settingName == " compileViaYul" && (m_canEnableYulRun || m_canEnableEwasmRun))
656
+ !(settingName == " compileToEwasm" && m_canEnableEwasmRun)
684
657
)
685
658
_stream << _linePrefix << " // " << settingName << " : " << settingValue<< endl;
686
659
}
0 commit comments