Make the fuzzer quiet

This commit is contained in:
chriseth 2017-04-27 11:35:29 +02:00 committed by Alex Beregszaszi
parent 99dd28d63e
commit 3a93aec768
3 changed files with 17 additions and 11 deletions

View File

@ -182,7 +182,6 @@ AssemblyItems const& CodeCopyMethod::copyRoutine() const
AssemblyItems ComputeMethod::findRepresentation(u256 const& _value) AssemblyItems ComputeMethod::findRepresentation(u256 const& _value)
{ {
cout << "Looking for " << _value << endl;
if (_value < 0x10000) if (_value < 0x10000)
// Very small value, not worth computing // Very small value, not worth computing
return AssemblyItems{_value}; return AssemblyItems{_value};

View File

@ -79,7 +79,7 @@ TMPDIR=$(mktemp -d)
"$REPO_ROOT"/scripts/isolate_tests.py "$REPO_ROOT"/test/ "$REPO_ROOT"/scripts/isolate_tests.py "$REPO_ROOT"/test/
for f in *.sol for f in *.sol
do do
"$REPO_ROOT"/build/test/solfuzzer < "$f" "$REPO_ROOT"/build/test/solfuzzer --quiet < "$f"
done done
) )
rm -rf "$TMPDIR" rm -rf "$TMPDIR"

View File

@ -38,6 +38,8 @@ extern "C"
extern char const* compileJSON(char const* _input, bool _optimize); extern char const* compileJSON(char const* _input, bool _optimize);
} }
bool quiet = false;
string contains(string const& _haystack, vector<string> const& _needles) string contains(string const& _haystack, vector<string> const& _needles)
{ {
for (string const& needle: _needles) for (string const& needle: _needles)
@ -48,7 +50,8 @@ string contains(string const& _haystack, vector<string> const& _needles)
void testConstantOptimizer() void testConstantOptimizer()
{ {
cout << "Testing constant optimizer" << endl; if (!quiet)
cout << "Testing constant optimizer" << endl;
vector<u256> numbers; vector<u256> numbers;
while (!cin.eof()) while (!cin.eof())
{ {
@ -56,12 +59,14 @@ void testConstantOptimizer()
cin.read(reinterpret_cast<char*>(data.data()), 32); cin.read(reinterpret_cast<char*>(data.data()), 32);
numbers.push_back(u256(data)); numbers.push_back(u256(data));
} }
cout << "Got " << numbers.size() << " inputs:" << endl; if (!quiet)
cout << "Got " << numbers.size() << " inputs:" << endl;
Assembly assembly; Assembly assembly;
for (u256 const& n: numbers) for (u256 const& n: numbers)
{ {
cout << n << endl; if (!quiet)
cout << n << endl;
assembly.append(n); assembly.append(n);
} }
for (bool isCreation: {false, true}) for (bool isCreation: {false, true})
@ -80,7 +85,8 @@ void testConstantOptimizer()
void testCompiler() void testCompiler()
{ {
cout << "Testing compiler." << endl; if (!quiet)
cout << "Testing compiler." << endl;
string input; string input;
while (!cin.eof()) while (!cin.eof())
{ {
@ -140,13 +146,11 @@ Allowed options)",
po::options_description::m_default_line_length, po::options_description::m_default_line_length,
po::options_description::m_default_line_length - 23); po::options_description::m_default_line_length - 23);
options.add_options() options.add_options()
( ("help", "Show this help screen.")
"help", ("quiet", "Only output errors.")
"Show this help screen."
)
( (
"const-opt", "const-opt",
"Only run the constant optimizer. " "Run the constant optimizer instead of compiling. "
"Expects a binary string of up to 32 bytes on stdin." "Expects a binary string of up to 32 bytes on stdin."
); );
@ -163,6 +167,9 @@ Allowed options)",
return false; return false;
} }
if (arguments.count("quiet"))
quiet = true;
if (arguments.count("help")) if (arguments.count("help"))
cout << options; cout << options;
else if (arguments.count("const-opt")) else if (arguments.count("const-opt"))