From 55e5a91901109161186e05d3a6e959e06958bbba Mon Sep 17 00:00:00 2001 From: Arnstein Ressem Date: Tue, 23 Aug 2016 15:10:36 +0200 Subject: 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. --- juniper/src/test/CMakeLists.txt | 7 +++++++ juniper/src/test/SrcTestSuite.cpp | 5 +++-- juniper/src/test/auxTest.cpp | 4 ++-- juniper/src/test/auxTestApp.cpp | 5 +++-- juniper/src/test/matchobjectTestApp.cpp | 5 +++-- juniper/src/test/mcandTestApp.cpp | 5 +++-- juniper/src/test/queryparserTestApp.cpp | 5 +++-- 7 files changed, 24 insertions(+), 12 deletions(-) (limited to 'juniper/src') diff --git a/juniper/src/test/CMakeLists.txt b/juniper/src/test/CMakeLists.txt index d574c068c38..2edabb70c2b 100644 --- a/juniper/src/test/CMakeLists.txt +++ b/juniper/src/test/CMakeLists.txt @@ -6,6 +6,7 @@ vespa_add_executable(juniper_mcandTest_app TEST testenv.cpp DEPENDS juniper + vespalib ) vespa_add_test(NAME juniper_mcandTest_app COMMAND juniper_mcandTest_app) vespa_add_executable(juniper_queryparserTest_app TEST @@ -16,6 +17,7 @@ vespa_add_executable(juniper_queryparserTest_app TEST testenv.cpp DEPENDS juniper + vespalib ) vespa_add_test(NAME juniper_queryparserTest_app COMMAND juniper_queryparserTest_app) vespa_add_executable(juniper_matchobjectTest_app TEST @@ -26,6 +28,7 @@ vespa_add_executable(juniper_matchobjectTest_app TEST fakerewriter.cpp DEPENDS juniper + vespalib ) vespa_add_test(NAME juniper_matchobjectTest_app COMMAND juniper_matchobjectTest_app) vespa_add_executable(juniper_appender_test_app TEST @@ -33,6 +36,7 @@ vespa_add_executable(juniper_appender_test_app TEST appender_test.cpp DEPENDS juniper + vespalib ) vespa_add_test(NAME juniper_appender_test_app COMMAND juniper_appender_test_app) vespa_add_executable(juniper_queryvisitor_test_app TEST @@ -40,6 +44,7 @@ vespa_add_executable(juniper_queryvisitor_test_app TEST queryvisitor_test.cpp DEPENDS juniper + vespalib ) vespa_add_test(NAME juniper_queryvisitor_test_app COMMAND juniper_queryvisitor_test_app) vespa_add_executable(juniper_auxTest_app TEST @@ -49,6 +54,7 @@ vespa_add_executable(juniper_auxTest_app TEST testenv.cpp DEPENDS juniper + vespalib ) vespa_add_test(NAME juniper_auxTest_app COMMAND juniper_auxTest_app) vespa_add_executable(juniper_SrcTestSuite_app TEST @@ -62,5 +68,6 @@ vespa_add_executable(juniper_SrcTestSuite_app TEST testenv.cpp DEPENDS juniper + vespalib ) vespa_add_test(NAME juniper_SrcTestSuite_app COMMAND juniper_SrcTestSuite_app) diff --git a/juniper/src/test/SrcTestSuite.cpp b/juniper/src/test/SrcTestSuite.cpp index d725278a009..42dbe6e4a5e 100644 --- a/juniper/src/test/SrcTestSuite.cpp +++ b/juniper/src/test/SrcTestSuite.cpp @@ -17,6 +17,7 @@ ****************************************************************************/ #include #include +#include LOG_SETUP("SrcTestSuite"); #include #include "testenv.h" @@ -52,13 +53,13 @@ SrcTestSuite::SrcTestSuite() : * * @author Knut Omang */ -class SrcTestSuiteApp : public FastOS_Application { +class SrcTestSuiteApp : public vespalib::TestApp { public: virtual int Main(); }; int SrcTestSuiteApp::Main() { - juniper::TestEnv te(this, "../rpclient/testclient.rc"); + juniper::TestEnv te(this, (GetSourceDirectory() + "../rpclient/testclient.rc").c_str()); SrcTestSuite suite; suite.Run(); long failures = suite.Report(); diff --git a/juniper/src/test/auxTest.cpp b/juniper/src/test/auxTest.cpp index 7c53b2a7999..99ccd24af35 100644 --- a/juniper/src/test/auxTest.cpp +++ b/juniper/src/test/auxTest.cpp @@ -154,7 +154,7 @@ AuxTest::TestPartialUTF8() { const int inputSize = 5769; // NB: update this if input is changed char input[inputSize]; - FastOS_File file("partialutf8.input.utf8"); + FastOS_File file((GetSourceDirectory() + "partialutf8.input.utf8").c_str()); _test(file.OpenReadOnly()); _test(file.GetSize() == inputSize); _test(file.Read(input, inputSize)); @@ -191,7 +191,7 @@ void AuxTest::TestLargeBlockChinese() { const int inputSize = 10410; // NB: update this if input is changed char input[inputSize]; - FastOS_File file("largeblockchinese.input.utf8"); + FastOS_File file((GetSourceDirectory() + "largeblockchinese.input.utf8").c_str()); _test(file.OpenReadOnly()); _test(file.GetSize() == inputSize); _test(file.Read(input, inputSize)); diff --git a/juniper/src/test/auxTestApp.cpp b/juniper/src/test/auxTestApp.cpp index 7b37cc909bb..50b367f99ec 100644 --- a/juniper/src/test/auxTestApp.cpp +++ b/juniper/src/test/auxTestApp.cpp @@ -1,10 +1,11 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include #include +#include LOG_SETUP("auxTest"); #include "auxTest.h" -class AuxTestApp : public FastOS_Application +class AuxTestApp : public vespalib::TestApp { public: virtual int Main(); @@ -20,7 +21,7 @@ void Usage(char* s) int AuxTestApp::Main() { - juniper::TestEnv te(this, "../rpclient/testclient.rc"); + juniper::TestEnv te(this, (GetSourceDirectory() + "../rpclient/testclient.rc").c_str()); AuxTest pta; pta.SetStream(&std::cout); pta.Run(_argc, _argv); diff --git a/juniper/src/test/matchobjectTestApp.cpp b/juniper/src/test/matchobjectTestApp.cpp index ada38fa1747..9c9786969be 100644 --- a/juniper/src/test/matchobjectTestApp.cpp +++ b/juniper/src/test/matchobjectTestApp.cpp @@ -18,6 +18,7 @@ ****************************************************************************/ #include #include +#include LOG_SETUP("matchobjectTest"); #include "matchobjectTest.h" #include "testenv.h" @@ -28,10 +29,10 @@ LOG_SETUP("matchobjectTest"); * * @sa MatchObject @author Knut Omang */ -class MatchObjectTestApp : public FastOS_Application { +class MatchObjectTestApp : public vespalib::TestApp { public: virtual int Main() { - juniper::TestEnv te(this, "../rpclient/testclient.rc"); + juniper::TestEnv te(this, (GetSourceDirectory() + "../rpclient/testclient.rc").c_str()); MatchObjectTest test; test.SetStream(&std::cout); test.Run(_argc, _argv); diff --git a/juniper/src/test/mcandTestApp.cpp b/juniper/src/test/mcandTestApp.cpp index 7bbc9681d21..fb331ac2b2a 100644 --- a/juniper/src/test/mcandTestApp.cpp +++ b/juniper/src/test/mcandTestApp.cpp @@ -18,6 +18,7 @@ ****************************************************************************/ #include #include +#include LOG_SETUP("mcandTest"); #include "mcandTest.h" #include "testenv.h" @@ -28,10 +29,10 @@ LOG_SETUP("mcandTest"); * * @sa MatchCandidate @author Knut Omang */ -class MatchCandidateTestApp : public FastOS_Application { +class MatchCandidateTestApp : public vespalib::TestApp { public: virtual int Main() { - juniper::TestEnv te(this, "../rpclient/testclient.rc"); + juniper::TestEnv te(this, (GetSourceDirectory() + "../rpclient/testclient.rc").c_str()); MatchCandidateTest test; test.SetStream(&std::cout); test.Run(_argc, _argv); diff --git a/juniper/src/test/queryparserTestApp.cpp b/juniper/src/test/queryparserTestApp.cpp index f7c8bce4afa..6391885599a 100644 --- a/juniper/src/test/queryparserTestApp.cpp +++ b/juniper/src/test/queryparserTestApp.cpp @@ -18,6 +18,7 @@ ****************************************************************************/ #include #include +#include LOG_SETUP("queryparserTest"); #include "queryparserTest.h" #include "testenv.h" @@ -28,10 +29,10 @@ LOG_SETUP("queryparserTest"); * * @sa QueryParser @author Knut Omang */ -class QueryParserTestApp : public FastOS_Application { +class QueryParserTestApp : public vespalib::TestApp { public: virtual int Main() { - juniper::TestEnv te(this, "../rpclient/testclient.rc"); + juniper::TestEnv te(this, (GetSourceDirectory() + "../rpclient/testclient.rc").c_str()); QueryParserTest test; test.SetStream(&std::cout); test.Run(_argc, _argv); -- cgit v1.2.3