mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Allow extracted semantics tests to run both with and without Yul.
This commit is contained in:
		
							parent
							
								
									44c774af4b
								
							
						
					
					
						commit
						8e20a5e59a
					
				| @ -45,9 +45,19 @@ SemanticTest::SemanticTest(string const& _filename, string const& _ipcPath, lang | ||||
| 
 | ||||
| 	m_source = parseSourceAndSettings(file); | ||||
| 	if (m_settings.count("compileViaYul")) | ||||
| 	{ | ||||
| 		if (m_settings["compileViaYul"] == "also") | ||||
| 		{ | ||||
| 			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"); | ||||
| 	} | ||||
| 	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) | ||||
| { | ||||
| 
 | ||||
| 
 | ||||
| 	for(bool compileViaYul: set<bool>{!m_runWithoutYul, m_runWithYul}) | ||||
| 	{ | ||||
| 		bool success = true; | ||||
| 
 | ||||
| 		m_compileViaYul = compileViaYul; | ||||
| 		if (compileViaYul) | ||||
| 			AnsiColorized(_stream, _formatted, {BOLD, CYAN}) << _linePrefix << "Running via Yul:" << endl; | ||||
| 
 | ||||
| 		for (auto& test: m_tests) | ||||
| 			test.reset(); | ||||
| 
 | ||||
| @ -115,8 +130,19 @@ TestCase::TestResult SemanticTest::run(ostream& _stream, string const& _linePref | ||||
| 			} | ||||
| 			AnsiColorized(_stream, _formatted, {BOLD, RED}) << _linePrefix << endl << _linePrefix | ||||
| 				<< "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::Success; | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -65,6 +65,8 @@ public: | ||||
| private: | ||||
| 	std::string m_source; | ||||
| 	std::vector<TestFunctionCall> m_tests; | ||||
| 	bool m_runWithYul = false; | ||||
| 	bool m_runWithoutYul = true; | ||||
| }; | ||||
| 
 | ||||
| } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user