mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	soltest: provides sane defaults for --testpath command line option
This commit is contained in:
		
							parent
							
								
									363b527bc5
								
							
						
					
					
						commit
						d1e05bf647
					
				| @ -25,9 +25,11 @@ | |||||||
| #include <libsolidity/interface/Exceptions.h> | #include <libsolidity/interface/Exceptions.h> | ||||||
| 
 | 
 | ||||||
| #include <boost/test/framework.hpp> | #include <boost/test/framework.hpp> | ||||||
|  | #include <boost/filesystem.hpp> | ||||||
| 
 | 
 | ||||||
| using namespace std; | using namespace std; | ||||||
| using namespace dev::test; | using namespace dev::test; | ||||||
|  | namespace fs = boost::filesystem; | ||||||
| 
 | 
 | ||||||
| Options const& Options::get() | Options const& Options::get() | ||||||
| { | { | ||||||
| @ -70,6 +72,27 @@ Options::Options() | |||||||
| 	if (testPath.empty()) | 	if (testPath.empty()) | ||||||
| 		if (auto path = getenv("ETH_TEST_PATH")) | 		if (auto path = getenv("ETH_TEST_PATH")) | ||||||
| 			testPath = path; | 			testPath = path; | ||||||
|  | 
 | ||||||
|  | 	if (testPath.empty()) | ||||||
|  | 	{ | ||||||
|  | 		auto const searchPath = | ||||||
|  | 		{ | ||||||
|  | 			fs::current_path() / ".." / ".." / ".." / "test", | ||||||
|  | 			fs::current_path() / ".." / ".." / "test", | ||||||
|  | 			fs::current_path() / ".." / "test", | ||||||
|  | 			fs::current_path() / "test", | ||||||
|  | 			fs::current_path() | ||||||
|  | 		}; | ||||||
|  | 		for (auto const& basePath : searchPath) | ||||||
|  | 		{ | ||||||
|  | 			fs::path syntaxTestPath = basePath / "libsolidity" / "syntaxTests"; | ||||||
|  | 			if (fs::exists(syntaxTestPath) && fs::is_directory(syntaxTestPath)) | ||||||
|  | 			{ | ||||||
|  | 				testPath = basePath; | ||||||
|  | 				break; | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void Options::validate() const | void Options::validate() const | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user