Merge pull request #2858 from ethereum/fuzzer-without-optimizer

Run fuzzer tests without optimizer too
This commit is contained in:
chriseth 2017-08-31 11:18:43 +02:00 committed by GitHub
commit 402d6e713e
2 changed files with 14 additions and 4 deletions

View File

@ -147,6 +147,13 @@ TMPDIR=$(mktemp -d)
cat "$f" cat "$f"
exit 1 exit 1
fi fi
"$REPO_ROOT"/build/test/solfuzzer --without-optimizer --quiet < "$f"
if [ $? -ne 0 ]; then
echo "Fuzzer (without optimizer) failed on:"
cat "$f"
exit 1
fi
set -e set -e
done done
) )

View File

@ -121,13 +121,12 @@ void testStandardCompiler()
} }
} }
void testCompiler() void testCompiler(bool optimize)
{ {
if (!quiet) if (!quiet)
cout << "Testing compiler." << endl; cout << "Testing compiler " << (optimize ? "with" : "without") << " optimizer." << endl;
string input = readInput(); string input = readInput();
bool optimize = true;
string outputString(compileJSON(input.c_str(), optimize)); string outputString(compileJSON(input.c_str(), optimize));
Json::Value outputJson; Json::Value outputJson;
if (!Json::Reader().parse(outputString, outputJson)) if (!Json::Reader().parse(outputString, outputJson))
@ -191,6 +190,10 @@ Allowed options)",
"const-opt", "const-opt",
"Run the constant optimizer instead of compiling. " "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."
)
(
"without-optimizer",
"Run without optimizations. Cannot be used together with standard-json."
); );
po::variables_map arguments; po::variables_map arguments;
@ -216,7 +219,7 @@ Allowed options)",
else if (arguments.count("standard-json")) else if (arguments.count("standard-json"))
testStandardCompiler(); testStandardCompiler();
else else
testCompiler(); testCompiler(!arguments.count("without-optimizer"));
return 0; return 0;
} }