diff options
author | Arnstein Ressem <aressem@gmail.com> | 2016-08-23 15:10:36 +0200 |
---|---|---|
committer | Vegard Sjonfjell <vegardsjo@gmail.com> | 2016-08-23 15:10:36 +0200 |
commit | 55e5a91901109161186e05d3a6e959e06958bbba (patch) | |
tree | f312bab2c60207ee305dbcfa047fcc4fa8fd2dc1 /fastlib | |
parent | d337a29392fb752dc725e4aea5efa0cc0df5f17a (diff) |
Aressem/cmake more out of source tests (#441)
* vespalib tests run out of source.
* staging_vespalib run tests out of source.
* fastos tests run out of source.
* Fixed storage tests out of source.
* Fixed some of the config tests.
* config* tests run out of source.
* document_* tests run out of source.
* documentapi_ tests run out of source.
* Fixed fsa out of source tests.
* Fix jrt_test out of source.
* More tests run out of source.
* Fix some slobrok and messagebus tests.
* More fixes for out of source tests.
* Done with first pass of regular tests out of source.
* Only use SOURCE_DIRECTORY in a limited set of places.
* Fix some remaining tests.
* Some cleanups.
* No need for extra slash.
Diffstat (limited to 'fastlib')
-rw-r--r-- | fastlib/src/vespa/fastlib/testsuite/test.h | 27 |
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; |