mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #5899 from ethereum/fuzzer
Minor cleanups and improved debugging in the fuzzer
This commit is contained in:
commit
bf3968d69b
@ -19,11 +19,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <test/tools/fuzzer_common.h>
|
#include <test/tools/fuzzer_common.h>
|
||||||
|
|
||||||
|
#include <libdevcore/CommonIO.h>
|
||||||
|
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace dev;
|
using namespace dev;
|
||||||
using namespace dev::eth;
|
|
||||||
|
|
||||||
namespace po = boost::program_options;
|
namespace po = boost::program_options;
|
||||||
|
|
||||||
|
@ -16,15 +16,25 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <test/tools/fuzzer_common.h>
|
#include <test/tools/fuzzer_common.h>
|
||||||
#include <libdevcore/CommonData.h>
|
|
||||||
|
#include <libdevcore/JSON.h>
|
||||||
|
#include <libevmasm/Assembly.h>
|
||||||
|
#include <libevmasm/ConstantOptimiser.h>
|
||||||
|
#include <libsolc/libsolc.h>
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace dev;
|
using namespace dev;
|
||||||
using namespace dev::eth;
|
using namespace dev::eth;
|
||||||
|
|
||||||
void FuzzerUtil::runCompiler(string _input)
|
void FuzzerUtil::runCompiler(string const& _input, bool _quiet)
|
||||||
{
|
{
|
||||||
|
if (!_quiet)
|
||||||
|
cout << "Input JSON: " << _input << endl;
|
||||||
string outputString(solidity_compile(_input.c_str(), nullptr));
|
string outputString(solidity_compile(_input.c_str(), nullptr));
|
||||||
|
if (!_quiet)
|
||||||
|
cout << "Output JSON: " << outputString << endl;
|
||||||
Json::Value output;
|
Json::Value output;
|
||||||
if (!jsonParseStrict(outputString, output))
|
if (!jsonParseStrict(outputString, output))
|
||||||
{
|
{
|
||||||
@ -66,7 +76,7 @@ void FuzzerUtil::testCompiler(string const& _input, bool _optimize, bool _quiet)
|
|||||||
// Enable all Contract-level outputs.
|
// Enable all Contract-level outputs.
|
||||||
config["settings"]["outputSelection"]["*"]["*"][0] = "*";
|
config["settings"]["outputSelection"]["*"]["*"][0] = "*";
|
||||||
|
|
||||||
runCompiler(jsonCompactPrint(config));
|
runCompiler(jsonCompactPrint(config), _quiet);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FuzzerUtil::testConstantOptimizer(string const& _input, bool _quiet)
|
void FuzzerUtil::testConstantOptimizer(string const& _input, bool _quiet)
|
||||||
@ -112,5 +122,5 @@ void FuzzerUtil::testStandardCompiler(string const& _input, bool _quiet)
|
|||||||
if (!_quiet)
|
if (!_quiet)
|
||||||
cout << "Testing compiler via JSON interface." << endl;
|
cout << "Testing compiler via JSON interface." << endl;
|
||||||
|
|
||||||
runCompiler(_input);
|
runCompiler(_input, _quiet);
|
||||||
}
|
}
|
||||||
|
@ -15,21 +15,12 @@
|
|||||||
along with solidity. If not, see <http://www.gnu.org/licenses/>.
|
along with solidity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <libdevcore/CommonIO.h>
|
|
||||||
#include <libevmasm/Assembly.h>
|
|
||||||
#include <libsolc/libsolc.h>
|
|
||||||
#include <libevmasm/ConstantOptimiser.h>
|
|
||||||
|
|
||||||
#include <libdevcore/JSON.h>
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
struct FuzzerUtil
|
struct FuzzerUtil
|
||||||
{
|
{
|
||||||
static void runCompiler(std::string _input);
|
static void runCompiler(std::string const& _input, bool _quiet);
|
||||||
static void testCompiler(std::string const& _input, bool _optimize, bool quiet);
|
static void testCompiler(std::string const& _input, bool _optimize, bool _quiet);
|
||||||
static void testConstantOptimizer(std::string const& _input, bool _quiet);
|
static void testConstantOptimizer(std::string const& _input, bool _quiet);
|
||||||
static void testStandardCompiler(std::string const& _input, bool _quiet);
|
static void testStandardCompiler(std::string const& _input, bool _quiet);
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user