alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. |
Cyril Hrubis | 2a81c75 | 2014-05-27 14:54:09 +0200 | [diff] [blame] | 3 | * AUTHOR : William Roske/Richard Logan |
vapier | 45a8ba0 | 2009-07-20 10:59:32 +0000 | [diff] [blame] | 4 | * |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 5 | * This program is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of version 2 of the GNU General Public License as |
| 7 | * published by the Free Software Foundation. |
vapier | 45a8ba0 | 2009-07-20 10:59:32 +0000 | [diff] [blame] | 8 | * |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 9 | * This program is distributed in the hope that it would be useful, but |
| 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
vapier | 45a8ba0 | 2009-07-20 10:59:32 +0000 | [diff] [blame] | 12 | * |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 13 | * Further, this software is distributed without any warranty that it is |
| 14 | * free of the rightful claim of any third person regarding infringement |
| 15 | * or the like. Any license provided herein, whether implied or |
| 16 | * otherwise, applies only to this software file. Patent licenses, if |
| 17 | * any, provided herein do not apply to combinations of this program with |
| 18 | * other software, or any other product whatsoever. |
vapier | 45a8ba0 | 2009-07-20 10:59:32 +0000 | [diff] [blame] | 19 | * |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 20 | * You should have received a copy of the GNU General Public License along |
Wanlong Gao | fed9641 | 2012-10-24 10:10:29 +0800 | [diff] [blame] | 21 | * with this program; if not, write the Free Software Foundation, Inc., |
| 22 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
vapier | 45a8ba0 | 2009-07-20 10:59:32 +0000 | [diff] [blame] | 23 | * |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 24 | * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, |
| 25 | * Mountain View, CA 94043, or: |
vapier | 45a8ba0 | 2009-07-20 10:59:32 +0000 | [diff] [blame] | 26 | * |
| 27 | * http://www.sgi.com |
| 28 | * |
| 29 | * For further information regarding this notice, see: |
| 30 | * |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 31 | * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ |
| 32 | */ |
| 33 | |
Mike Frysinger | 28606c1 | 2010-08-17 17:22:45 -0400 | [diff] [blame] | 34 | #include "config.h" |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 35 | #include <errno.h> |
| 36 | #include <stdlib.h> |
| 37 | #include <string.h> |
| 38 | #include <sys/param.h> |
| 39 | #include <sys/signal.h> |
| 40 | #include <sys/types.h> |
| 41 | #include <unistd.h> |
| 42 | #include <sys/time.h> |
Cyril Hrubis | 4d964f6 | 2012-03-07 18:02:37 +0100 | [diff] [blame] | 43 | #include <stdint.h> |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 44 | |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 45 | #include "test.h" |
Cyril Hrubis | 06f9fe4 | 2013-06-26 14:55:48 +0200 | [diff] [blame] | 46 | #include "ltp_priv.h" |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 47 | #include "usctest.h" |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 48 | |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 49 | #ifndef UNIT_TEST |
| 50 | #define UNIT_TEST 0 |
| 51 | #endif |
| 52 | |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 53 | /* Define flags and args for standard options */ |
Cyril Hrubis | d5d3908 | 2014-05-27 15:28:09 +0200 | [diff] [blame] | 54 | static int STD_INFINITE = 0; /* flag indciating to loop forever */ |
| 55 | int STD_LOOP_COUNT = 1; /* number of iterations */ |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 56 | |
Cyril Hrubis | d5d3908 | 2014-05-27 15:28:09 +0200 | [diff] [blame] | 57 | static float STD_LOOP_DURATION = 0.0; /* duration value in fractional seconds */ |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 58 | |
Cyril Hrubis | d5d3908 | 2014-05-27 15:28:09 +0200 | [diff] [blame] | 59 | static char **STD_opt_arr = NULL; /* array of option strings */ |
| 60 | static int STD_argind = 1; /* argv index to next argv element */ |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 61 | /* (first argument) */ |
| 62 | /* To getopt users, it is like optind */ |
| 63 | |
| 64 | /* |
| 65 | * The following variables are to support system testing additions. |
| 66 | */ |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 67 | static int STD_TP_barrier = 0; /* flag to do barrier in TEST_PAUSE */ |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 68 | /* 2 - wait_barrier(), 3 - set_barrier(), * - barrier() */ |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 69 | static int STD_LP_barrier = 0; /* flag to do barrier in TEST_LOOPING */ |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 70 | /* 2 - wait_barrier(), 3 - set_barrier(), * - barrier() */ |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 71 | static int STD_TP_shmem_sz = 0; /* shmalloc this many words per pe in TEST_PAUSE */ |
| 72 | static int STD_LD_shmem = 0; /* flag to do shmem_puts and shmem_gets during delay */ |
| 73 | static int STD_LP_shmem = 0; /* flag to do shmem_puts and gets during TEST_LOOPING */ |
| 74 | static int STD_LD_recfun = 0; /* do recressive function calls in loop delay */ |
| 75 | static int STD_LP_recfun = 0; /* do recressive function calls in TEST_LOOPING */ |
| 76 | static int STD_TP_sbrk = 0; /* do sbrk in TEST_PAUSE */ |
| 77 | static int STD_LP_sbrk = 0; /* do sbrk in TEST_LOOPING */ |
| 78 | static char *STD_start_break = 0; /* original sbrk size */ |
| 79 | static int Debug = 0; |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 80 | |
Cyril Hrubis | d5d3908 | 2014-05-27 15:28:09 +0200 | [diff] [blame] | 81 | static struct std_option_t { |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 82 | char *optstr; |
| 83 | char *help; |
| 84 | char *flag; |
| 85 | char **arg; |
nstraz | 9418108 | 2000-08-30 18:43:38 +0000 | [diff] [blame] | 86 | } std_options[] = { |
Cyril Hrubis | 2a81c75 | 2014-05-27 14:54:09 +0200 | [diff] [blame] | 87 | {"h", " -h Show this help screen\n", NULL, NULL}, |
| 88 | {"i:", " -i n Execute test n times\n", NULL, NULL}, |
| 89 | {"I:", " -I x Execute test for x seconds\n", NULL, NULL}, |
robbiew | d34d581 | 2005-07-11 22:28:09 +0000 | [diff] [blame] | 90 | #ifdef UCLINUX |
Cyril Hrubis | 2a81c75 | 2014-05-27 14:54:09 +0200 | [diff] [blame] | 91 | {"C:", |
| 92 | " -C ARG Run the child process with arguments ARG (for internal use)\n", |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 93 | NULL, NULL}, |
robbiew | d34d581 | 2005-07-11 22:28:09 +0000 | [diff] [blame] | 94 | #endif |
Cyril Hrubis | d5d3908 | 2014-05-27 15:28:09 +0200 | [diff] [blame] | 95 | {NULL, NULL, NULL, NULL} |
| 96 | }; |
nstraz | 9418108 | 2000-08-30 18:43:38 +0000 | [diff] [blame] | 97 | |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 98 | /* |
| 99 | * Structure for usc_recressive_func argument |
| 100 | */ |
| 101 | struct usc_bigstack_t { |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 102 | char space[4096]; |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 103 | }; |
| 104 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 105 | static struct usc_bigstack_t *STD_bigstack = NULL; |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 106 | |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 107 | /* define the string length for Mesg and Mesg2 strings */ |
| 108 | #define STRLEN 2048 |
| 109 | |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 110 | static char Mesg2[STRLEN]; /* holds possible return string */ |
| 111 | static void usc_recressive_func(); |
| 112 | |
| 113 | /* |
| 114 | * Define bits for options that might have env variable default |
| 115 | */ |
Cyril Hrubis | 2a81c75 | 2014-05-27 14:54:09 +0200 | [diff] [blame] | 116 | #define OPT_iteration 01 |
Cyril Hrubis | 2a81c75 | 2014-05-27 14:54:09 +0200 | [diff] [blame] | 117 | #define OPT_duration 04 |
| 118 | #define OPT_delay 010 |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 119 | |
robbiew | d34d581 | 2005-07-11 22:28:09 +0000 | [diff] [blame] | 120 | #ifdef UCLINUX |
| 121 | /* Allocated and used in self_exec.c: */ |
| 122 | extern char *child_args; /* Arguments to child when -C is used */ |
| 123 | #endif |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 124 | |
Cyril Hrubis | 2a81c75 | 2014-05-27 14:54:09 +0200 | [diff] [blame] | 125 | static void print_help(void (*user_help)(void)) |
| 126 | { |
| 127 | int i; |
| 128 | |
| 129 | for (i = 0; std_options[i].optstr; ++i) { |
| 130 | if (std_options[i].help) |
| 131 | printf("%s", std_options[i].help); |
| 132 | } |
| 133 | |
| 134 | if (user_help) |
| 135 | user_help(); |
| 136 | } |
| 137 | |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 138 | /********************************************************************** |
vapier | 45a8ba0 | 2009-07-20 10:59:32 +0000 | [diff] [blame] | 139 | * parse_opts: |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 140 | **********************************************************************/ |
Cyril Hrubis | 2a81c75 | 2014-05-27 14:54:09 +0200 | [diff] [blame] | 141 | const char *parse_opts(int ac, char **av, const option_t * user_optarr, |
| 142 | void (*uhf)(void)) |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 143 | { |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 144 | int found; /* flag to indicate that an option specified was */ |
| 145 | /* found in the user's list */ |
| 146 | int k; /* scratch integer for returns and short time usage */ |
| 147 | float ftmp; /* tmp float for parsing env variables */ |
| 148 | char *ptr; /* used in getting env variables */ |
| 149 | int options = 0; /* no options specified */ |
| 150 | int optstrlen, i; |
| 151 | char *optionstr; |
Cyril Hrubis | 2a81c75 | 2014-05-27 14:54:09 +0200 | [diff] [blame] | 152 | int opt; |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 153 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 154 | /* |
| 155 | * If not the first time this function is called, release the old STD_opt_arr |
| 156 | * vector. |
| 157 | */ |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 158 | if (STD_opt_arr != NULL) { |
| 159 | free(STD_opt_arr); |
| 160 | STD_opt_arr = NULL; |
nstraz | 9418108 | 2000-08-30 18:43:38 +0000 | [diff] [blame] | 161 | } |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 162 | /* Calculate how much space we need for the option string */ |
| 163 | optstrlen = 0; |
| 164 | for (i = 0; std_options[i].optstr; ++i) |
| 165 | optstrlen += strlen(std_options[i].optstr); |
| 166 | if (user_optarr) |
| 167 | for (i = 0; user_optarr[i].option; ++i) { |
| 168 | if (strlen(user_optarr[i].option) > 2) |
| 169 | return |
| 170 | "parse_opts: ERROR - Only short options are allowed"; |
| 171 | optstrlen += strlen(user_optarr[i].option); |
| 172 | } |
| 173 | optstrlen += 1; |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 174 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 175 | /* Create the option string for getopt */ |
| 176 | optionstr = malloc(optstrlen); |
| 177 | if (!optionstr) |
| 178 | return |
| 179 | "parse_opts: ERROR - Could not allocate memory for optionstr"; |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 180 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 181 | optionstr[0] = '\0'; |
nstraz | 829b40a | 2000-09-06 14:33:29 +0000 | [diff] [blame] | 182 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 183 | for (i = 0; std_options[i].optstr; ++i) |
| 184 | strcat(optionstr, std_options[i].optstr); |
| 185 | if (user_optarr) |
| 186 | for (i = 0; user_optarr[i].option; ++i) |
| 187 | /* only add the option if it wasn't there already */ |
| 188 | if (strchr(optionstr, user_optarr[i].option[0]) == NULL) |
| 189 | strcat(optionstr, user_optarr[i].option); |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 190 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 191 | /* |
| 192 | * Loop through av parsing options. |
| 193 | */ |
| 194 | while ((opt = getopt(ac, av, optionstr)) > 0) { |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 195 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 196 | STD_argind = optind; |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 197 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 198 | switch (opt) { |
| 199 | case '?': /* Unknown option */ |
nstraz | 9418108 | 2000-08-30 18:43:38 +0000 | [diff] [blame] | 200 | return "Unknown option"; |
| 201 | break; |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 202 | case ':': /* Missing Arg */ |
nstraz | 9418108 | 2000-08-30 18:43:38 +0000 | [diff] [blame] | 203 | return "Missing argument"; |
| 204 | break; |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 205 | case 'i': /* Iterations */ |
nstraz | 9418108 | 2000-08-30 18:43:38 +0000 | [diff] [blame] | 206 | options |= OPT_iteration; |
| 207 | STD_LOOP_COUNT = atoi(optarg); |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 208 | if (STD_LOOP_COUNT == 0) |
| 209 | STD_INFINITE = 1; |
nstraz | 9418108 | 2000-08-30 18:43:38 +0000 | [diff] [blame] | 210 | break; |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 211 | case 'I': /* Time duration */ |
nstraz | 9418108 | 2000-08-30 18:43:38 +0000 | [diff] [blame] | 212 | options |= OPT_duration; |
| 213 | STD_LOOP_DURATION = atof(optarg); |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 214 | if (STD_LOOP_DURATION == 0.0) |
| 215 | STD_INFINITE = 1; |
nstraz | 9418108 | 2000-08-30 18:43:38 +0000 | [diff] [blame] | 216 | break; |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 217 | case 'h': /* Help */ |
nstraz | 9418108 | 2000-08-30 18:43:38 +0000 | [diff] [blame] | 218 | print_help(uhf); |
| 219 | exit(0); |
| 220 | break; |
robbiew | d34d581 | 2005-07-11 22:28:09 +0000 | [diff] [blame] | 221 | #ifdef UCLINUX |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 222 | case 'C': /* Run child */ |
robbiew | d34d581 | 2005-07-11 22:28:09 +0000 | [diff] [blame] | 223 | child_args = optarg; |
| 224 | break; |
| 225 | #endif |
nstraz | 9418108 | 2000-08-30 18:43:38 +0000 | [diff] [blame] | 226 | default: |
vapier | 45a8ba0 | 2009-07-20 10:59:32 +0000 | [diff] [blame] | 227 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 228 | /* Check all the user specified options */ |
| 229 | found = 0; |
| 230 | for (i = 0; user_optarr[i].option; ++i) { |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 231 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 232 | if (opt == user_optarr[i].option[0]) { |
| 233 | /* Yup, This is a user option, set the flag and look for argument */ |
| 234 | if (user_optarr[i].flag) { |
| 235 | *user_optarr[i].flag = 1; |
| 236 | } |
| 237 | found++; |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 238 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 239 | /* save the argument at the user's location */ |
| 240 | if (user_optarr[i]. |
| 241 | option[strlen(user_optarr[i].option) |
| 242 | - 1] == ':') { |
| 243 | *user_optarr[i].arg = optarg; |
| 244 | } |
| 245 | break; /* option found - break out of the for loop */ |
| 246 | } |
| 247 | } |
| 248 | /* This condition "should never happen". SO CHECK FOR IT!!!! */ |
| 249 | if (!found) { |
| 250 | sprintf(Mesg2, |
| 251 | "parse_opts: ERROR - option:\"%c\" NOT FOUND... INTERNAL " |
| 252 | "ERROR", opt); |
| 253 | return (Mesg2); |
| 254 | } |
| 255 | } |
| 256 | |
Cyril Hrubis | 2a81c75 | 2014-05-27 14:54:09 +0200 | [diff] [blame] | 257 | } |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 258 | free(optionstr); |
| 259 | |
| 260 | STD_argind = optind; |
| 261 | |
| 262 | /* |
| 263 | * Turn on debug |
| 264 | */ |
Cyril Hrubis | 8dc262a | 2013-06-04 19:12:59 +0200 | [diff] [blame] | 265 | if (getenv("USC_DEBUG") != NULL) { |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 266 | Debug = 1; |
| 267 | printf("env USC_DEBUG is defined, turning on debug\n"); |
| 268 | } |
Cyril Hrubis | 8dc262a | 2013-06-04 19:12:59 +0200 | [diff] [blame] | 269 | if (getenv("USC_VERBOSE") != NULL) { |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 270 | Debug = 1; |
| 271 | printf("env USC_VERBOSE is defined, turning on debug\n"); |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 272 | } |
| 273 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 274 | /* |
| 275 | * If the USC_ITERATION_ENV environmental variable is set to |
| 276 | * a number, use that number as iteration count (same as -c option). |
| 277 | * The -c option with arg will be used even if this env var is set. |
| 278 | */ |
| 279 | if (!(options & OPT_iteration) |
| 280 | && (ptr = getenv(USC_ITERATION_ENV)) != NULL) { |
| 281 | if (sscanf(ptr, "%i", &k) == 1) { |
| 282 | if (k == 0) { /* if arg is 0, set infinite loop flag */ |
| 283 | STD_INFINITE = 1; |
| 284 | if (Debug) |
| 285 | printf |
| 286 | ("Using env %s, set STD_INFINITE to 1\n", |
| 287 | USC_ITERATION_ENV); |
| 288 | } else { /* else, set the loop count to the arguement */ |
| 289 | STD_LOOP_COUNT = k; |
| 290 | if (Debug) |
| 291 | printf |
| 292 | ("Using env %s, set STD_LOOP_COUNT to %d\n", |
| 293 | USC_ITERATION_ENV, k); |
| 294 | } |
| 295 | } |
| 296 | } |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 297 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 298 | /* |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 299 | * If the USC_LOOP_WALLTIME environmental variable is set, |
| 300 | * use that number as duration (same as -I option). |
| 301 | * The -I option with arg will be used even if this env var is set. |
| 302 | */ |
| 303 | |
| 304 | if (!(options & OPT_duration) && |
| 305 | (ptr = getenv(USC_LOOP_WALLTIME)) != NULL) { |
| 306 | if (sscanf(ptr, "%f", &ftmp) == 1 && ftmp >= 0.0) { |
| 307 | STD_LOOP_DURATION = ftmp; |
| 308 | if (Debug) |
| 309 | printf |
| 310 | ("Using env %s, set STD_LOOP_DURATION to %f\n", |
| 311 | USC_LOOP_WALLTIME, ftmp); |
| 312 | if (STD_LOOP_DURATION == 0.0) { /* if arg is 0, set infinite loop flag */ |
| 313 | STD_INFINITE = 1; |
| 314 | if (Debug) |
| 315 | printf |
| 316 | ("Using env %s, set STD_INFINITE to 1\n", |
| 317 | USC_LOOP_WALLTIME); |
| 318 | } |
| 319 | } |
| 320 | } |
| 321 | if (!(options & OPT_duration) && (ptr = getenv("USC_DURATION")) != NULL) { |
| 322 | if (sscanf(ptr, "%f", &ftmp) == 1 && ftmp >= 0.0) { |
| 323 | STD_LOOP_DURATION = ftmp; |
| 324 | if (Debug) |
| 325 | printf |
| 326 | ("Using env USC_DURATION, set STD_LOOP_DURATION to %f\n", |
| 327 | ftmp); |
| 328 | if (STD_LOOP_DURATION == 0.0) { /* if arg is 0, set infinite loop flag */ |
| 329 | STD_INFINITE = 1; |
| 330 | if (Debug) |
| 331 | printf |
| 332 | ("Using env USC_DURATION, set STD_INFINITE to 1\n"); |
| 333 | } |
| 334 | } |
| 335 | } |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 336 | |
| 337 | /* |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 338 | * The following are special system testing envs to turn on special |
| 339 | * hooks in the code. |
| 340 | */ |
| 341 | if ((ptr = getenv("USC_TP_BARRIER")) != NULL) { |
| 342 | if (sscanf(ptr, "%i", &k) == 1 && k >= 0) |
| 343 | STD_TP_barrier = k; |
| 344 | else |
| 345 | STD_TP_barrier = 1; |
Garrett Cooper | 903910d | 2010-11-23 09:27:44 -0800 | [diff] [blame] | 346 | if (Debug) |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 347 | printf |
| 348 | ("using env USC_TP_BARRIER, Set STD_TP_barrier to %d\n", |
| 349 | STD_TP_barrier); |
| 350 | } |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 351 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 352 | if ((ptr = getenv("USC_LP_BARRIER")) != NULL) { |
| 353 | if (sscanf(ptr, "%i", &k) == 1 && k >= 0) |
| 354 | STD_LP_barrier = k; |
| 355 | else |
| 356 | STD_LP_barrier = 1; |
| 357 | if (Debug) |
| 358 | printf |
| 359 | ("using env USC_LP_BARRIER, Set STD_LP_barrier to %d\n", |
| 360 | STD_LP_barrier); |
| 361 | } |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 362 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 363 | if ((ptr = getenv("USC_TP_SHMEM")) != NULL) { |
| 364 | if (sscanf(ptr, "%i", &k) == 1 && k >= 0) { |
| 365 | STD_TP_shmem_sz = k; |
| 366 | if (Debug) |
| 367 | printf |
| 368 | ("Using env USC_TP_SHMEM, Set STD_TP_shmem_sz to %d\n", |
| 369 | STD_TP_shmem_sz); |
| 370 | } |
| 371 | } |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 372 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 373 | if ((ptr = getenv("USC_LP_SHMEM")) != NULL) { |
| 374 | if (sscanf(ptr, "%i", &k) == 1 && k >= 0) { |
| 375 | STD_LP_shmem = k; |
| 376 | if (Debug) |
| 377 | printf |
| 378 | ("Using env USC_LP_SHMEM, Set STD_LP_shmem to %d\n", |
| 379 | STD_LP_shmem); |
| 380 | } |
| 381 | } |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 382 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 383 | if ((ptr = getenv("USC_LD_SHMEM")) != NULL) { |
| 384 | if (sscanf(ptr, "%i", &k) == 1 && k >= 0) { |
| 385 | STD_LD_shmem = k; |
| 386 | if (Debug) |
| 387 | printf |
| 388 | ("Using env USC_LD_SHMEM, Set STD_LD_shmem to %d\n", |
| 389 | STD_LD_shmem); |
| 390 | } |
| 391 | } |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 392 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 393 | if ((ptr = getenv("USC_TP_SBRK")) != NULL) { |
| 394 | if (sscanf(ptr, "%i", &k) == 1 && k >= 0) { |
| 395 | STD_TP_sbrk = k; |
| 396 | if (Debug) |
| 397 | printf |
| 398 | ("Using env USC_TP_SBRK, Set STD_TP_sbrk to %d\n", |
| 399 | STD_TP_sbrk); |
| 400 | } |
| 401 | } |
robbiew | d34d581 | 2005-07-11 22:28:09 +0000 | [diff] [blame] | 402 | #if !defined(UCLINUX) |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 403 | if ((ptr = getenv("USC_LP_SBRK")) != NULL) { |
| 404 | if (sscanf(ptr, "%i", &k) == 1 && k >= 0) { |
| 405 | STD_LP_sbrk = k; |
| 406 | if (Debug) |
| 407 | printf |
| 408 | ("Using env USC_LP_SBRK, Set STD_LP_sbrk to %d\n", |
| 409 | STD_LP_sbrk); |
| 410 | } |
| 411 | } |
robbiew | d34d581 | 2005-07-11 22:28:09 +0000 | [diff] [blame] | 412 | #endif /* if !defined(UCLINUX) */ |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 413 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 414 | if ((ptr = getenv("USC_LP_RECFUN")) != NULL) { |
| 415 | if (sscanf(ptr, "%i", &k) == 1 && k >= 0) { |
| 416 | STD_LP_recfun = k; |
| 417 | if (STD_bigstack != NULL) |
| 418 | STD_bigstack = |
| 419 | malloc(sizeof(struct usc_bigstack_t)); |
| 420 | if (Debug) |
| 421 | printf |
| 422 | ("Using env USC_LP_RECFUN, Set STD_LP_recfun to %d\n", |
| 423 | STD_LP_recfun); |
| 424 | } |
| 425 | } |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 426 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 427 | if ((ptr = getenv("USC_LD_RECFUN")) != NULL) { |
| 428 | if (sscanf(ptr, "%i", &k) == 1 && k >= 0) { |
| 429 | STD_LD_recfun = k; |
| 430 | if (STD_bigstack != NULL) |
| 431 | STD_bigstack = |
| 432 | malloc(sizeof(struct usc_bigstack_t)); |
| 433 | if (Debug) |
| 434 | printf |
| 435 | ("Using env USC_LD_RECFUN, Set STD_LD_recfun to %d\n", |
| 436 | STD_LD_recfun); |
| 437 | } |
| 438 | } |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 439 | #if UNIT_TEST |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 440 | printf("The following variables after option and env parsing:\n"); |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 441 | printf("STD_LOOP_DURATION = %f\n", STD_LOOP_DURATION); |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 442 | printf("STD_LOOP_COUNT = %d\n", STD_LOOP_COUNT); |
| 443 | printf("STD_INFINITE = %d\n", STD_INFINITE); |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 444 | #endif |
| 445 | |
Cyril Hrubis | 2a81c75 | 2014-05-27 14:54:09 +0200 | [diff] [blame] | 446 | return NULL; |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 447 | } |
| 448 | |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 449 | /*********************************************************************** |
| 450 | * This function will do desired end of global setup test |
| 451 | * hooks. |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 452 | ***********************************************************************/ |
Cyril Hrubis | ee75ce3 | 2014-02-05 14:05:06 +0100 | [diff] [blame] | 453 | int usc_global_setup_hook(void) |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 454 | { |
robbiew | d34d581 | 2005-07-11 22:28:09 +0000 | [diff] [blame] | 455 | #ifndef UCLINUX |
Cyril Hrubis | 2a81c75 | 2014-05-27 14:54:09 +0200 | [diff] [blame] | 456 | if (STD_TP_sbrk || STD_LP_sbrk) |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 457 | STD_start_break = sbrk(0); /* get original sbreak size */ |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 458 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 459 | if (STD_TP_sbrk) { |
| 460 | sbrk(STD_TP_sbrk); |
| 461 | if (Debug) |
| 462 | printf("after sbrk(%d)\n", STD_TP_sbrk); |
| 463 | } |
robbiew | d34d581 | 2005-07-11 22:28:09 +0000 | [diff] [blame] | 464 | #endif |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 465 | return 0; |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 466 | } |
| 467 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 468 | #define USECS_PER_SEC 1000000 /* microseconds per second */ |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 469 | |
| 470 | /*********************************************************************** |
Cyril Hrubis | 4d964f6 | 2012-03-07 18:02:37 +0100 | [diff] [blame] | 471 | * Returns current time in microseconds since 1970. |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 472 | ***********************************************************************/ |
Cyril Hrubis | 4d964f6 | 2012-03-07 18:02:37 +0100 | [diff] [blame] | 473 | static uint64_t get_current_time(void) |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 474 | { |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 475 | struct timeval curtime; |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 476 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 477 | gettimeofday(&curtime, NULL); |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 478 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 479 | return (((uint64_t) curtime.tv_sec) * USECS_PER_SEC) + curtime.tv_usec; |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 480 | } |
| 481 | |
| 482 | /*********************************************************************** |
| 483 | * |
| 484 | * This function will determine if test should continue iterating |
| 485 | * If the STD_INFINITE flag is set, return 1. |
| 486 | * If the STD_LOOP_COUNT variable is set, compare it against |
| 487 | * the counter. |
| 488 | * If the STD_LOOP_DURATION variable is set, compare current time against |
| 489 | * calculated stop_time. |
| 490 | * This function will return 1 until all desired looping methods |
vapier | 45a8ba0 | 2009-07-20 10:59:32 +0000 | [diff] [blame] | 491 | * have been met. |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 492 | * |
| 493 | * counter integer is supplied by the user program. |
| 494 | ***********************************************************************/ |
Garrett Cooper | 8b02c1c | 2011-01-26 01:34:49 -0800 | [diff] [blame] | 495 | int usc_test_looping(int counter) |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 496 | { |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 497 | static int first_time = 1; |
| 498 | static uint64_t stop_time = 0; |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 499 | int keepgoing = 0; |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 500 | |
| 501 | /* |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 502 | * If this is the first iteration and we are looping for |
| 503 | * duration of STD_LOOP_DURATION seconds (fractional) or |
| 504 | * doing loop delays, get the clocks per second. |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 505 | */ |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 506 | if (first_time) { |
| 507 | first_time = 0; |
| 508 | |
| 509 | /* |
| 510 | * If looping for duration, calculate stop time in |
| 511 | * clocks. |
| 512 | */ |
| 513 | if (STD_LOOP_DURATION) { |
| 514 | stop_time = |
| 515 | (uint64_t) (USECS_PER_SEC * STD_LOOP_DURATION) |
| 516 | + get_current_time(); |
| 517 | } |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 518 | } |
| 519 | |
| 520 | if (STD_INFINITE) |
| 521 | keepgoing++; |
| 522 | |
| 523 | if (STD_LOOP_COUNT && counter < STD_LOOP_COUNT) |
| 524 | keepgoing++; |
| 525 | |
| 526 | if (STD_LOOP_DURATION != 0.0 && get_current_time() < stop_time) |
| 527 | keepgoing++; |
| 528 | |
| 529 | if (keepgoing == 0) |
| 530 | return 0; |
| 531 | |
| 532 | /* |
| 533 | * The following code allows special system testing hooks. |
| 534 | */ |
| 535 | |
| 536 | if (STD_LP_recfun) { |
Garrett Cooper | 903910d | 2010-11-23 09:27:44 -0800 | [diff] [blame] | 537 | if (Debug) |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 538 | printf |
| 539 | ("calling usc_recressive_func(0, %d, *STD_bigstack)\n", |
| 540 | STD_LP_recfun); |
| 541 | usc_recressive_func(0, STD_LP_recfun, *STD_bigstack); |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 542 | } |
robbiew | d34d581 | 2005-07-11 22:28:09 +0000 | [diff] [blame] | 543 | #if !defined(UCLINUX) |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 544 | if (STD_LP_sbrk) { |
| 545 | if (Debug) |
| 546 | printf("about to do sbrk(%d)\n", STD_LP_sbrk); |
| 547 | sbrk(STD_LP_sbrk); |
| 548 | } |
robbiew | d34d581 | 2005-07-11 22:28:09 +0000 | [diff] [blame] | 549 | #endif |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 550 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 551 | if (keepgoing) |
| 552 | return 1; |
| 553 | else |
Cyril Hrubis | 2a81c75 | 2014-05-27 14:54:09 +0200 | [diff] [blame] | 554 | return 0; |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 555 | } |
| 556 | |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 557 | /* |
| 558 | * This function recressively calls itself max times. |
vapier | 45a8ba0 | 2009-07-20 10:59:32 +0000 | [diff] [blame] | 559 | */ |
Garrett Cooper | 8b02c1c | 2011-01-26 01:34:49 -0800 | [diff] [blame] | 560 | static void usc_recressive_func(int cnt, int max, struct usc_bigstack_t bstack) |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 561 | { |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 562 | if (cnt < max) |
| 563 | usc_recressive_func(cnt + 1, max, bstack); |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 564 | |
| 565 | } |
| 566 | |
| 567 | #if UNIT_TEST |
Cyril Hrubis | 1589919 | 2014-05-27 16:57:45 +0200 | [diff] [blame] | 568 | #include <time.h> |
| 569 | |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 570 | /****************************************************************************** |
| 571 | * UNIT TEST CODE |
| 572 | * UNIT TEST CODE |
vapier | 45a8ba0 | 2009-07-20 10:59:32 +0000 | [diff] [blame] | 573 | * |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 574 | * this following code is provide so that unit testing can |
| 575 | * be done fairly easily. |
| 576 | ******************************************************************************/ |
| 577 | |
| 578 | int Help = 0; |
| 579 | int Help2 = 0; |
| 580 | char *ptr; |
| 581 | |
Markos Chandras | fd4ada7 | 2012-01-03 11:10:37 +0000 | [diff] [blame] | 582 | long TEST_RETURN; |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 583 | int TEST_ERRNO; |
| 584 | |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 585 | /* for test specific parse_opts options */ |
| 586 | option_t Options[] = { |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 587 | {"help", &Help2, NULL}, /* -help option */ |
| 588 | {"h", &Help, NULL}, /* -h option */ |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 589 | |
| 590 | #if INVALID_TEST_CASES |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 591 | {"missingflag", NULL, &ptr}, /* error */ |
| 592 | {"missingarg:", &Help, NULL}, /* error */ |
| 593 | #endif /* INVALID_TEST_CASES */ |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 594 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 595 | {NULL, NULL, NULL} |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 596 | }; |
| 597 | |
Garrett Cooper | 8b02c1c | 2011-01-26 01:34:49 -0800 | [diff] [blame] | 598 | int main(int argc, char **argv) |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 599 | { |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 600 | int lc; |
| 601 | char *msg; |
| 602 | struct timeval t; |
| 603 | int cnt; |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 604 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 605 | if ((msg = parse_opts(argc, argv, Options, NULL)) != NULL) { |
| 606 | printf("ERROR: %s\n", msg); |
| 607 | exit(1); |
| 608 | } |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 609 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 610 | TEST_PAUSE; |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 611 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 612 | for (lc = 0; TEST_LOOPING(lc); lc++) { |
vapier | 45a8ba0 | 2009-07-20 10:59:32 +0000 | [diff] [blame] | 613 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 614 | TEST(gettimeofday(&t, NULL)); |
| 615 | printf("iter=%d: sec:%d, usec:%6.6d %s", lc + 1, t.tv_sec, |
| 616 | t.tv_usec, ctime(&t.tv_sec)); |
| 617 | } |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 618 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 619 | TEST_CLEANUP; |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 620 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 621 | exit(0); |
alaffin | cc2e555 | 2000-07-27 17:13:18 +0000 | [diff] [blame] | 622 | } |
| 623 | |
Garrett Cooper | 8b02c1c | 2011-01-26 01:34:49 -0800 | [diff] [blame] | 624 | #endif /* UNIT_TEST */ |