aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-10-08 20:02:45 +0800
committerGitHub <noreply@github.com>2018-10-08 20:02:45 +0800
commit7d2dc14304e2ce1805069eef57904805ed6b96eb (patch)
tree34b88c809bf2b95f83343e4b3ffd3130174130f4 /test
parent363b527bc54228c8f34b937730752c8dd86746b9 (diff)
parentd1e05bf647be4fb388c539e915c7c53d98079455 (diff)
downloaddexon-solidity-7d2dc14304e2ce1805069eef57904805ed6b96eb.tar.gz
dexon-solidity-7d2dc14304e2ce1805069eef57904805ed6b96eb.tar.zst
dexon-solidity-7d2dc14304e2ce1805069eef57904805ed6b96eb.zip
Merge pull request #5157 from ethereum/soltest-testpath
soltest: provides sane defaults for --testpath command line option
Diffstat (limited to 'test')
-rw-r--r--test/Options.cpp23
1 files changed, 23 insertions, 0 deletions
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 <libsolidity/interface/Exceptions.h>
#include <boost/test/framework.hpp>
+#include <boost/filesystem.hpp>
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