mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Merge pull request #3579 from ethereum/fuzzer-stdin
Use readStandardInput in the fuzzer
This commit is contained in:
		
						commit
						f8bbf84fa4
					
				| @ -18,6 +18,7 @@ | |||||||
|  * Executable for use with AFL <http://lcamtuf.coredump.cx/afl>.
 |  * Executable for use with AFL <http://lcamtuf.coredump.cx/afl>.
 | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
|  | #include <libdevcore/CommonIO.h> | ||||||
| #include <libevmasm/Assembly.h> | #include <libevmasm/Assembly.h> | ||||||
| #include <libevmasm/ConstantOptimiser.h> | #include <libevmasm/ConstantOptimiser.h> | ||||||
| #include <libsolc/libsolc.h> | #include <libsolc/libsolc.h> | ||||||
| @ -82,23 +83,12 @@ void testConstantOptimizer() | |||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| string readInput() |  | ||||||
| { |  | ||||||
| 	string input; |  | ||||||
| 	while (!cin.eof()) |  | ||||||
| 	{ |  | ||||||
| 		string s; |  | ||||||
| 		getline(cin, s); |  | ||||||
| 		input += s + '\n'; |  | ||||||
| 	} |  | ||||||
| 	return input; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void testStandardCompiler() | void testStandardCompiler() | ||||||
| { | { | ||||||
| 	if (!quiet) | 	if (!quiet) | ||||||
| 		cout << "Testing compiler via JSON interface." << endl; | 		cout << "Testing compiler via JSON interface." << endl; | ||||||
| 	string input = readInput(); | 	string input = readStandardInput(); | ||||||
|  | 
 | ||||||
| 	string outputString(compileStandard(input.c_str(), NULL)); | 	string outputString(compileStandard(input.c_str(), NULL)); | ||||||
| 	Json::Value output; | 	Json::Value output; | ||||||
| 	if (!jsonParseStrict(outputString, output)) | 	if (!jsonParseStrict(outputString, output)) | ||||||
| @ -125,7 +115,7 @@ void testCompiler(bool optimize) | |||||||
| { | { | ||||||
| 	if (!quiet) | 	if (!quiet) | ||||||
| 		cout << "Testing compiler " << (optimize ? "with" : "without") << " optimizer." << endl; | 		cout << "Testing compiler " << (optimize ? "with" : "without") << " optimizer." << endl; | ||||||
| 	string input = readInput(); | 	string input = readStandardInput(); | ||||||
| 
 | 
 | ||||||
| 	string outputString(compileJSON(input.c_str(), optimize)); | 	string outputString(compileJSON(input.c_str(), optimize)); | ||||||
| 	Json::Value outputJson; | 	Json::Value outputJson; | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user