Blob Blame History Raw
From dca9eea70cb33062905aefc389266da931e9d0d6 Mon Sep 17 00:00:00 2001
From: Petr Mensik <pemensik@redhat.com>
Date: Thu, 14 Mar 2019 15:48:37 +0100
Subject: [PATCH] Set TZ again before dns library is initialized

PKCS11 uses it, initializes TZ offset from dst init. Setting environment
in test is too late since use of cmocka.
---
 lib/dns/tests/dnstap_test.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/dns/tests/dnstap_test.c b/lib/dns/tests/dnstap_test.c
index 22d6dc3..5a60b12 100644
--- a/lib/dns/tests/dnstap_test.c
+++ b/lib/dns/tests/dnstap_test.c
@@ -309,9 +309,6 @@ totext_test(void **state) {
 
 	UNUSED(state);
 
-	/* make sure text conversion gets the right local time */
-	setenv("TZ", "PST8", 1);
-
 	result = dns_dt_open(TAPSAVED, dns_dtmode_file, mctx, &handle);
 	assert_int_equal(result, ISC_R_SUCCESS);
 
@@ -378,6 +375,9 @@ main(void) {
 		cmocka_unit_test_setup_teardown(totext_test, _setup, _teardown),
 	};
 
+	/* make sure text conversion gets the right local time */
+	setenv("TZ", "PST8", 1);
+
 	return (cmocka_run_group_tests(tests, dns_test_init, dns_test_final));
 #else
 	print_message("1..0 # Skip dnstap not enabled\n");
-- 
2.20.1