test/Common.cpp
/// If non-empty returns the value of the env. variable ETH_TEST_PATH, otherwise
/// it 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.
If non-empty returns the value of the env. variable ETH_TEST_PATH, otherwise
it 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.
If non - empty returns the value of the env . variable ETH_TEST_PATH otherwise it 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 .
boost::filesystem::path testPath()
{
	if (auto path = getenv("ETH_TEST_PATH"))
		return path;
	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))
			return basePath;
	}
	return {};
}
boost :: filesystem :: path testPath ( ) { if ( auto path = getenv ( " " ) ) return path ; auto const searchPath = { fs :: current_path ( ) / " " / " " / " " / " " , fs :: current_path ( ) / " " / " " / " " , fs :: current_path ( ) / " " / " " , fs :: current_path ( ) / " " , fs :: current_path ( ) } ; for ( auto const & basePath : searchPath ) { fs :: path syntaxTestPath = basePath / " " / " " ; if ( fs :: exists ( syntaxTestPath ) && fs :: is_directory ( syntaxTestPath ) ) return basePath ; } return { } ; }
If non-empty returns the value of the env.
If non - empty returns the value of the env .