Skip to content
This repository was archived by the owner on Oct 28, 2021. It is now read-only.

Commit b9422f3

Browse files
Dimitry Khgumb0
authored andcommitted
fixes LegacyTests suite
1 parent 0e3b654 commit b9422f3

File tree

6 files changed

+106
-62
lines changed

6 files changed

+106
-62
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## [1.7.0] - Unreleased
44

5+
- Added: [#5735](https://github.com/ethereum/aleth/pull/5735) LegacyTests suite to the testeth
56
- Added: [#5537](https://github.com/ethereum/aleth/pull/5537) Creating Ethereum Node Record (ENR) at program start.
67
- Added: [#5571](https://github.com/ethereum/aleth/pull/5571) Support Discovery v4 ENR Extension messages.
78
- Added: [#5557](https://github.com/ethereum/aleth/pull/5557) Improved debug logging of full sync.

test/tools/jsontests/BlockChainTests.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
2121
#pragma once
2222
#include <libethashseal/Ethash.h>
2323
#include <libethashseal/GenesisInfo.h>
24-
#include <test/tools/jsontests/Common.h>
24+
#include <test/tools/jsontests/StateTestFixtureBase.h>
2525
#include <test/tools/libtesteth/BlockChainHelper.h>
2626
#include <test/tools/libtesteth/TestSuite.h>
2727
#include <boost/filesystem/path.hpp>
@@ -57,7 +57,7 @@ class BCGeneralStateTestsSuite : public BlockchainValidTestSuite
5757
class bcGeneralTestsFixture : public StateTestFixtureBase<BCGeneralStateTestsSuite>
5858
{
5959
public:
60-
bcGeneralTestsFixture() : StateTestFixtureBase(TestExecution::REQUIRE_OPTION_ALL) {}
60+
bcGeneralTestsFixture() : StateTestFixtureBase(TestExecution::RequireOptionAll) {}
6161
};
6262

6363
class TransitionTestsSuite: public TestSuite

test/tools/jsontests/Common.h

Lines changed: 0 additions & 55 deletions
This file was deleted.

test/tools/jsontests/LegacyTestsBoost.h

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
1+
/*
2+
This file is part of cpp-ethereum.
3+
4+
cpp-ethereum is free software: you can redistribute it and/or modify
5+
it under the terms of the GNU General Public License as published by
6+
the Free Software Foundation, either version 3 of the License, or
7+
(at your option) any later version.
8+
9+
cpp-ethereum is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
GNU General Public License for more details.
13+
14+
You should have received a copy of the GNU General Public License
15+
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
/** @file LegacyTestsBoost.h
18+
* @authors:
19+
* Dimitry Khokhlov <dimitry@ethereum.org>
20+
* @date 2019
21+
*/
22+
123
#include <test/tools/jsontests/BlockChainTests.h>
2-
#include <test/tools/jsontests/Common.h>
24+
#include <test/tools/jsontests/StateTestFixtureBase.h>
325
#include <test/tools/jsontests/StateTests.h>
426

527
namespace fs = boost::filesystem;
@@ -39,7 +61,7 @@ class LegacyConstantinopleGeneralStateTestFixture
3961
{
4062
public:
4163
LegacyConstantinopleGeneralStateTestFixture()
42-
: StateTestFixtureBase(TestExecution::NOT_REFILLABLE)
64+
: StateTestFixtureBase(TestExecution::NotRefillable)
4365
{}
4466
};
4567

@@ -48,7 +70,7 @@ class LegacyConstantinopleBCGeneralStateTestFixture
4870
{
4971
public:
5072
LegacyConstantinopleBCGeneralStateTestFixture()
51-
: StateTestFixtureBase(TestExecution::REQUIRE_OPTION_ALL_NOT_REFILLABLE)
73+
: StateTestFixtureBase(TestExecution::RequireOptionAllNotRefillable)
5274
{}
5375
};
5476

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
/*
2+
This file is part of cpp-ethereum.
3+
4+
cpp-ethereum is free software: you can redistribute it and/or modify
5+
it under the terms of the GNU General Public License as published by
6+
the Free Software Foundation, either version 3 of the License, or
7+
(at your option) any later version.
8+
9+
cpp-ethereum is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
GNU General Public License for more details.
13+
14+
You should have received a copy of the GNU General Public License
15+
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
/** @file StateTestFixtureBase.h
18+
* @authors:
19+
* Dimitry Khokhlov <dimitry@ethereum.org>
20+
* @date 2019
21+
*/
22+
23+
#pragma once
24+
#include <test/tools/libtesteth/TestHelper.h>
25+
26+
namespace dev
27+
{
28+
namespace test
29+
{
30+
enum class TestExecution
31+
{
32+
RequireOptionAll,
33+
RequireOptionAllNotRefillable,
34+
NotRefillable,
35+
Standard
36+
};
37+
38+
static std::vector<std::string> const c_timeConsumingTestSuites{
39+
std::string{"stTimeConsuming"}, std::string{"stQuadraticComplexityTest"}};
40+
41+
template <class T>
42+
class StateTestFixtureBase
43+
{
44+
public:
45+
StateTestFixtureBase(TestExecution const& _execFlag)
46+
{
47+
T suite;
48+
if ((_execFlag == TestExecution::RequireOptionAllNotRefillable ||
49+
_execFlag == TestExecution::NotRefillable) &&
50+
(Options::get().fillchain || Options::get().filltests))
51+
BOOST_FAIL("Tests are sealed and not refillable!");
52+
53+
std::string const casename = boost::unit_test::framework::current_test_case().p_name;
54+
boost::filesystem::path suiteFillerPath = suite.getFullPathFiller(casename).parent_path();
55+
56+
bool skipTheTest = false;
57+
if (test::inArray(c_timeConsumingTestSuites, casename) && !test::Options::get().all)
58+
skipTheTest = true;
59+
else if ((_execFlag == TestExecution::RequireOptionAll ||
60+
_execFlag == TestExecution::RequireOptionAllNotRefillable) &&
61+
!Options::get().all)
62+
skipTheTest = true;
63+
64+
if (skipTheTest)
65+
{
66+
std::cout << "Skipping " << casename << " because --all option is not specified.\n";
67+
test::TestOutputHelper::get().markTestFolderAsFinished(suiteFillerPath, casename);
68+
return;
69+
}
70+
suite.runAllTestsInFolder(casename);
71+
test::TestOutputHelper::get().markTestFolderAsFinished(suiteFillerPath, casename);
72+
}
73+
};
74+
75+
} // namespace test
76+
} // namespace dev

test/tools/jsontests/StateTests.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
1919
*/
2020

2121
#pragma once
22-
#include <test/tools/jsontests/Common.h>
22+
#include <test/tools/jsontests/StateTestFixtureBase.h>
2323
#include <test/tools/libtesteth/TestSuite.h>
2424
#include <boost/filesystem/path.hpp>
2525

@@ -40,7 +40,7 @@ class StateTestSuite: public TestSuite
4040
class GeneralTestFixture : public StateTestFixtureBase<StateTestSuite>
4141
{
4242
public:
43-
GeneralTestFixture() : StateTestFixtureBase(TestExecution::STANDARD) {}
43+
GeneralTestFixture() : StateTestFixtureBase(TestExecution::Standard) {}
4444
};
4545
}
4646
}

0 commit comments

Comments
 (0)