diff options
author | Arnstein Ressem <aressem@gmail.com> | 2016-11-02 23:26:40 +0100 |
---|---|---|
committer | Arnstein Ressem <aressem@gmail.com> | 2016-11-02 23:26:40 +0100 |
commit | 99480b4d72abf3688060d7643816680a30963f74 (patch) | |
tree | 966d8494bca9292e6be2877d91ed838953856f0f /config/src/tests | |
parent | 3d18773cf5357250cb2d35d6e8c13477db6e20a3 (diff) |
Removed TestApp::GetSourceDirectory
Diffstat (limited to 'config/src/tests')
-rw-r--r-- | config/src/tests/configgen/configgen.cpp | 3 | ||||
-rw-r--r-- | config/src/tests/file_subscription/file_subscription.cpp | 11 | ||||
-rw-r--r-- | config/src/tests/functiontest/functiontest.cpp | 8 | ||||
-rw-r--r-- | config/src/tests/getconfig/getconfig.cpp | 3 | ||||
-rw-r--r-- | config/src/tests/legacysubscriber/legacysubscriber.cpp | 4 | ||||
-rw-r--r-- | config/src/tests/print/print.cpp | 3 |
6 files changed, 13 insertions, 19 deletions
diff --git a/config/src/tests/configgen/configgen.cpp b/config/src/tests/configgen/configgen.cpp index a1e891e19fa..bd8aea0a89a 100644 --- a/config/src/tests/configgen/configgen.cpp +++ b/config/src/tests/configgen/configgen.cpp @@ -3,7 +3,6 @@ #include <vespa/log/log.h> LOG_SETUP("configgen"); #include <vespa/vespalib/testkit/test_kit.h> -#include <vespa/vespalib/testkit/testapp.h> #include <vespa/config/config.h> #include "config-motd.h" @@ -11,7 +10,7 @@ using namespace config; TEST("require that config type can be compiled") { std::unique_ptr<MotdConfig> cfg = ConfigGetter<MotdConfig>::getConfig("motd", - FileSpec(vespalib::TestApp::GetSourceDirectory() + "motd.cfg")); + FileSpec(TEST_PATH("motd.cfg"))); } TEST_MAIN() { TEST_RUN_ALL(); } diff --git a/config/src/tests/file_subscription/file_subscription.cpp b/config/src/tests/file_subscription/file_subscription.cpp index 19aa43297a6..c770d8da349 100644 --- a/config/src/tests/file_subscription/file_subscription.cpp +++ b/config/src/tests/file_subscription/file_subscription.cpp @@ -5,7 +5,6 @@ #include <vespa/config/common/configholder.h> #include <vespa/config/file/filesource.h> #include <vespa/vespalib/util/sync.h> -#include <vespa/vespalib/testkit/testapp.h> #include <fstream> #include <config-my.h> #include <config-foo.h> @@ -131,7 +130,7 @@ TEST("requireThatMultipleSubscribersCanSubscribeToSameFile") { } TEST("requireThatCanSubscribeToDirectory") { - DirSpec spec(vespalib::TestApp::GetSourceDirectory() + "cfgdir"); + DirSpec spec(TEST_PATH("cfgdir")); ConfigSubscriber s(spec); ConfigHandle<FooConfig>::UP fooHandle = s.subscribe<FooConfig>(""); ConfigHandle<BarConfig>::UP barHandle = s.subscribe<BarConfig>(""); @@ -147,7 +146,7 @@ TEST("requireThatCanSubscribeToDirectory") { } TEST("requireThatCanSubscribeToDirectoryWithEmptyCfgFile") { - DirSpec spec(vespalib::TestApp::GetSourceDirectory() + "cfgemptyfile"); + DirSpec spec(TEST_PATH("cfgemptyfile")); ConfigSubscriber s(spec); ConfigHandle<FoodefaultConfig>::UP fooHandle = s.subscribe<FoodefaultConfig>(""); ConfigHandle<BarConfig>::UP barHandle = s.subscribe<BarConfig>(""); @@ -163,7 +162,7 @@ TEST("requireThatCanSubscribeToDirectoryWithEmptyCfgFile") { } TEST("requireThatCanSubscribeToDirectoryWithNonExistingCfgFile") { - DirSpec spec(vespalib::TestApp::GetSourceDirectory() + "cfgnonexistingfile"); + DirSpec spec(TEST_PATH("cfgnonexistingfile")); ConfigSubscriber s(spec); ConfigHandle<FoodefaultConfig>::UP fooHandle = s.subscribe<FoodefaultConfig>(""); ConfigHandle<BarConfig>::UP barHandle = s.subscribe<BarConfig>(""); @@ -179,7 +178,7 @@ TEST("requireThatCanSubscribeToDirectoryWithNonExistingCfgFile") { } TEST_F("requireThatDirSpecDoesNotMixNames", - DirSpec(vespalib::TestApp::GetSourceDirectory() + "cfgdir2")) { + DirSpec(TEST_PATH("cfgdir2"))) { ConfigSubscriber s(f); ConfigHandle<BarConfig>::UP barHandle = s.subscribe<BarConfig>(""); ConfigHandle<FoobarConfig>::UP foobarHandle = s.subscribe<FoobarConfig>(""); @@ -193,7 +192,7 @@ TEST_F("requireThatDirSpecDoesNotMixNames", } TEST_F("require that can subscribe multiple config ids of same config", - DirSpec(vespalib::TestApp::GetSourceDirectory() + "cfgdir3")) { + DirSpec(TEST_PATH("cfgdir3"))) { ConfigSubscriber s(f1); ConfigHandle<BarConfig>::UP fooHandle = s.subscribe<BarConfig>("foo"); ConfigHandle<BarConfig>::UP barHandle = s.subscribe<BarConfig>("bar"); diff --git a/config/src/tests/functiontest/functiontest.cpp b/config/src/tests/functiontest/functiontest.cpp index 444ba776f27..24d50b44ca4 100644 --- a/config/src/tests/functiontest/functiontest.cpp +++ b/config/src/tests/functiontest/functiontest.cpp @@ -6,8 +6,8 @@ #include <fstream> #include <vespa/log/log.h> -#include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/data/slime/slime.h> +#include <vespa/vespalib/testkit/test_kit.h> LOG_SETUP("functiontest_test"); @@ -95,7 +95,7 @@ struct LazyTestFixture std::unique_ptr<FunctionTestConfig> _config; LazyTestFixture(const std::string & dirName) - : _spec(vespalib::TestApp::GetSourceDirectory() + dirName), + : _spec(TEST_PATH(dirName)), _subscriber(_spec), _handle(_subscriber.subscribe<FunctionTestConfig>("")) { @@ -130,7 +130,7 @@ struct ErrorFixture }; void attemptLacking(const std::string& param, bool isArray) { - std::ifstream in(vespalib::TestApp::GetSourceDirectory() + "defaultvalues/function-test.cfg", std::ios_base::in); + std::ifstream in(TEST_PATH("defaultvalues/function-test.cfg"), std::ios_base::in); std::ostringstream config; std::string s; while (std::getline(in, s)) { @@ -172,7 +172,7 @@ TEST_F("testVariableAccess", TestFixture("variableaccess")) { TEST("test variable access from slime") { vespalib::Slime slime; - std::string json(readFile(vespalib::TestApp::GetSourceDirectory() + "slime-payload.json")); + std::string json(readFile(TEST_PATH("slime-payload.json"))); vespalib::slime::JsonFormat::decode(json, slime); FunctionTestConfig config(config::ConfigPayload(slime.get())); checkVariableAccess(config); diff --git a/config/src/tests/getconfig/getconfig.cpp b/config/src/tests/getconfig/getconfig.cpp index 27f4fcf7505..77e2f57dbc8 100644 --- a/config/src/tests/getconfig/getconfig.cpp +++ b/config/src/tests/getconfig/getconfig.cpp @@ -1,7 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastos/fastos.h> #include <vespa/vespalib/testkit/test_kit.h> -#include <vespa/vespalib/testkit/testapp.h> #include <vespa/config/config.h> #include <vespa/config/raw/rawsource.h> #include "config-my.h" @@ -35,7 +34,7 @@ TEST("requireThatGetConfigReturnsCorrectConfig") TEST("requireThatGetConfigReturnsCorrectConfig") { - FileSpec spec(vespalib::TestApp::GetSourceDirectory() + "my.cfg"); + FileSpec spec(TEST_PATH("my.cfg")); std::unique_ptr<MyConfig> cfg = ConfigGetter<MyConfig>::getConfig("", spec); ASSERT_TRUE(cfg.get() != NULL); ASSERT_EQUAL("my", cfg->defName()); diff --git a/config/src/tests/legacysubscriber/legacysubscriber.cpp b/config/src/tests/legacysubscriber/legacysubscriber.cpp index 031f3f76f00..feae0a1d1a4 100644 --- a/config/src/tests/legacysubscriber/legacysubscriber.cpp +++ b/config/src/tests/legacysubscriber/legacysubscriber.cpp @@ -1,7 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastos/fastos.h> #include <vespa/vespalib/testkit/test_kit.h> -#include <vespa/vespalib/testkit/testapp.h> #include <vespa/config/helper/legacysubscriber.h> #include <fstream> #include <config-my.h> @@ -28,8 +27,7 @@ struct ConfigIdGenerator { static std::string id(const std::string &type, const std::string &name) { - return std::string(type + ":" + - vespalib::TestApp::GetSourceDirectory() + name); + return std::string(type + ":" + TEST_PATH(name)); } }; diff --git a/config/src/tests/print/print.cpp b/config/src/tests/print/print.cpp index f0f0570f2a9..761a3b32f73 100644 --- a/config/src/tests/print/print.cpp +++ b/config/src/tests/print/print.cpp @@ -1,7 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastos/fastos.h> #include <vespa/vespalib/testkit/test_kit.h> -#include <vespa/vespalib/testkit/testapp.h> #include <vespa/config/config.h> #include <vespa/config/print.h> #include <vespa/config/print/fileconfigreader.h> @@ -84,7 +83,7 @@ TEST_F("requireThatCanLoadWrittenWithConfigFormat", RawFixture<MyConfig>) { TEST("requireThatAllFieldsArePrintedCorrectly") { std::unique_ptr<MotdConfig> cfg = ConfigGetter<MotdConfig>::getConfig( - "motd", FileSpec(vespalib::TestApp::GetSourceDirectory() + "motd.cfg")); + "motd", FileSpec(TEST_PATH("motd.cfg"))); FileConfigWriter writer("motd2.cfg"); ASSERT_TRUE(writer.write(*cfg, FileConfigFormatter())); std::unique_ptr<MotdConfig> cfg2 = ConfigGetter<MotdConfig>::getConfig( |