summaryrefslogtreecommitdiffstats
path: root/fastlib
diff options
context:
space:
mode:
Diffstat (limited to 'fastlib')
-rw-r--r--fastlib/src/vespa/fastlib/testsuite/test.h27
1 files changed, 19 insertions, 8 deletions
diff --git a/fastlib/src/vespa/fastlib/testsuite/test.h b/fastlib/src/vespa/fastlib/testsuite/test.h
index ed9690a08ff..40b99c6ed66 100644
--- a/fastlib/src/vespa/fastlib/testsuite/test.h
+++ b/fastlib/src/vespa/fastlib/testsuite/test.h
@@ -89,6 +89,7 @@ public:
virtual void Run() = 0;
const char *get_name() const;
+ static const std::string& GetSourceDirectory();
long GetNumPassed() const;
long GetNumFailed() const;
const std::ostream* GetStream() const;
@@ -144,15 +145,8 @@ Test::Test(std::ostream* osptr, const char*name) :
inline
Test::Test(const char*name) :
- m_osptr(NULL),
- name_(name),
- m_nPass(0),
- m_nFail(0),
- m_index(0),
- m_description()
+ Test(nullptr, name)
{
- m_pchar[0]= '|';
- m_pchar[1]= '-';
}
inline
@@ -161,6 +155,23 @@ const char *Test::get_name() const {
}
inline
+const std::string& Test::GetSourceDirectory()
+{
+ static const std::string srcDir = [] () {
+ std::string dir(".");
+ const char* env = getenv("SOURCE_DIRECTORY");
+ if (env) {
+ dir = env;
+ }
+ if (*dir.rbegin() != '/') {
+ dir += "/";
+ }
+ return dir;
+ } ();
+ return srcDir;
+}
+
+inline
long Test::GetNumPassed() const
{
return m_nPass;