From d1e05bf647be4fb388c539e915c7c53d98079455 Mon Sep 17 00:00:00 2001 From: Christian Parpart Date: Mon, 8 Oct 2018 10:56:16 +0200 Subject: soltest: provides sane defaults for --testpath command line option --- test/Options.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'test') diff --git a/test/Options.cpp b/test/Options.cpp index ff4a7c98..63588237 100644 --- a/test/Options.cpp +++ b/test/Options.cpp @@ -25,9 +25,11 @@ #include #include +#include using namespace std; using namespace dev::test; +namespace fs = boost::filesystem; Options const& Options::get() { @@ -70,6 +72,27 @@ Options::Options() if (testPath.empty()) if (auto path = getenv("ETH_TEST_PATH")) testPath = path; + + if (testPath.empty()) + { + auto const searchPath = + { + fs::current_path() / ".." / ".." / ".." / "test", + fs::current_path() / ".." / ".." / "test", + fs::current_path() / ".." / "test", + fs::current_path() / "test", + fs::current_path() + }; + for (auto const& basePath : searchPath) + { + fs::path syntaxTestPath = basePath / "libsolidity" / "syntaxTests"; + if (fs::exists(syntaxTestPath) && fs::is_directory(syntaxTestPath)) + { + testPath = basePath; + break; + } + } + } } void Options::validate() const -- cgit