Skip to content

Commit ab6c70d

Browse files
author
winsvega
authored
Merge pull request #123 from ethereum/develop
version 0.1.1 development
2 parents 156b5ba + 0fa01cc commit ab6c70d

File tree

152 files changed

+4207
-1486
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+4207
-1486
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ HunterGate(
1414
LOCAL
1515
)
1616

17-
project(retesteth VERSION 0.1.0)
18-
set(VERSION_SUFFIX "accesslist")
17+
project(retesteth VERSION 0.1.1)
18+
set(VERSION_SUFFIX "eip1559")
1919

2020
set(Boost_USE_STATIC_LIBS ON)
2121
set(Boost_USE_MULTITHREADED ON)

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ RUN mkdir /build && cd /build \
3333
# && cmake /solidity -DCMAKE_BUILD_TYPE=Release && make solc \
3434
# && cp /build/solc/solc /bin/solc \
3535
# && rm -rf /build /solidity /var/cache/* /root/.hunter/*
36-
RUN apt-get install wget && wget https://github.com/ethereum/solidity/releases/download/v0.7.0/solc-static-linux \
36+
RUN apt-get install wget && wget https://github.com/ethereum/solidity/releases/download/v0.8.5/solc-static-linux \
3737
&& cp solc-static-linux /bin/solc \
3838
&& chmod +x /bin/solc
3939

circle.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,24 +149,23 @@ jobs:
149149
- image: ethereum/cpp-build-env:7
150150
steps: *linux-steps
151151

152-
macOS-XCode10:
152+
macOS-XCode11:
153153
environment:
154154
- CXX: clang++
155155
- GCOV: gcov
156156
- GENERATOR: Ninja
157157
- BUILD_PARALLEL_JOBS: 8
158158
- TEST_PARALLEL_JOBS: 8
159159
macos:
160-
xcode: "10.0"
160+
xcode: "11.3.1"
161161
steps:
162162
- checkout
163163
- *environment-info
164164
- run:
165165
name: "Install macOS dependencies"
166166
# Python3 and requests are needed for Hunter upload.
167167
command: |
168-
HOMEBREW_NO_AUTO_UPDATE=1 brew install -q cmake ninja python3
169-
pip3 install -q requests gitpython
168+
HOMEBREW_NO_AUTO_UPDATE=1 brew install -q cmake ninja
170169
- *configureMac
171170
# - *upload-hunter-cache
172171
# - *install-solidity-mac
@@ -182,6 +181,6 @@ workflows:
182181
version: 2
183182
cpp-ethereum:
184183
jobs:
185-
- macOS-XCode10
184+
- macOS-XCode11
186185
- Linux-Clang6
187186
- Linux-GCC6-Debug

cmake/Hunter/config.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ hunter_config(
1717
HTTP_CLIENT=NO
1818
)
1919

20-
hunter_config(Boost VERSION 1.65.1)
20+
hunter_config(Boost VERSION 1.65.2
21+
URL http://retesteth.ethdevops.io/dependencies/boost_1_65_1.tar.bz2
22+
SHA1 4a5b0c3c1b1b9a4d6cb6a6cc395e903e76f76720
23+
)
2124

2225
hunter_config(ethash VERSION 0.4.0
2326
URL https://github.com/chfast/ethash/archive/v0.4.0.tar.gz

retesteth/Options.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,24 @@ Options::Options(int argc, const char** argv)
224224
else if (arg == "--fillchain")
225225
{
226226
fillchain = true;
227+
228+
bool noFilltests = !filltests;
229+
if (noFilltests)
230+
{
231+
// Look ahead if this option ever provided
232+
for (auto i = 0; i < argc; ++i)
233+
{
234+
auto arg = std::string{argv[i]};
235+
if (arg == "--filltests")
236+
{
237+
noFilltests = false;
238+
break;
239+
}
240+
}
241+
}
242+
243+
if (noFilltests)
244+
ETH_STDOUT_MESSAGEC("WARNING: `--fillchain` option provided without `--filltests`, activating `--filltests` (did you mean `--filltests`?)", cYellow);
227245
filltests = true;
228246
}
229247
else if (arg == "--showhash")

retesteth/Options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ class Options
8383
/// The first time used, options are parsed with argc, argv
8484
static Options const& get(int argc = 0, const char** argv = 0);
8585
static DynamicOptions& getDynamicOptions() { return m_dynamicOptions; }
86+
static ClientConfig const& getCurrentConfig() { return m_dynamicOptions.getCurrentConfig(); }
8687
string getGStateTransactionFilter() const;
8788

8889
private:

retesteth/TestOutputHelper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ bool TestOutputHelper::markError(std::string const& _message)
108108
m_errors.push_back(_message + testDebugInfo);
109109
if (testDebugInfo.empty())
110110
ETH_WARNING(TestOutputHelper::get().testName() + ", Message: " + _message +
111-
", has empty debugInfo! Missing debug Tesinfo for test step.");
111+
", has empty debugInfo! Missing debug Testinfo for test step.");
112112
std::lock_guard<std::mutex> lock(g_failedTestsMap);
113113
if (!s_failedTestsMap.count(TestOutputHelper::get().testName()))
114114
s_failedTestsMap[TestOutputHelper::get().testName()] = testDebugInfo;

retesteth/TestSuite.cpp

Lines changed: 68 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -213,51 +213,78 @@ string const c_copierPostf = "Copier";
213213

214214
void TestSuite::runTestWithoutFiller(boost::filesystem::path const& _file) const
215215
{
216-
for (auto const& config : Options::getDynamicOptions().getClientConfigs())
216+
try
217217
{
218-
Options::getDynamicOptions().setCurrentConfig(config);
219-
220-
std::cout << "Running tests for config '" << config.cfgFile().name() << "' "
221-
<< config.getId().id() << std::endl;
222-
ETH_LOG("Running " + _file.filename().string() + ": ", 3);
223-
224-
// Allow to execute a custom test .json file on any test suite
225-
auto& testOutput = test::TestOutputHelper::get();
226-
testOutput.initTest(1);
227-
228-
if (Options::get().filltests)
218+
for (auto const& config : Options::getDynamicOptions().getClientConfigs())
229219
{
230-
TestFileData testData = readTestFile(_file);
231-
removeComments(testData.data);
220+
Options::getDynamicOptions().setCurrentConfig(config);
232221

233-
string fileName = _file.stem().c_str();
234-
if (fileName.find("Filler") == string::npos)
235-
ETH_ERROR_MESSAGE("Trying to fill `" + string(_file.c_str()) + "`, but file does not have Filler suffix!");
222+
std::cout << "Running tests for config '" << config.cfgFile().name() << "' " << config.getId().id() << std::endl;
223+
ETH_LOG("Running " + _file.filename().string() + ": ", 3);
236224

237-
// output filename. substract Filler suffix
238-
fileName = fileName.substr(0, fileName.length() - 6) + ".json";
225+
// Allow to execute a custom test .json file on any test suite
226+
auto& testOutput = test::TestOutputHelper::get();
227+
testOutput.initTest(1);
239228

240-
fs::path outPath;
241-
if (Options::get().singleTestOutFile.is_initialized())
242-
outPath = fs::path(Options::get().singleTestOutFile.get());
243-
else
244-
outPath = _file.parent_path() / fileName;
245-
246-
TestSuiteOptions opt;
247-
opt.doFilling = true;
248-
opt.allowInvalidBlocks = true;
249-
DataObject output = doTests(testData.data, opt);
250-
addClientInfo(output, _file, testData.hash);
251-
writeFile(outPath, asBytes(output.asJson()));
252-
}
253-
else
254-
executeFile(_file);
255-
256-
testOutput.finishTest();
229+
try
230+
{
231+
if (Options::get().filltests)
232+
{
233+
TestFileData testData = readTestFile(_file);
234+
removeComments(testData.data);
235+
236+
string fileName = _file.stem().c_str();
237+
if (fileName.find("Filler") == string::npos)
238+
ETH_ERROR_MESSAGE(
239+
"Trying to fill `" + string(_file.c_str()) + "`, but file does not have Filler suffix!");
240+
241+
// output filename. substract Filler suffix
242+
fileName = fileName.substr(0, fileName.length() - 6) + ".json";
243+
244+
fs::path outPath;
245+
if (Options::get().singleTestOutFile.is_initialized())
246+
outPath = fs::path(Options::get().singleTestOutFile.get());
247+
else
248+
outPath = _file.parent_path() / fileName;
249+
250+
TestSuiteOptions opt;
251+
opt.doFilling = true;
252+
opt.allowInvalidBlocks = true;
253+
DataObject output = doTests(testData.data, opt);
254+
addClientInfo(output, _file, testData.hash);
255+
writeFile(outPath, asBytes(output.asJson()));
256+
}
257+
else
258+
executeFile(_file);
259+
}
260+
catch (test::EthError const& _ex)
261+
{
262+
// Something went wrong inside the test. skip the test.
263+
// (error message is stored at TestOutputHelper. EthError is via ETH_ERROR_())
264+
}
265+
catch (test::UpwardsException const& _ex)
266+
{
267+
// UpwardsException is thrown upwards in tests for debug info
268+
// And it should be catched on upper level for report till this point
269+
ETH_ERROR_MESSAGE(string("Unhandled UpwardsException: ") + _ex.what());
270+
}
271+
catch (std::exception const& _ex)
272+
{
273+
if (!ExitHandler::receivedExitSignal())
274+
ETH_ERROR_MESSAGE("ERROR OCCURED TESTFILE RUN: " + string(_ex.what()));
275+
RPCSession::sessionEnd(TestOutputHelper::getThreadID(), RPCSession::SessionStatus::HasFinished);
276+
}
257277

258-
// Disconnect threads from the client
259-
if (Options::getDynamicOptions().getClientConfigs().size() > 1)
260-
RPCSession::clear();
278+
testOutput.finishTest();
279+
// Disconnect threads from the client
280+
if (Options::getDynamicOptions().getClientConfigs().size() > 1)
281+
RPCSession::clear();
282+
}
283+
}
284+
catch (std::exception const&)
285+
{
286+
test::TestOutputHelper::get().finishTest();
287+
test::TestOutputHelper::printTestExecStats();
261288
}
262289
}
263290

@@ -479,6 +506,8 @@ void TestSuite::runFunctionForAllClients(std::function<void()> _func)
479506
Options::getDynamicOptions().setCurrentConfig(config);
480507
std::cout << "Running tests for config '" << config.cfgFile().name() << "' "
481508
<< config.getId().id() << std::endl;
509+
510+
// Run tests
482511
_func();
483512

484513
// Disconnect threads from the client

retesteth/compiler/Compiler.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ string replaceCode(string const& _code, solContracts const& _preSolidity)
7272
string const c_rawPrefix = ":raw";
7373
string const c_abiPrefix = ":abi";
7474
string const c_solidityPrefix = ":solidity";
75+
string const c_yulPrefix = ":yul";
7576

7677
if (_code.find("pragma solidity") != string::npos)
7778
{
@@ -99,6 +100,13 @@ string replaceCode(string const& _code, solContracts const& _preSolidity)
99100
compiledCode = utiles::encodeAbi(abiCode);
100101
utiles::checkHexHasEvenLength(compiledCode);
101102
}
103+
else if (_code.find(c_yulPrefix) != string::npos)
104+
{
105+
size_t const pos = _code.find(c_yulPrefix);
106+
string const yulCode = _code.substr(pos + c_yulPrefix.length() + 1);
107+
compiledCode = compileYul(yulCode);
108+
utiles::checkHexHasEvenLength(compiledCode);
109+
}
102110
else if (_code.find('{') != string::npos || _code.find("(asm") != string::npos )
103111
compiledCode = compileLLL(_code);
104112
else

retesteth/compiler/Compiler.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,8 @@ solContracts compileSolidity(string const& _code);
3636
/// compile LLL / wasm or other src code into bytecode
3737
std::string replaceCode(std::string const& _code, solContracts const& _preSolidity = solContracts());
3838

39+
/// compile clean YUL
40+
std::string compileYul(string const& _code);
41+
3942
} // namespace compiler
4043
} // namespace test

0 commit comments

Comments
 (0)