mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #6433 from ethereum/fuzzhelp
Run several instances of solfuzzer in parallel
This commit is contained in:
commit
862ad28edd
@ -392,26 +392,9 @@ SOLTMPDIR=$(mktemp -d)
|
|||||||
cd "$SOLTMPDIR"
|
cd "$SOLTMPDIR"
|
||||||
"$REPO_ROOT"/scripts/isolate_tests.py "$REPO_ROOT"/test/
|
"$REPO_ROOT"/scripts/isolate_tests.py "$REPO_ROOT"/test/
|
||||||
"$REPO_ROOT"/scripts/isolate_tests.py "$REPO_ROOT"/docs/ docs
|
"$REPO_ROOT"/scripts/isolate_tests.py "$REPO_ROOT"/docs/ docs
|
||||||
for f in *.sol
|
|
||||||
do
|
|
||||||
set +e
|
|
||||||
"$REPO_ROOT"/build/test/tools/solfuzzer --quiet < "$f"
|
|
||||||
if [ $? -ne 0 ]
|
|
||||||
then
|
|
||||||
printError "Fuzzer failed on:"
|
|
||||||
cat "$f"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
"$REPO_ROOT"/build/test/tools/solfuzzer --without-optimizer --quiet < "$f"
|
echo *.sol | xargs -P 4 -n 50 "$REPO_ROOT"/build/test/tools/solfuzzer --quiet --input-files
|
||||||
if [ $? -ne 0 ]
|
echo *.sol | xargs -P 4 -n 50 "$REPO_ROOT"/build/test/tools/solfuzzer --without-optimizer --quiet --input-files
|
||||||
then
|
|
||||||
printError "Fuzzer (without optimizer) failed on:"
|
|
||||||
cat "$f"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
set -e
|
|
||||||
done
|
|
||||||
)
|
)
|
||||||
rm -rf "$SOLTMPDIR"
|
rm -rf "$SOLTMPDIR"
|
||||||
|
|
||||||
|
@ -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);
|
||||||
|
}
|
||||||
return 0;
|
catch (exception const& _exc)
|
||||||
|
{
|
||||||
|
retResult = 1;
|
||||||
|
|
||||||
|
if (inputFile.size() == 0)
|
||||||
|
throw _exc;
|
||||||
|
|
||||||
|
cerr << "Fuzzer "
|
||||||
|
<< (optimize ? "" : "(without optimizer) ")
|
||||||
|
<< "failed on "
|
||||||
|
<< inputFile;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return retResult;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user