30 cout <<
"Usage: " << std::endl;
32 cout << std::endl <<
"Setting test suite" << std::endl;
33 cout << setw(30) <<
"-t <TestSuite>" << setw(25) <<
"Execute test operations" << std::endl;
34 cout << setw(30) <<
"-t <TestSuite>/<TestCase>" << std::endl;
36 cout << std::endl <<
"Debugging" << std::endl;
37 cout << setw(30) <<
"-d <index>" << setw(25) <<
"Set the transaction data array index when running GeneralStateTests" << std::endl;
38 cout << setw(30) <<
"-g <index>" << setw(25) <<
"Set the transaction gas array index when running GeneralStateTests" << std::endl;
39 cout << setw(30) <<
"-v <index>" << setw(25) <<
"Set the transaction value array index when running GeneralStateTests" << std::endl;
40 cout << setw(30) <<
"--singletest <TestName>" << setw(25) <<
"Run on a single test" << std::endl;
41 cout << setw(30) <<
"--singletest <TestFile> <TestName>" << std::endl;
42 cout << setw(30) <<
"--verbosity <level>" << setw(25) <<
"Set logs verbosity. 0 - silent, 1 - only errors, 2 - informative, >2 - detailed" << std::endl;
43 cout << setw(30) <<
"--vm <interpreter|jit|smart>" << setw(25) <<
"Set VM type for VMTests suite" << std::endl;
44 cout << setw(30) <<
"--vmtrace" << setw(25) <<
"Enable VM trace for the test. (Require build with VMTRACE=1)" << std::endl;
45 cout << setw(30) <<
"--stats <OutFile>" << setw(25) <<
"Output debug stats to the file" << std::endl;
46 cout << setw(30) <<
"--exectimelog" << setw(25) <<
"Output execution time for each test suite" << std::endl;
47 cout << setw(30) <<
"--filltest <FileData>" << setw(25) <<
"Try fill tests from the given json stream" << std::endl;
48 cout << setw(30) <<
"--checktest <FileData>" << setw(25) <<
"Try run tests from the given json stream" << std::endl;
50 cout << std::endl <<
"Additional Tests" << std::endl;
51 cout << setw(30) <<
"--performance" << setw(25) <<
"Enable perfomance tests" << std::endl;
52 cout << setw(30) <<
"--quadratic" << setw(25) <<
"Enable quadratic complexity tests" << std::endl;
53 cout << setw(30) <<
"--memory" << setw(25) <<
"Enable memory consuming tests" << std::endl;
54 cout << setw(30) <<
"--inputLimits" << setw(25) <<
"Enable inputLimits tests" << std::endl;
55 cout << setw(30) <<
"--bigdata" << setw(25) <<
"Enable bigdata tests" << std::endl;
56 cout << setw(30) <<
"--wallet" << setw(25) <<
"Enable wallet tests" << std::endl;
57 cout << setw(30) <<
"--all" << setw(25) <<
"Enable all tests" << std::endl;
59 cout << std::endl <<
"Test Generation" << std::endl;
60 cout << setw(30) <<
"--filltests" << setw(25) <<
"Run test fillers" << std::endl;
61 cout << setw(30) <<
"--checkstate" << setw(25) <<
"Enable expect section state checks" << std::endl;
62 cout << setw(30) <<
"--fillchain" << setw(25) <<
"When filling the state tests, fill tests as blockchain instead" << std::endl;
63 cout << setw(30) <<
"--createRandomTest" << setw(25) <<
"Create random test and output it to the console" << std::endl;
66 cout << setw(30) <<
"--help" << setw(25) <<
"Display list of command arguments" << std::endl;
69 Options::Options(
int argc,
char** argv)
74 for (
auto i = 0; i < argc; ++i)
76 auto arg = std::string{argv[i]};
83 if (arg ==
"--vm" && i + 1 < argc)
85 string vmKind = argv[++i];
86 if (vmKind ==
"interpreter")
87 VMFactory::setKind(VMKind::Interpreter);
88 else if (vmKind ==
"jit")
89 VMFactory::setKind(VMKind::JIT);
90 else if (vmKind ==
"smart")
91 VMFactory::setKind(VMKind::Smart);
93 cerr <<
"Unknown VM kind: " << vmKind << endl;
95 else if (arg ==
"--jit")
96 VMFactory::setKind(VMKind::JIT);
97 else if (arg ==
"--vmtrace")
102 else if (arg ==
"--filltests")
104 else if (arg ==
"--fillchain")
106 else if (arg ==
"--stats" && i + 1 < argc)
109 statsOutFile = argv[i + 1];
111 else if (arg ==
"--exectimelog")
113 else if (arg ==
"--performance")
115 else if (arg ==
"--quadratic")
117 else if (arg ==
"--memory")
119 else if (arg ==
"--inputlimits")
121 else if (arg ==
"--bigdata")
123 else if (arg ==
"--checkstate")
125 else if (arg ==
"--wallet")
127 else if (arg ==
"--all")
136 else if (arg ==
"--singletest" && i + 1 < argc)
139 auto name1 = std::string{argv[i + 1]};
142 auto name2 = std::string{argv[i + 2]};
144 singleTestName = std::move(name1);
147 singleTestFile = std::move(name1);
148 singleTestName = std::move(name2);
152 singleTestName = std::move(name1);
154 else if (arg ==
"--singlenet" && i + 1 < argc)
155 singleTestNet = std::string{argv[i + 1]};
156 else if (arg ==
"--fulloutput")
158 else if (arg ==
"--verbosity" && i + 1 < argc)
160 static std::ostringstream strCout;
161 std::string indentLevel = std::string{argv[i + 1]};
162 if (indentLevel ==
"0")
164 logVerbosity = Verbosity::None;
165 std::cout.rdbuf(strCout.rdbuf());
166 std::cerr.rdbuf(strCout.rdbuf());
168 else if (indentLevel ==
"1")
169 logVerbosity = Verbosity::NiceReport;
171 logVerbosity = Verbosity::Full;
173 int indentLevelInt =
atoi(argv[i + 1]);
177 else if (arg ==
"--createRandomTest")
179 else if (arg ==
"-t" && i + 1 < argc)
180 rCurrentTestSuite = std::string{argv[i + 1]};
181 else if (arg ==
"--checktest" || arg ==
"--filltest")
184 for (
int j = i+1; j < argc; ++j)
185 rCheckTest += argv[j];
188 else if (arg ==
"--nonetwork")
190 else if (arg ==
"-d" && i + 1 < argc)
191 trDataIndex =
atoi(argv[i + 1]);
192 else if (arg ==
"-g" && i + 1 < argc)
193 trGasIndex =
atoi(argv[i + 1]);
194 else if (arg ==
"-v" && i + 1 < argc)
195 trValueIndex =
atoi(argv[i + 1]);
199 if (logVerbosity == Verbosity::NiceReport)
203 Options const& Options::get(
int argc,
char** argv)
205 static Options instance(argc, argv);
std::hash for asio::adress
Class for handling testeth custom options.
int g_logVerbosity
The logging system's current verbosity.
int atoi(const std::string &str)