Use env variable to get IPC path for isoltest

This commit is contained in:
Mathias Baumann 2019-02-19 13:24:04 +01:00
parent 27d936cf44
commit f4110b295b
4 changed files with 11 additions and 9 deletions

View File

@ -26,8 +26,11 @@ namespace dev
namespace test
{
boost::filesystem::path discoverTestPath()
boost::filesystem::path getTestPath()
{
if (auto path = getenv("ETH_TEST_PATH"))
return path;
auto const searchPath =
{
fs::current_path() / ".." / ".." / ".." / "test",

View File

@ -24,12 +24,13 @@ namespace dev
namespace test
{
/// Tries to find a path that contains the directories "libsolidity/syntaxTests"
/// First checks the environment variable ETH_TEST_PATH. If empty,
/// tries to find a path that contains the directories "libsolidity/syntaxTests"
/// and returns it if found.
/// The routine searches in the current directory, and inside the "test" directory
/// starting from the current directory and up to three levels up.
/// @returns the path of the first match or an empty path if not found.
boost::filesystem::path discoverTestPath();
boost::filesystem::path getTestPath();
}
}

View File

@ -74,11 +74,7 @@ Options::Options()
ipcPath = path;
if (testPath.empty())
if (auto path = getenv("ETH_TEST_PATH"))
testPath = path;
if (testPath.empty())
testPath = discoverTestPath();
testPath = getTestPath();
}
void Options::validate() const

View File

@ -336,6 +336,7 @@ int main(int argc, char *argv[])
bool disableIPC = false;
bool disableSMT = false;
bool formatted = true;
po::options_description options(
R"(isoltest, tool for interactively managing test contracts.
Usage: isoltest [Options] --ipcpath ipcpath
@ -344,6 +345,7 @@ Interactively validates test contracts.
Allowed options)",
po::options_description::m_default_line_length,
po::options_description::m_default_line_length - 23);
options.add_options()
("help", "Show this help screen.")
("testpath", po::value<fs::path>(&testPath), "path to test files")
@ -396,7 +398,7 @@ Allowed options)",
}
if (testPath.empty())
testPath = dev::test::discoverTestPath();
testPath = dev::test::getTestPath();
TestStats global_stats{0, 0};