Print this page
Incorporate rmustacc's review feedback.

Split Close
Expand all
Collapse all
          --- old/usr/src/test/libc-tests/tests/common/test_common.c
          +++ new/usr/src/test/libc-tests/tests/common/test_common.c
↓ open down ↓ 2 lines elided ↑ open up ↑
   3    3   * Common Development and Distribution License ("CDDL"), version 1.0.
   4    4   * You may only use this file in accordance with the terms of version
   5    5   * 1.0 of the CDDL.
   6    6   *
   7    7   * A full copy of the text of the CDDL should have accompanied this
   8    8   * source.  A copy of the CDDL is also available via the Internet at
   9    9   * http://www.illumos.org/license/CDDL.
  10   10   */
  11   11  
  12   12  /*
  13      - * Copyright 2014 Garrett D'Amore <garrett@damore.org>
       13 + * Copyright 2015 Garrett D'Amore <garrett@damore.org>
  14   14   */
  15   15  
  16   16  /*
  17   17   * Common handling for test programs.
  18   18   */
  19   19  
  20   20  #include <stdio.h>
  21   21  #include <stdlib.h>
  22   22  #include <stdarg.h>
  23   23  #include <string.h>
↓ open down ↓ 140 lines elided ↑ open up ↑
 164  164  void
 165  165  test_summary(void)
 166  166  {
 167  167          if (passes == tests) {
 168  168                  (void) printf("TEST SUMMARY: %d / %d (ok)\n", passes, tests);
 169  169          } else {
 170  170                  (void) printf("TEST SUMMARY: %d / %d (%d failing)\n",
 171  171                      passes, tests, tests - passes);
 172  172          }
 173  173  }
      174 +
 174  175  void
 175  176  test_debugf(test_t t, const char *format, ...)
 176  177  {
 177  178          va_list args;
 178  179  
 179  180          if (!debug)
 180  181                  return;
 181  182  
 182  183          (void) pthread_mutex_lock(&lk);
 183  184          if (t) {
↓ open down ↓ 88 lines elided ↑ open up ↑
 272  273          char            line[1024];
 273  274          char            buf[1024];
 274  275          int             done;
 275  276          char            *ptr;
 276  277          char            *tok;
 277  278          char            *err;
 278  279          int             lineno;
 279  280          int             rv;
 280  281          int             found;
 281  282          char            path[MAXPATHLEN];
      283 +        int             i;
 282  284  
 283  285          va_start(va, fname);
 284      -        for (int i = 0; i < MAXCB; i++) {
      286 +        for (i = 0; i < MAXCB; i++) {
 285  287                  keyws[i] = (const char *)va_arg(va, const char *);
 286  288                  if (keyws[i] == NULL)
 287  289                          break;
 288  290                  callbs[i] = (test_cfg_func_t)va_arg(va, test_cfg_func_t);
 289  291          }
 290  292          va_end(va);
      293 +        if (i == MAXCB) {
      294 +                test_debugf(t, "too many arguments to function >= %d", MAXCB);
      295 +        }
 291  296  
 292  297          found = 0;
 293  298  
 294  299          if (access(fname, F_OK) == 0) {
 295  300                  found++;
 296  301          }
 297  302          if (!found && fname[0] != '/') {
 298  303                  char *stf = getenv("STF_SUITE");
 299  304                  if (stf == NULL) {
 300  305                          stf = "../..";
↓ open down ↓ 101 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX