test: drop logging suspension
Instead of selectively suspending logging by redirecting messages to /dev/null, increase the default minimum log severity to FATAL. In the debug mode, all messages are printed.
This commit is contained in:
parent
d2117ab697
commit
26fc28c056
5 changed files with 5 additions and 29 deletions
|
@ -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));
|
||||
|
|
|
@ -360,10 +360,7 @@ test_unit(void)
|
|||
NIO_Initialise();
|
||||
NCR_Initialise();
|
||||
REF_Initialise();
|
||||
|
||||
TST_SuspendLogging();
|
||||
KEY_Initialise();
|
||||
TST_ResumeLogging();
|
||||
|
||||
CNF_SetupAccessRestrictions();
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue