Properly adjust the srcdir vs builddir paths

Affected unit tests load testdata from the srcdir.  Previously, there
was a kludge that chdir()ed to the tests srcdir, but that get removed
during refactoring.  Instead of introducing the kludge again, the paths
were fixed to be properly prefixed with TESTS_DIR as needed.
This commit is contained in:
Ondřej Surý
2022-06-01 13:10:37 +02:00
parent 714fe2f617
commit 16595cdde0
16 changed files with 111 additions and 96 deletions

View File

@@ -91,7 +91,8 @@ ISC_RUN_TEST_IMPL(ns_notify_start) {
result = dns_test_makeview("view", false, &client->view);
assert_int_equal(result, ISC_R_SUCCESS);
result = ns_test_serve_zone("example.com", "testdata/notify/zone1.db",
result = ns_test_serve_zone("example.com",
TESTS_DIR "/testdata/notify/zone1.db",
client->view);
assert_int_equal(result, ISC_R_SUCCESS);
@@ -100,8 +101,8 @@ ISC_RUN_TEST_IMPL(ns_notify_start) {
* (XXX: use better message mocking method when available.)
*/
result = ns_test_getdata("testdata/notify/notify1.msg", ndata,
sizeof(ndata), &nsize);
result = ns_test_getdata(TESTS_DIR "/testdata/notify/notify1.msg",
ndata, sizeof(ndata), &nsize);
assert_int_equal(result, ISC_R_SUCCESS);
isc_buffer_init(&nbuf, ndata, nsize);
isc_buffer_add(&nbuf, nsize);

View File

@@ -473,7 +473,7 @@ ISC_RUN_TEST_IMPL(ns_query_start) {
.qflags = DNS_MESSAGEFLAG_RD,
.recursive_service = true,
.auth_zone_origin = "foo",
.auth_zone_path = "testdata/query/foo.db",
.auth_zone_path = TESTS_DIR "/testdata/query/foo.db",
.expected_result = NS__QUERY_START_R_AUTH,
},
/*
@@ -487,7 +487,7 @@ ISC_RUN_TEST_IMPL(ns_query_start) {
.qflags = DNS_MESSAGEFLAG_RD,
.recursive_service = false,
.auth_zone_origin = "foo",
.auth_zone_path = "testdata/query/foo.db",
.auth_zone_path = TESTS_DIR "/testdata/query/foo.db",
.expected_result = NS__QUERY_START_R_REFUSE,
},
/*
@@ -502,7 +502,7 @@ ISC_RUN_TEST_IMPL(ns_query_start) {
.qflags = DNS_MESSAGEFLAG_RD,
.recursive_service = true,
.auth_zone_origin = "foo",
.auth_zone_path = "testdata/query/foo.db",
.auth_zone_path = TESTS_DIR "/testdata/query/foo.db",
.expected_result = NS__QUERY_START_R_CACHE,
},
/*
@@ -517,7 +517,7 @@ ISC_RUN_TEST_IMPL(ns_query_start) {
.qflags = DNS_MESSAGEFLAG_RD,
.recursive_service = true,
.auth_zone_origin = "foo",
.auth_zone_path = "testdata/query/foo.db",
.auth_zone_path = TESTS_DIR "/testdata/query/foo.db",
.expected_result = NS__QUERY_START_R_AUTH,
},
/*
@@ -532,7 +532,7 @@ ISC_RUN_TEST_IMPL(ns_query_start) {
.qflags = 0,
.recursive_service = true,
.auth_zone_origin = "foo",
.auth_zone_path = "testdata/query/foo.db",
.auth_zone_path = TESTS_DIR "/testdata/query/foo.db",
.expected_result = NS__QUERY_START_R_AUTH,
},
/*
@@ -547,7 +547,7 @@ ISC_RUN_TEST_IMPL(ns_query_start) {
.qflags = DNS_MESSAGEFLAG_RD,
.recursive_service = true,
.auth_zone_origin = "foo",
.auth_zone_path = "testdata/query/foo.db",
.auth_zone_path = TESTS_DIR "/testdata/query/foo.db",
.expected_result = NS__QUERY_START_R_CACHE,
},
/*
@@ -562,7 +562,7 @@ ISC_RUN_TEST_IMPL(ns_query_start) {
.qflags = 0,
.recursive_service = true,
.auth_zone_origin = "foo",
.auth_zone_path = "testdata/query/foo.db",
.auth_zone_path = TESTS_DIR "/testdata/query/foo.db",
.expected_result = NS__QUERY_START_R_AUTH,
},
/*
@@ -1402,7 +1402,7 @@ run_hookasync_e2e_test(const ns__query_hookasync_e2e_test_params_t *test) {
qctx->client->sendcb = send_noop;
/* Load a zone. it should have ns.foo/A */
result = ns_test_serve_zone("foo", "testdata/query/foo.db",
result = ns_test_serve_zone("foo", TESTS_DIR "/testdata/query/foo.db",
qctx->client->view);
INSIST(result == ISC_R_SUCCESS);