diff options
Diffstat (limited to 'vespalib/src/tests')
10 files changed, 19 insertions, 23 deletions
diff --git a/vespalib/src/tests/guard/guard_test.cpp b/vespalib/src/tests/guard/guard_test.cpp index 83de03e3f20..1e7ec21008f 100644 --- a/vespalib/src/tests/guard/guard_test.cpp +++ b/vespalib/src/tests/guard/guard_test.cpp @@ -3,6 +3,7 @@ #include <vespa/log/log.h> LOG_SETUP("guard_test"); #include <vespa/vespalib/testkit/testapp.h> +#include <vespa/vespalib/testkit/test_kit.h> #include <vespa/vespalib/util/guard.h> using namespace vespalib; @@ -132,7 +133,7 @@ Test::testDirPointer() EXPECT_TRUE(!dir.valid()); } { - DirPointer dir(opendir(vespalib::TestApp::GetSourceDirectory().c_str())); + DirPointer dir(opendir(TEST_PATH("").c_str())); EXPECT_TRUE(dir.valid()); dirent *de; diff --git a/vespalib/src/tests/make_fixture_macros/make_fixture_macros_test.cpp b/vespalib/src/tests/make_fixture_macros/make_fixture_macros_test.cpp index 5718592203a..61801c1d3b2 100644 --- a/vespalib/src/tests/make_fixture_macros/make_fixture_macros_test.cpp +++ b/vespalib/src/tests/make_fixture_macros/make_fixture_macros_test.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/vespalib/util/slaveproc.h> using namespace vespalib; @@ -18,8 +17,7 @@ TEST("make fixture macros") { EXPECT_TRUE(runPrint("../../apps/make_fixture_macros/vespalib_make_fixture_macros_app 9 > macros.tmp")); std::string diffCmd("diff -u "); - diffCmd += vespalib::TestApp::GetSourceDirectory(); - diffCmd += "../../vespa/vespalib/testkit/generated_fixture_macros.h macros.tmp"; + diffCmd += TEST_PATH("../../vespa/vespalib/testkit/generated_fixture_macros.h macros.tmp"); EXPECT_TRUE(runPrint(diffCmd.c_str())); } diff --git a/vespalib/src/tests/slime/json_slime_benchmark.cpp b/vespalib/src/tests/slime/json_slime_benchmark.cpp index 73c5dbceab6..ea6ea89375b 100644 --- a/vespalib/src/tests/slime/json_slime_benchmark.cpp +++ b/vespalib/src/tests/slime/json_slime_benchmark.cpp @@ -1,7 +1,7 @@ // 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/data/slime/slime.h> -#include <vespa/vespalib/testkit/testapp.h> +#include <vespa/vespalib/testkit/test_kit.h> #include <iostream> #include <fstream> #include <sstream> @@ -37,7 +37,7 @@ int main(int argc, char *argv[]) if (argc > 1) { numRep = strtoul(argv[1], 0, 0); } - std::ifstream file((vespalib::TestApp::GetSourceDirectory() + "large_json.txt").c_str()); + std::ifstream file(TEST_PATH("large_json.txt").c_str()); assert(file.is_open()); std::stringstream buf; buf << file.rdbuf(); diff --git a/vespalib/src/tests/slime/slime_json_format_test.cpp b/vespalib/src/tests/slime/slime_json_format_test.cpp index 7995584f60b..c054cc5a428 100644 --- a/vespalib/src/tests/slime/slime_json_format_test.cpp +++ b/vespalib/src/tests/slime/slime_json_format_test.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/vespalib/data/slime/slime.h> #include <iostream> #include <fstream> @@ -352,7 +351,7 @@ TEST("decode simplified form") { } TEST_F("decode bytes not null-terminated", Slime) { - std::ifstream file(vespalib::TestApp::GetSourceDirectory() + "large_json.txt"); + std::ifstream file(TEST_PATH("large_json.txt")); ASSERT_TRUE(file.is_open()); std::stringstream buf; buf << file.rdbuf(); diff --git a/vespalib/src/tests/stllike/asciistream_test.cpp b/vespalib/src/tests/stllike/asciistream_test.cpp index 1dcfda2b53f..b3a55f4d134 100644 --- a/vespalib/src/tests/stllike/asciistream_test.cpp +++ b/vespalib/src/tests/stllike/asciistream_test.cpp @@ -3,6 +3,7 @@ #include <limits> #include <vespa/log/log.h> LOG_SETUP("identifiable_test"); +#include <vespa/vespalib/testkit/test_kit.h> #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/stllike/asciistream.h> #include <vespa/vespalib/util/exceptions.h> @@ -342,7 +343,7 @@ AsciistreamTest::testCreateFromFile() asciistream is(asciistream::createFromFile("non-existing.txt")); EXPECT_TRUE(is.eof()); - is = asciistream::createFromFile(vespalib::TestApp::GetSourceDirectory() + "test.txt"); + is = asciistream::createFromFile(TEST_PATH("test.txt")); EXPECT_FALSE(is.eof()); EXPECT_EQUAL(12u, is.size()); string s; diff --git a/vespalib/src/tests/testapp-debug/testapp-debug.cpp b/vespalib/src/tests/testapp-debug/testapp-debug.cpp index cbe032f19f8..3081048ea7a 100644 --- a/vespalib/src/tests/testapp-debug/testapp-debug.cpp +++ b/vespalib/src/tests/testapp-debug/testapp-debug.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> using namespace vespalib; @@ -11,6 +10,6 @@ TEST_MAIN() { std::string diff_cmd("diff diff.out "); - diff_cmd += vespalib::TestApp::GetSourceDirectory() + "diff.ref"; + diff_cmd += TEST_PATH("diff.ref"); EXPECT_EQUAL(system(diff_cmd.c_str()), 0); } diff --git a/vespalib/src/tests/testapp-state/testapp-state.cpp b/vespalib/src/tests/testapp-state/testapp-state.cpp index df126f8dcfc..cf6ced914d4 100644 --- a/vespalib/src/tests/testapp-state/testapp-state.cpp +++ b/vespalib/src/tests/testapp-state/testapp-state.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> using namespace vespalib; @@ -10,6 +9,6 @@ TEST_MAIN() { system("cat out.txt | grep STATE | sed 's/([^)].*\\//(/' > actual.txt"); std::string diff_cmd("diff -u actual.txt "); - diff_cmd += vespalib::TestApp::GetSourceDirectory() + "expect.txt"; + diff_cmd += TEST_PATH("expect.txt"); EXPECT_EQUAL(system(diff_cmd.c_str()), 0); } diff --git a/vespalib/src/tests/text/lowercase/lowercase_test.cpp b/vespalib/src/tests/text/lowercase/lowercase_test.cpp index 39ae5c0aea0..0d2514a0a21 100644 --- a/vespalib/src/tests/text/lowercase/lowercase_test.cpp +++ b/vespalib/src/tests/text/lowercase/lowercase_test.cpp @@ -2,6 +2,7 @@ #include <vespa/fastos/fastos.h> #include <vespa/log/log.h> LOG_SETUP("lowercase_test"); +#include <vespa/vespalib/testkit/test_kit.h> #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/text/lowercase.h> #include <iostream> @@ -20,7 +21,7 @@ Test::Main() EXPECT_EQUAL((int8_t)'a', LowerCase::convert((int8_t)'A')); EXPECT_EQUAL((uint8_t)'a', LowerCase::convert((uint8_t)'A')); - std::ifstream yellData(vespalib::TestApp::GetSourceDirectory() + "yell-want.dat"); + std::ifstream yellData(TEST_PATH("yell-want.dat")); EXPECT_TRUE(yellData.good()); diff --git a/vespalib/src/tests/text/utf8/utf8_test.cpp b/vespalib/src/tests/text/utf8/utf8_test.cpp index e88fe756e40..fd58dbfa044 100644 --- a/vespalib/src/tests/text/utf8/utf8_test.cpp +++ b/vespalib/src/tests/text/utf8/utf8_test.cpp @@ -2,8 +2,10 @@ #include <vespa/fastos/fastos.h> #include <vespa/log/log.h> LOG_SETUP("utf8_test"); +#include <vespa/vespalib/testkit/test_kit.h> #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/text/utf8.h> + #if 0 #include <vespa/fastlib/text/unicodeutil.h> #endif @@ -54,7 +56,7 @@ Test::Main() { // read data produced from Java program - int fd = ::open((vespalib::TestApp::GetSourceDirectory() + "regular-utf8.dat").c_str(), O_RDONLY); + int fd = ::open(TEST_PATH("regular-utf8.dat").c_str(), O_RDONLY); ASSERT_TRUE(fd > 0); vespalib::string data; data.clear(); diff --git a/vespalib/src/tests/tutorial/make_tutorial.cpp b/vespalib/src/tests/tutorial/make_tutorial.cpp index a18c33afeeb..1d4c3596661 100644 --- a/vespalib/src/tests/tutorial/make_tutorial.cpp +++ b/vespalib/src/tests/tutorial/make_tutorial.cpp @@ -1,6 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/vespalib/testkit/test_kit.h> -#include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/slaveproc.h> #include <vespa/vespalib/util/stringfmt.h> #include <sys/mman.h> @@ -57,7 +56,7 @@ TEST_MAIN_WITH_PROCESS_PROXY() { size_t pos = 0; size_t end = 0; size_t cursor = 0; - std::string input = readFile(vespalib::TestApp::GetSourceDirectory() + "tutorial_source.html"); + std::string input = readFile(TEST_PATH("tutorial_source.html")); while ((pos = input.find(pre, cursor)) < input.size() && (end = input.find(post, pos)) < input.size()) { @@ -65,16 +64,13 @@ TEST_MAIN_WITH_PROCESS_PROXY() { pos += pre.size(); if (input.find(example, pos) == pos) { pos += example.size(); - insertExample(std::string((input.data() + pos), (end - pos)), - vespalib::TestApp::GetSourceDirectory()); + insertExample(std::string((input.data() + pos), (end - pos)), TEST_PATH("")); } else if (input.find(source, pos) == pos) { pos += source.size(); - insertSource(std::string((input.data() + pos), (end - pos)), - vespalib::TestApp::GetSourceDirectory()); + insertSource(std::string((input.data() + pos), (end - pos)), TEST_PATH("")); } else if (input.find(file, pos) == pos) { pos += file.size(); - insertFile(std::string((input.data() + pos), (end - pos)), - vespalib::TestApp::GetSourceDirectory()); + insertFile(std::string((input.data() + pos), (end - pos)), TEST_PATH("")); } else { std::string str((input.data() + pos), (end - pos)); TEST_FATAL(make_string("invalid directive >%s<", str.c_str()).c_str()); |