Browse Source

testeth: fix --singletest option

cl-refactor
Paweł Bylica 10 years ago
parent
commit
446abc57e5
  1. 25
      test/TestHelper.cpp
  2. 3
      test/TestHelper.h
  3. 2
      test/libethereum/blockchain.cpp
  4. 2
      test/libethereum/state.cpp
  5. 2
      test/libethereum/transaction.cpp
  6. 2
      test/libevm/vm.cpp

25
test/TestHelper.cpp

@ -549,22 +549,16 @@ void checkCallCreates(eth::Transactions _resultCallCreates, eth::Transactions _e
}
}
void userDefinedTest(string testTypeFlag, std::function<void(json_spirit::mValue&, bool)> doTests)
void userDefinedTest(std::function<void(json_spirit::mValue&, bool)> doTests)
{
Options::get(); // parse command line options, e.g. to enable JIT
for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i)
{
string arg = boost::unit_test::framework::master_test_suite().argv[i];
if (arg == testTypeFlag)
{
if (boost::unit_test::framework::master_test_suite().argc <= i + 2)
if (!Options::get().singleTest)
{
cnote << "Missing filename\nUsage: testeth " << testTypeFlag << " <filename> <testname>\n";
cnote << "Missing user test specification\nUsage: testeth --singletest <filename> <testname>\n";
return;
}
string filename = boost::unit_test::framework::master_test_suite().argv[i + 1];
string testname = boost::unit_test::framework::master_test_suite().argv[i + 2];
auto& filename = Options::get().singleTestFile;
auto& testname = Options::get().singleTestName;
int currentVerbosity = g_logVerbosity;
g_logVerbosity = 12;
try
@ -600,8 +594,6 @@ void userDefinedTest(string testTypeFlag, std::function<void(json_spirit::mValue
}
g_logVerbosity = currentVerbosity;
}
}
}
void executeTests(const string& _name, const string& _testPathAppendix, const boost::filesystem::path _pathToFiller, std::function<void(json_spirit::mValue&, bool)> doTests)
{
@ -740,10 +732,11 @@ Options::Options()
inputLimits = true;
bigData = true;
}
else if (arg == "--singletest" && i + 1 < argc)
else if (arg == "--singletest" && i + 2 < argc)
{
singleTest = true;
singleTestName = argv[i + 1];
singleTestFile = argv[i + 1];
singleTestName = argv[i + 2];
}
}
}

3
test/TestHelper.h

@ -157,7 +157,7 @@ void checkLog(eth::LogEntries _resultLogs, eth::LogEntries _expectedLogs);
void checkCallCreates(eth::Transactions _resultCallCreates, eth::Transactions _expectedCallCreates);
void executeTests(const std::string& _name, const std::string& _testPathAppendix, const boost::filesystem::path _pathToFiller, std::function<void(json_spirit::mValue&, bool)> doTests);
void userDefinedTest(std::string testTypeFlag, std::function<void(json_spirit::mValue&, bool)> doTests);
void userDefinedTest(std::function<void(json_spirit::mValue&, bool)> doTests);
RLPStream createRLPStreamFromTransactionFields(json_spirit::mObject& _tObj);
eth::LastHashes lastHashes(u256 _currentBlockNumber);
json_spirit::mObject fillJsonWithState(eth::State _state);
@ -189,6 +189,7 @@ public:
/// Test selection
/// @{
bool singleTest = false;
std::string singleTestFile;
std::string singleTestName;
bool performance = false;
bool quadratic = false;

2
test/libethereum/blockchain.cpp

@ -711,7 +711,7 @@ BOOST_AUTO_TEST_CASE(bcWalletTest)
BOOST_AUTO_TEST_CASE(userDefinedFile)
{
dev::test::userDefinedTest("--singletest", dev::test::doBlockchainTests);
dev::test::userDefinedTest(dev::test::doBlockchainTests);
}
BOOST_AUTO_TEST_SUITE_END()

2
test/libethereum/state.cpp

@ -265,7 +265,7 @@ BOOST_AUTO_TEST_CASE(stRandom)
BOOST_AUTO_TEST_CASE(userDefinedFileState)
{
dev::test::userDefinedTest("--singletest", dev::test::doStateTests);
dev::test::userDefinedTest(dev::test::doStateTests);
}
BOOST_AUTO_TEST_SUITE_END()

2
test/libethereum/transaction.cpp

@ -195,7 +195,7 @@ BOOST_AUTO_TEST_CASE(ttCreateTest)
BOOST_AUTO_TEST_CASE(userDefinedFile)
{
dev::test::userDefinedTest("--singletest", dev::test::doTransactionTests);
dev::test::userDefinedTest(dev::test::doTransactionTests);
}
BOOST_AUTO_TEST_SUITE_END()

2
test/libevm/vm.cpp

@ -548,7 +548,7 @@ BOOST_AUTO_TEST_CASE(vmRandom)
BOOST_AUTO_TEST_CASE(userDefinedFile)
{
dev::test::userDefinedTest("--singletest", dev::test::doVMTests);
dev::test::userDefinedTest(dev::test::doVMTests);
}
BOOST_AUTO_TEST_SUITE_END()

Loading…
Cancel
Save