Print this page
Incorporate rmustacc's review feedback.
*** 8,18 ****
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*/
/*
! * Copyright 2014 Garrett D'Amore <garrett@damore.org>
*/
/*
* Common handling for test programs.
*/
--- 8,18 ----
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*/
/*
! * Copyright 2015 Garrett D'Amore <garrett@damore.org>
*/
/*
* Common handling for test programs.
*/
*** 169,178 ****
--- 169,179 ----
} else {
(void) printf("TEST SUMMARY: %d / %d (%d failing)\n",
passes, tests, tests - passes);
}
}
+
void
test_debugf(test_t t, const char *format, ...)
{
va_list args;
*** 277,295 ****
char *err;
int lineno;
int rv;
int found;
char path[MAXPATHLEN];
va_start(va, fname);
! for (int i = 0; i < MAXCB; i++) {
keyws[i] = (const char *)va_arg(va, const char *);
if (keyws[i] == NULL)
break;
callbs[i] = (test_cfg_func_t)va_arg(va, test_cfg_func_t);
}
va_end(va);
found = 0;
if (access(fname, F_OK) == 0) {
found++;
--- 278,300 ----
char *err;
int lineno;
int rv;
int found;
char path[MAXPATHLEN];
+ int i;
va_start(va, fname);
! for (i = 0; i < MAXCB; i++) {
keyws[i] = (const char *)va_arg(va, const char *);
if (keyws[i] == NULL)
break;
callbs[i] = (test_cfg_func_t)va_arg(va, test_cfg_func_t);
}
va_end(va);
+ if (i == MAXCB) {
+ test_debugf(t, "too many arguments to function >= %d", MAXCB);
+ }
found = 0;
if (access(fname, F_OK) == 0) {
found++;