mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Parse arguments in free function.
This commit is contained in:
		
							parent
							
								
									27df4b7e71
								
							
						
					
					
						commit
						93c8fc094e
					
				| @ -20,40 +20,39 @@ | |||||||
|  * Framework for executing Solidity contracts and testing them against C++ implementation. |  * Framework for executing Solidity contracts and testing them against C++ implementation. | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
|  | #include <cstdlib> | ||||||
| #include <boost/test/framework.hpp> | #include <boost/test/framework.hpp> | ||||||
| #include <test/libsolidity/SolidityExecutionFramework.h> | #include <test/libsolidity/SolidityExecutionFramework.h> | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| using namespace std; | using namespace std; | ||||||
| using namespace dev; | using namespace dev; | ||||||
| using namespace dev::solidity; | using namespace dev::solidity; | ||||||
| using namespace dev::solidity::test; | using namespace dev::solidity::test; | ||||||
| 
 | 
 | ||||||
| ExecutionFramework::boostArg::boostArg() | string getIPCSocketPath() | ||||||
| { | { | ||||||
|  | 	string ipcPath; | ||||||
|  | 
 | ||||||
| 	size_t argc = boost::unit_test::framework::master_test_suite().argc; | 	size_t argc = boost::unit_test::framework::master_test_suite().argc; | ||||||
| 	char** argv = boost::unit_test::framework::master_test_suite().argv; | 	char** argv = boost::unit_test::framework::master_test_suite().argv; | ||||||
| 	for (size_t i = 0; i < argc; i++) | 	for (size_t i = 0; i < argc; i++) | ||||||
| 	{ | 	{ | ||||||
| 		string arg = argv[i]; | 		string arg = argv[i]; | ||||||
| 		if (arg == "--ipc" && i+1 < argc) | 		if (arg == "--ipc" && i + 1 < argc) | ||||||
| 		{ | 		{ | ||||||
| 			ipcPath = argv[i+1]; | 			ipcPath = argv[i + 1]; | ||||||
| 			i++; | 			i++; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  | 	if (ipcPath.empty()) | ||||||
|  | 		ipcPath = getenv("ETH_TEST_IPC"); | ||||||
| 	if (ipcPath.empty()) | 	if (ipcPath.empty()) | ||||||
| 		BOOST_FAIL("ERROR: ipcPath not set! (use --ipc <path>)"); | 		BOOST_FAIL("ERROR: ipcPath not set! (use --ipc <path>)"); | ||||||
| } | 	return ipcPath; | ||||||
| 
 |  | ||||||
| ExecutionFramework::boostArg const& ExecutionFramework::getArgs() |  | ||||||
| { |  | ||||||
| 	static boostArg boostArgs; |  | ||||||
| 	return boostArgs; |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| ExecutionFramework::ExecutionFramework() : | ExecutionFramework::ExecutionFramework() : | ||||||
| 	m_rpc(RPCSession::instance(getArgs().ipcPath)), | 	m_rpc(RPCSession::instance(getIPCSocketPath())), | ||||||
| 	m_sender(m_rpc.account(0)) | 	m_sender(m_rpc.account(0)) | ||||||
| { | { | ||||||
| 	if (g_logVerbosity != -1) | 	if (g_logVerbosity != -1) | ||||||
|  | |||||||
| @ -255,13 +255,6 @@ protected: | |||||||
| 	bool storageEmpty(Address const& _addr); | 	bool storageEmpty(Address const& _addr); | ||||||
| 	bool addressHasCode(Address const& _addr); | 	bool addressHasCode(Address const& _addr); | ||||||
| 
 | 
 | ||||||
| 	struct boostArg |  | ||||||
| 	{ |  | ||||||
| 		boostArg(); |  | ||||||
| 		std::string ipcPath; |  | ||||||
| 	}; |  | ||||||
| 
 |  | ||||||
| 	boostArg const& getArgs(); |  | ||||||
| 	RPCSession& m_rpc; | 	RPCSession& m_rpc; | ||||||
| 
 | 
 | ||||||
| 	struct LogEntry | 	struct LogEntry | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user