mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Support multiple input files with solfuzzer
This commit is contained in:
parent
101ca5c120
commit
30820dda99
@ -60,6 +60,10 @@ Allowed options)",
|
|||||||
"input-file",
|
"input-file",
|
||||||
po::value<string>(),
|
po::value<string>(),
|
||||||
"input file"
|
"input file"
|
||||||
|
)(
|
||||||
|
"input-files",
|
||||||
|
po::value<std::vector<string>>()->multitoken(),
|
||||||
|
"input files"
|
||||||
)
|
)
|
||||||
(
|
(
|
||||||
"without-optimizer",
|
"without-optimizer",
|
||||||
@ -93,18 +97,47 @@ Allowed options)",
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
string input;
|
vector<string> inputs;
|
||||||
if (arguments.count("input-file"))
|
if (arguments.count("input-file"))
|
||||||
input = readFileAsString(arguments["input-file"].as<string>());
|
inputs.push_back(arguments["input-file"].as<string>());
|
||||||
|
else if (arguments.count("input-files"))
|
||||||
|
inputs = arguments["input-files"].as<vector<string>>();
|
||||||
else
|
else
|
||||||
input = readStandardInput();
|
inputs.push_back("");
|
||||||
|
|
||||||
|
bool optimize = !arguments.count("without-optimizer");
|
||||||
|
int retResult = 0;
|
||||||
|
|
||||||
|
for (string const& inputFile: inputs)
|
||||||
|
{
|
||||||
|
string input;
|
||||||
|
if (inputFile.size() == 0)
|
||||||
|
input = readStandardInput();
|
||||||
|
else
|
||||||
|
input = readFileAsString(inputFile);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
if (arguments.count("const-opt"))
|
if (arguments.count("const-opt"))
|
||||||
FuzzerUtil::testConstantOptimizer(input, quiet);
|
FuzzerUtil::testConstantOptimizer(input, quiet);
|
||||||
else if (arguments.count("standard-json"))
|
else if (arguments.count("standard-json"))
|
||||||
FuzzerUtil::testStandardCompiler(input, quiet);
|
FuzzerUtil::testStandardCompiler(input, quiet);
|
||||||
else
|
else
|
||||||
FuzzerUtil::testCompiler(input, !arguments.count("without-optimizer"), quiet);
|
FuzzerUtil::testCompiler(input, optimize, quiet);
|
||||||
|
}
|
||||||
|
catch (exception const& _exc)
|
||||||
|
{
|
||||||
|
retResult = 1;
|
||||||
|
|
||||||
return 0;
|
if (inputFile.size() == 0)
|
||||||
|
throw _exc;
|
||||||
|
|
||||||
|
cerr << "Fuzzer "
|
||||||
|
<< (optimize ? "" : "(without optimizer) ")
|
||||||
|
<< "failed on "
|
||||||
|
<< inputFile;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return retResult;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user