Browse Source

FuzzTest: filltest option

cl-refactor
Dimitry Khokhlov 10 years ago
parent
commit
226cbb5409
  1. 24
      test/fuzzTesting/createRandomTest.cpp

24
test/fuzzTesting/createRandomTest.cpp

@ -46,10 +46,12 @@ void parseTestWithTypes(std::string& test);
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
std::string testSuite; std::string testSuite;
std::string testFillString;
json_spirit::mValue testmValue; json_spirit::mValue testmValue;
bool checktest = false; bool checktest = false;
bool filldebug = false; bool filldebug = false;
bool debug = false; bool debug = false;
bool filltest = false;
for (auto i = 0; i < argc; ++i) for (auto i = 0; i < argc; ++i)
{ {
auto arg = std::string{argv[i]}; auto arg = std::string{argv[i]};
@ -64,7 +66,7 @@ int main(int argc, char *argv[])
testSuite = ""; testSuite = "";
} }
else else
if (arg == "-checktest" && i + 1 < argc) if ((arg == "-checktest" || arg == "-filltest") && i + 1 < argc)
{ {
std::string s; std::string s;
for (int j = i+1; j < argc; ++j) for (int j = i+1; j < argc; ++j)
@ -74,8 +76,16 @@ int main(int argc, char *argv[])
std::cout << "Error! Content of argument is empty! (Usage -checktest textstream) \n"; std::cout << "Error! Content of argument is empty! (Usage -checktest textstream) \n";
return 1; return 1;
} }
read_string(s, testmValue); if (arg == "-filltest")
checktest = true; {
testFillString = s;
filltest = true;
}
else
{
read_string(s, testmValue);
checktest = true;
}
} }
else else
if (arg == "--debug") if (arg == "--debug")
@ -100,7 +110,7 @@ int main(int argc, char *argv[])
if (checktest) if (checktest)
return checkRandomTest(dev::test::doBlockchainTests, testmValue, debug); return checkRandomTest(dev::test::doBlockchainTests, testmValue, debug);
else else
fillRandomTest(dev::test::doBlockchainTests, c_testExampleBlockchainTest, filldebug); fillRandomTest(dev::test::doBlockchainTests, (filltest) ? testFillString : c_testExampleBlockchainTest, filldebug);
} }
else else
if (testSuite == "TransactionTests") if (testSuite == "TransactionTests")
@ -108,7 +118,7 @@ int main(int argc, char *argv[])
if (checktest) if (checktest)
return checkRandomTest(dev::test::doTransactionTests, testmValue, debug); return checkRandomTest(dev::test::doTransactionTests, testmValue, debug);
else else
fillRandomTest(dev::test::doTransactionTests, c_testExampleTransactionTest, filldebug); fillRandomTest(dev::test::doTransactionTests, (filltest) ? testFillString : c_testExampleTransactionTest, filldebug);
} }
else else
if (testSuite == "StateTests") if (testSuite == "StateTests")
@ -116,7 +126,7 @@ int main(int argc, char *argv[])
if (checktest) if (checktest)
return checkRandomTest(dev::test::doStateTests, testmValue, debug); return checkRandomTest(dev::test::doStateTests, testmValue, debug);
else else
fillRandomTest(dev::test::doStateTests, c_testExampleStateTest, filldebug); fillRandomTest(dev::test::doStateTests, (filltest) ? testFillString : c_testExampleStateTest, filldebug);
} }
else else
if (testSuite == "VMTests") if (testSuite == "VMTests")
@ -127,7 +137,7 @@ int main(int argc, char *argv[])
return checkRandomTest(dev::test::doVMTests, testmValue, debug); return checkRandomTest(dev::test::doVMTests, testmValue, debug);
} }
else else
fillRandomTest(dev::test::doVMTests, c_testExampleVMTest, filldebug); fillRandomTest(dev::test::doVMTests, (filltest) ? testFillString : c_testExampleVMTest, filldebug);
} }
} }

Loading…
Cancel
Save