2000-06-16 18:17:11 -04:00
|
|
|
/*
|
2016-06-27 00:56:38 -04:00
|
|
|
* Copyright (C) 2000, 2001, 2004, 2007, 2015, 2016 Internet Systems Consortium, Inc. ("ISC")
|
2000-07-31 21:33:37 -04:00
|
|
|
*
|
2016-06-27 00:56:38 -04:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2000-06-16 18:17:11 -04:00
|
|
|
*/
|
|
|
|
|
|
2007-06-19 19:47:24 -04:00
|
|
|
/* $Id: driver.c,v 1.11 2007/06/19 23:47:00 tbox Exp $ */
|
2000-06-16 18:17:11 -04:00
|
|
|
|
2000-06-23 12:19:01 -04:00
|
|
|
#include <config.h>
|
2000-06-16 18:17:11 -04:00
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <time.h>
|
|
|
|
|
|
2015-05-23 08:21:51 -04:00
|
|
|
#include <isc/print.h>
|
2000-06-23 12:19:01 -04:00
|
|
|
#include <isc/string.h>
|
|
|
|
|
#include <isc/util.h>
|
|
|
|
|
|
2000-06-16 18:17:11 -04:00
|
|
|
#include "driver.h"
|
|
|
|
|
|
|
|
|
|
#include "testsuite.h"
|
|
|
|
|
|
|
|
|
|
#define NTESTS (sizeof(tests) / sizeof(test_t))
|
|
|
|
|
|
|
|
|
|
const char *gettime(void);
|
|
|
|
|
const char *test_result_totext(test_result_t);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Not thread safe.
|
|
|
|
|
*/
|
|
|
|
|
const char *
|
|
|
|
|
gettime(void) {
|
|
|
|
|
static char now[512];
|
|
|
|
|
time_t t;
|
|
|
|
|
|
|
|
|
|
(void)time(&t);
|
|
|
|
|
|
|
|
|
|
strftime(now, sizeof(now) - 1,
|
|
|
|
|
"%A %d %B %H:%M:%S %Y",
|
|
|
|
|
localtime(&t));
|
|
|
|
|
|
|
|
|
|
return (now);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const char *
|
|
|
|
|
test_result_totext(test_result_t result) {
|
|
|
|
|
const char *s;
|
|
|
|
|
switch (result) {
|
|
|
|
|
case PASSED:
|
2000-06-16 19:38:42 -04:00
|
|
|
s = "PASS";
|
2000-06-16 18:17:11 -04:00
|
|
|
break;
|
|
|
|
|
case FAILED:
|
2000-06-16 19:38:42 -04:00
|
|
|
s = "FAIL";
|
2000-06-16 18:17:11 -04:00
|
|
|
break;
|
|
|
|
|
case UNTESTED:
|
|
|
|
|
s = "UNTESTED";
|
|
|
|
|
break;
|
|
|
|
|
case UNKNOWN:
|
|
|
|
|
default:
|
|
|
|
|
s = "UNKNOWN";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (s);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
main(int argc, char **argv) {
|
|
|
|
|
test_t *test;
|
|
|
|
|
test_result_t result;
|
|
|
|
|
unsigned int n_failed;
|
|
|
|
|
unsigned int testno;
|
|
|
|
|
|
|
|
|
|
UNUSED(argc);
|
|
|
|
|
UNUSED(argv);
|
|
|
|
|
|
|
|
|
|
printf("S:%s:%s\n", SUITENAME, gettime());
|
|
|
|
|
|
|
|
|
|
n_failed = 0;
|
2001-11-26 19:56:32 -05:00
|
|
|
for (testno = 0; testno < NTESTS; testno++) {
|
2000-06-16 18:17:11 -04:00
|
|
|
test = &tests[testno];
|
|
|
|
|
printf("T:%s:%u:A\n", test->tag, testno + 1);
|
|
|
|
|
printf("A:%s\n", test->description);
|
|
|
|
|
result = test->func();
|
|
|
|
|
printf("R:%s\n", test_result_totext(result));
|
|
|
|
|
if (result != PASSED)
|
|
|
|
|
n_failed++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printf("E:%s:%s\n", SUITENAME, gettime());
|
|
|
|
|
|
|
|
|
|
if (n_failed > 0)
|
|
|
|
|
exit(1);
|
2000-06-19 13:49:54 -04:00
|
|
|
|
|
|
|
|
return (0);
|
2000-06-16 18:17:11 -04:00
|
|
|
}
|
|
|
|
|
|