diff --git a/test/unit/ntp_auth.c b/test/unit/ntp_auth.c index 5be7437..5c4b255 100644 --- a/test/unit/ntp_auth.c +++ b/test/unit/ntp_auth.c @@ -141,11 +141,7 @@ test_unit(void) CNF_ParseLine(NULL, i + 1, conf[i]); LCL_Initialise(); - - TST_SuspendLogging(); KEY_Initialise(); - TST_ResumeLogging(); - NSD_Initialise(); NNS_Initialise(); @@ -153,8 +149,6 @@ test_unit(void) nts_addr.port = 0; for (i = 0; i < 1000; i++) { - TST_SuspendLogging(); - key_id = INACTIVE_AUTHKEY; switch (i % 5) { @@ -202,8 +196,6 @@ test_unit(void) assert(0); } - TST_ResumeLogging(); - DEBUG_LOG("iteration %d auth=%d key_id=%d", i, (int)mode, (int)key_id); prepare_packet(mode, &req, &req_info, 1); @@ -218,7 +210,6 @@ test_unit(void) NAU_ChangeAddress(inst, &nts_addr.ip_addr); if (inst->mode == NTP_AUTH_NTS) { - TST_SuspendLogging(); for (j = random() % 5; j > 0; j--) #ifdef FEAT_NTS TEST_CHECK(!NAU_PrepareRequestAuth(inst)); @@ -226,7 +217,6 @@ test_unit(void) TEST_CHECK(NAU_PrepareRequestAuth(inst)); #endif TEST_CHECK(!NAU_GenerateRequestAuth(inst, &req, &req_info)); - TST_ResumeLogging(); } else if (can_auth_req) { TEST_CHECK(NAU_PrepareRequestAuth(inst)); TEST_CHECK(NAU_GenerateRequestAuth(inst, &req, &req_info)); diff --git a/test/unit/ntp_core.c b/test/unit/ntp_core.c index b5c148a..9aac5d6 100644 --- a/test/unit/ntp_core.c +++ b/test/unit/ntp_core.c @@ -360,10 +360,7 @@ test_unit(void) NIO_Initialise(); NCR_Initialise(); REF_Initialise(); - - TST_SuspendLogging(); KEY_Initialise(); - TST_ResumeLogging(); CNF_SetupAccessRestrictions(); diff --git a/test/unit/test.c b/test/unit/test.c index 482d83f..0f5638d 100644 --- a/test/unit/test.c +++ b/test/unit/test.c @@ -43,6 +43,7 @@ TST_Skip(int line) int main(int argc, char **argv) { + LOG_Severity log_severity; char *test_name, *s; int i, seed = 0; struct timeval tv; @@ -55,9 +56,11 @@ main(int argc, char **argv) if (s) test_name = s + 1; + log_severity = LOGS_FATAL; + for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "-d")) { - LOG_SetMinSeverity(LOGS_DEBUG); + log_severity = LOGS_DEBUG; } else if (!strcmp(argv[i], "-s") && i + 1 < argc) { seed = atoi(argv[++i]); } else { @@ -73,6 +76,7 @@ main(int argc, char **argv) fflush(stdout); LOG_Initialise(); + LOG_SetMinSeverity(log_severity); test_unit(); @@ -83,16 +87,6 @@ main(int argc, char **argv) return 0; } -void TST_SuspendLogging(void) -{ - LOG_OpenFileLog("/dev/null"); -} - -void TST_ResumeLogging(void) -{ - LOG_OpenFileLog(NULL); -} - double TST_GetRandomDouble(double min, double max) { diff --git a/test/unit/test.h b/test/unit/test.h index 2d3637b..00d261d 100644 --- a/test/unit/test.h +++ b/test/unit/test.h @@ -44,9 +44,6 @@ extern void test_unit(void); extern void TST_Fail(int line); extern void TST_Skip(int line); -extern void TST_SuspendLogging(void); -extern void TST_ResumeLogging(void); - extern double TST_GetRandomDouble(double min, double max); extern void TST_GetRandomAddress(IPAddr *ip, int family, int bits); extern void TST_SwapAddressBit(IPAddr *ip, unsigned int b); diff --git a/test/unit/util.c b/test/unit/util.c index e5c9b08..be59906 100644 --- a/test/unit/util.c +++ b/test/unit/util.c @@ -603,12 +603,10 @@ test_unit(void) TEST_CHECK(UTI_CreateDirAndParents("testdir", 0700, uid, gid)); - TST_SuspendLogging(); TEST_CHECK(UTI_CheckDirPermissions("testdir", 0700, uid, gid)); TEST_CHECK(!UTI_CheckDirPermissions("testdir", 0300, uid, gid)); TEST_CHECK(!UTI_CheckDirPermissions("testdir", 0700, uid + 1, gid)); TEST_CHECK(!UTI_CheckDirPermissions("testdir", 0700, uid, gid + 1)); - TST_ResumeLogging(); umask(0);