diff --git a/test/Common.cpp b/test/Common.cpp index a80c55d4c..7a9334e4e 100644 --- a/test/Common.cpp +++ b/test/Common.cpp @@ -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", diff --git a/test/Common.h b/test/Common.h index e87faa0e6..a3b1ada32 100644 --- a/test/Common.h +++ b/test/Common.h @@ -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(); } } diff --git a/test/Options.cpp b/test/Options.cpp index 8389d853b..23de9cc55 100644 --- a/test/Options.cpp +++ b/test/Options.cpp @@ -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 diff --git a/test/tools/isoltest.cpp b/test/tools/isoltest.cpp index 1d3b9eda9..ceeef2906 100644 --- a/test/tools/isoltest.cpp +++ b/test/tools/isoltest.cpp @@ -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(&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};