Skip to content

Commit

Permalink
solidity info
Browse files Browse the repository at this point in the history
  • Loading branch information
winsvega committed Jan 5, 2022
1 parent 1415a3e commit af2becc
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 8 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Expand Up @@ -14,8 +14,8 @@ HunterGate(
LOCAL
)

project(retesteth VERSION 0.2.1)
set(VERSION_SUFFIX "difficulty")
project(retesteth VERSION 0.2.2)
set(VERSION_SUFFIX "testinfo")

set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
Expand Down
44 changes: 38 additions & 6 deletions retesteth/TestHelper.cpp
Expand Up @@ -306,19 +306,51 @@ int retestethVersion()
return iversion;
}

std::mutex g_lllcversionMutex;
string prepareLLLCVersionString()
{
std::lock_guard<std::mutex> lock(g_lllcversionMutex);
static string lllcVersion;
if (!lllcVersion.empty())
return lllcVersion;
if (test::checkCmdExist("lllc"))
{
string const cmd = "lllc --version";
string result = test::executeCmd(cmd);
string::size_type pos = result.rfind("Version");
string const result = test::executeCmd(cmd);
string::size_type const pos = result.rfind("Version");
if (pos != string::npos)
return result.substr(pos, result.length());
{
lllcVersion = result.substr(pos, result.length());
return lllcVersion;
}
}
lllcVersion = "Error getting LLLC Version";
ETH_WARNING(lllcVersion);
return lllcVersion;
}

std::mutex g_solcversionMutex;
string prepareSolidityVersionString()
{
std::lock_guard<std::mutex> lock(g_solcversionMutex);
static string solcVersion;
if (!solcVersion.empty())
return solcVersion;

if (test::checkCmdExist("solc"))
{
string const cmd = "solc --version";
string const result = test::executeCmd(cmd);
string::size_type const pos = result.rfind("Version");
if (pos != string::npos)
{
solcVersion = result.substr(pos, result.length());
return solcVersion;
}
}
string const res = "Error getting LLLC Version";
ETH_WARNING(res);
return res;
solcVersion = "Error getting solc Version";
ETH_WARNING(solcVersion);
return solcVersion;
}

/// Safe dev::fromHex
Expand Down
1 change: 1 addition & 0 deletions retesteth/TestHelper.h
Expand Up @@ -58,6 +58,7 @@ int retestethVersion();

/// local lllc version string
std::string prepareLLLCVersionString();
std::string prepareSolidityVersionString();

/// check system command
bool checkCmdExist(std::string const& _command);
Expand Down
1 change: 1 addition & 0 deletions retesteth/TestSuite.cpp
Expand Up @@ -180,6 +180,7 @@ bool addClientInfo(
(*clientinfo)["filling-rpc-server"] = session.web3_clientVersion()->asString();
(*clientinfo)["filling-tool-version"] = test::prepareVersionString();
(*clientinfo)["lllcversion"] = test::prepareLLLCVersionString();
(*clientinfo)["solidity"] = test::prepareSolidityVersionString();
(*clientinfo)["source"] = _testSource.string();
if (clientinfo->count("labels"))
(*clientinfo).setKeyPos("labels", clientinfo->getSubObjects().size() - 1);
Expand Down
1 change: 1 addition & 0 deletions retesteth/testStructures/types/StateTests/Filled/Info.cpp
Expand Up @@ -12,6 +12,7 @@ Info::Info(DataObject const& _data)
{"filling-rpc-server", {{DataType::String}, jsonField::Required}},
{"filling-tool-version", {{DataType::String}, jsonField::Required}},
{"lllcversion", {{DataType::String}, jsonField::Required}},
{"solidity", {{DataType::String}, jsonField::Required}},
{"generatedTestHash", {{DataType::String}, jsonField::Optional}},
{"source", {{DataType::String}, jsonField::Required}},
{"sourceHash", {{DataType::String}, jsonField::Required}},
Expand Down

0 comments on commit af2becc

Please sign in to comment.