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)
{
cout << "Looking for " << _value << endl;
if (_value < 0x10000)
// Very small value, not worth computing
return AssemblyItems{_value};

View File

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

View File

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