blob: 3e99bdb3d9038600528120c9f9e2155b0c061a12 [file] [log] [blame]
alaffincc2e5552000-07-27 17:13:18 +00001/*
2 * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
vapier45a8ba02009-07-20 10:59:32 +00003 *
alaffincc2e5552000-07-27 17:13:18 +00004 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as
6 * published by the Free Software Foundation.
vapier45a8ba02009-07-20 10:59:32 +00007 *
alaffincc2e5552000-07-27 17:13:18 +00008 * This program is distributed in the hope that it would be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
vapier45a8ba02009-07-20 10:59:32 +000011 *
alaffincc2e5552000-07-27 17:13:18 +000012 * Further, this software is distributed without any warranty that it is
13 * free of the rightful claim of any third person regarding infringement
14 * or the like. Any license provided herein, whether implied or
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
vapier45a8ba02009-07-20 10:59:32 +000018 *
alaffincc2e5552000-07-27 17:13:18 +000019 * You should have received a copy of the GNU General Public License along
Wanlong Gaofed96412012-10-24 10:10:29 +080020 * with this program; if not, write the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
vapier45a8ba02009-07-20 10:59:32 +000022 *
alaffincc2e5552000-07-27 17:13:18 +000023 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
vapier45a8ba02009-07-20 10:59:32 +000025 *
26 * http://www.sgi.com
27 *
28 * For further information regarding this notice, see:
29 *
alaffincc2e5552000-07-27 17:13:18 +000030 * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
31 */
32
vapier3dc04702009-08-28 09:59:52 +000033/* $Id: parse_opts.c,v 1.14 2009/08/28 09:59:52 vapier Exp $ */
alaffincc2e5552000-07-27 17:13:18 +000034
35/**********************************************************
vapier45a8ba02009-07-20 10:59:32 +000036 *
alaffincc2e5552000-07-27 17:13:18 +000037 * OS Testing - Silicon Graphics, Inc.
vapier45a8ba02009-07-20 10:59:32 +000038 *
Cyril Hrubis06f9fe42013-06-26 14:55:48 +020039 * FUNCTION NAME : parse_opts
vapier45a8ba02009-07-20 10:59:32 +000040 *
alaffincc2e5552000-07-27 17:13:18 +000041 * FUNCTION TITLE : parse standard & user options for system call tests
vapier45a8ba02009-07-20 10:59:32 +000042 *
alaffincc2e5552000-07-27 17:13:18 +000043 * SYNOPSIS:
44 * #include "usctest.h"
45 *
Cyril Hrubis06f9fe42013-06-26 14:55:48 +020046 * char *parse_opts(ac, av, user_optarr, uhf)
alaffincc2e5552000-07-27 17:13:18 +000047 * int ac;
Cyril Hrubis06f9fe42013-06-26 14:55:48 +020048 * char **av;
alaffincc2e5552000-07-27 17:13:18 +000049 * option_t user_optarr[];
nstraz94181082000-08-30 18:43:38 +000050 * void (*uhf)();
vapier45a8ba02009-07-20 10:59:32 +000051 *
alaffincc2e5552000-07-27 17:13:18 +000052 * AUTHOR : William Roske/Richard Logan
vapier45a8ba02009-07-20 10:59:32 +000053 *
alaffincc2e5552000-07-27 17:13:18 +000054 * INITIAL RELEASE : UNICOS 7.0
vapier45a8ba02009-07-20 10:59:32 +000055 *
alaffincc2e5552000-07-27 17:13:18 +000056 * DESCRIPTION
Cyril Hrubis06f9fe42013-06-26 14:55:48 +020057 * The parse_opts library routine takes that argc and argv parameters
alaffincc2e5552000-07-27 17:13:18 +000058 * recevied by main() and an array of structures defining user options.
59 * It parses the command line setting flag and argument locations
nstraz94181082000-08-30 18:43:38 +000060 * associated with the options. It uses getopt to do the actual cmd line
61 * parsing. uhf() is a function to print user define help
alaffincc2e5552000-07-27 17:13:18 +000062 *
63 * This module contains the functions usc_global_setup_hook and
64 * usc_test_looping, which are called by marcos defined in usctest.h.
vapier45a8ba02009-07-20 10:59:32 +000065 *
alaffincc2e5552000-07-27 17:13:18 +000066 * RETURN VALUE
Cyril Hrubis06f9fe42013-06-26 14:55:48 +020067 * parse_opts returns a pointer to an error message if an error occurs.
alaffincc2e5552000-07-27 17:13:18 +000068 * This pointer is (char *)NULL if parsing is successful.
vapier45a8ba02009-07-20 10:59:32 +000069 *
alaffincc2e5552000-07-27 17:13:18 +000070 *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#**/
Mike Frysinger28606c12010-08-17 17:22:45 -040071#include "config.h"
alaffincc2e5552000-07-27 17:13:18 +000072#include <errno.h>
73#include <stdlib.h>
74#include <string.h>
75#include <sys/param.h>
76#include <sys/signal.h>
77#include <sys/types.h>
78#include <unistd.h>
79#include <sys/time.h>
Cyril Hrubis4d964f62012-03-07 18:02:37 +010080#include <stdint.h>
alaffincc2e5552000-07-27 17:13:18 +000081
alaffincc2e5552000-07-27 17:13:18 +000082#if UNIT_TEST
83#include <time.h>
84#endif /* UNIT_TEST */
85
86#include "test.h"
Cyril Hrubis06f9fe42013-06-26 14:55:48 +020087#include "ltp_priv.h"
alaffincc2e5552000-07-27 17:13:18 +000088#include "usctest.h"
alaffincc2e5552000-07-27 17:13:18 +000089
90#ifndef USC_COPIES
91#define USC_COPIES "USC_COPIES"
92#endif
93
94#ifndef UNIT_TEST
95#define UNIT_TEST 0
96#endif
97
98#ifndef DEBUG
99#define DEBUG 0
100#endif
101
alaffincc2e5552000-07-27 17:13:18 +0000102/* The timing information block. */
Wanlong Gao354ebb42012-12-07 10:10:04 +0800103struct tblock tblock = { 0, ((long)-1) >> 1, 0, 0 };
alaffincc2e5552000-07-27 17:13:18 +0000104
Garrett Cooperd3e6e8f2010-12-13 02:55:35 -0800105#ifdef GARRETT_IS_A_PEDANTIC_BASTARD
Wanlong Gao354ebb42012-12-07 10:10:04 +0800106extern pid_t spawned_program_pid;
Garrett Cooperd3e6e8f2010-12-13 02:55:35 -0800107#endif
alaffincc2e5552000-07-27 17:13:18 +0000108
109/* Define flags and args for standard options */
Wanlong Gao354ebb42012-12-07 10:10:04 +0800110int STD_FUNCTIONAL_TEST = 1, /* flag indicating to do functional testing code */
111 STD_TIMING_ON = 0, /* flag indicating to print timing stats */
112 STD_PAUSE = 0, /* flag indicating to pause before actual start, */
113 /* for contention mode */
114 STD_INFINITE = 0, /* flag indciating to loop forever */
115 STD_LOOP_COUNT = 1, /* number of iterations */
116 STD_COPIES = 1, /* number of copies */
117 STD_ERRNO_LOG = 0; /* flag indicating to do errno logging */
alaffincc2e5552000-07-27 17:13:18 +0000118
Wanlong Gao354ebb42012-12-07 10:10:04 +0800119float STD_LOOP_DURATION = 0.0, /* duration value in fractional seconds */
120 STD_LOOP_DELAY = 0.0; /* loop delay value in fractional seconds */
alaffincc2e5552000-07-27 17:13:18 +0000121
122char **STD_opt_arr = NULL; /* array of option strings */
Wanlong Gao354ebb42012-12-07 10:10:04 +0800123int STD_nopts = 0, /* number of elements in STD_opt_arr */
124 STD_argind = 1; /* argv index to next argv element */
alaffincc2e5552000-07-27 17:13:18 +0000125 /* (first argument) */
126 /* To getopt users, it is like optind */
127
128/*
129 * The following variables are to support system testing additions.
130 */
Wanlong Gao354ebb42012-12-07 10:10:04 +0800131static int STD_TP_barrier = 0; /* flag to do barrier in TEST_PAUSE */
alaffincc2e5552000-07-27 17:13:18 +0000132 /* 2 - wait_barrier(), 3 - set_barrier(), * - barrier() */
Wanlong Gao354ebb42012-12-07 10:10:04 +0800133static int STD_LP_barrier = 0; /* flag to do barrier in TEST_LOOPING */
alaffincc2e5552000-07-27 17:13:18 +0000134 /* 2 - wait_barrier(), 3 - set_barrier(), * - barrier() */
Wanlong Gao354ebb42012-12-07 10:10:04 +0800135static int STD_TP_shmem_sz = 0; /* shmalloc this many words per pe in TEST_PAUSE */
136static int STD_LD_shmem = 0; /* flag to do shmem_puts and shmem_gets during delay */
137static int STD_LP_shmem = 0; /* flag to do shmem_puts and gets during TEST_LOOPING */
138static int STD_LD_recfun = 0; /* do recressive function calls in loop delay */
139static int STD_LP_recfun = 0; /* do recressive function calls in TEST_LOOPING */
140static int STD_TP_sbrk = 0; /* do sbrk in TEST_PAUSE */
141static int STD_LP_sbrk = 0; /* do sbrk in TEST_LOOPING */
142static char *STD_start_break = 0; /* original sbrk size */
143static int Debug = 0;
alaffincc2e5552000-07-27 17:13:18 +0000144
nstraz94181082000-08-30 18:43:38 +0000145struct std_option_t {
Wanlong Gao354ebb42012-12-07 10:10:04 +0800146 char *optstr;
147 char *help;
148 char *flag;
149 char **arg;
nstraz94181082000-08-30 18:43:38 +0000150} std_options[] = {
Wanlong Gao354ebb42012-12-07 10:10:04 +0800151 {
152 "c:", " -c n Run n copies concurrently\n", NULL, NULL}, {
153 "e", " -e Turn on errno logging\n", NULL, NULL}, {
154 "f", " -f Turn off functional testing\n", NULL, NULL}, {
155 "h", " -h Show this help screen\n", NULL, NULL}, {
156 "i:", " -i n Execute test n times\n", NULL, NULL}, {
157 "I:", " -I x Execute test for x seconds\n", NULL, NULL}, {
158 "p", " -p Pause for SIGUSR1 before starting\n", NULL, NULL}, {
159 "P:", " -P x Pause for x seconds between iterations\n", NULL, NULL},
160 {
161 "t", " -t Turn on syscall timing\n", NULL, NULL},
robbiewd34d5812005-07-11 22:28:09 +0000162#ifdef UCLINUX
Wanlong Gao354ebb42012-12-07 10:10:04 +0800163 {
164 "C:",
165 " -C ARG Run the child process with arguments ARG (for internal use)\n",
166 NULL, NULL},
robbiewd34d5812005-07-11 22:28:09 +0000167#endif
Wanlong Gao354ebb42012-12-07 10:10:04 +0800168 {
169NULL, NULL, NULL, NULL}};
nstraz94181082000-08-30 18:43:38 +0000170
Wanlong Gao354ebb42012-12-07 10:10:04 +0800171void print_help(void (*user_help) ());
nstraz94181082000-08-30 18:43:38 +0000172
alaffincc2e5552000-07-27 17:13:18 +0000173/*
174 * Structure for usc_recressive_func argument
175 */
176struct usc_bigstack_t {
Wanlong Gao354ebb42012-12-07 10:10:04 +0800177 char space[4096];
alaffincc2e5552000-07-27 17:13:18 +0000178};
179
Wanlong Gao354ebb42012-12-07 10:10:04 +0800180static struct usc_bigstack_t *STD_bigstack = NULL;
alaffincc2e5552000-07-27 17:13:18 +0000181
alaffincc2e5552000-07-27 17:13:18 +0000182/*
183 * Counter of errnos returned (-e option). Indexed by errno.
184 * Make the array USC_MAX_ERRNO long. That is the first Fortran
185 * Lib errno. No syscall should return an errno that high.
186 */
187int STD_ERRNO_LIST[USC_MAX_ERRNO];
188
189/* define the string length for Mesg and Mesg2 strings */
190#define STRLEN 2048
191
alaffincc2e5552000-07-27 17:13:18 +0000192static char Mesg2[STRLEN]; /* holds possible return string */
193static void usc_recressive_func();
194
195/*
196 * Define bits for options that might have env variable default
197 */
198#define OPT_iteration 01
199#define OPT_nofunccheck 02
200#define OPT_duration 04
201#define OPT_delay 010
202#define OPT_copies 020
203
robbiewd34d5812005-07-11 22:28:09 +0000204#ifdef UCLINUX
205/* Allocated and used in self_exec.c: */
206extern char *child_args; /* Arguments to child when -C is used */
207#endif
alaffincc2e5552000-07-27 17:13:18 +0000208
209/**********************************************************************
vapier45a8ba02009-07-20 10:59:32 +0000210 * parse_opts:
alaffincc2e5552000-07-27 17:13:18 +0000211 **********************************************************************/
Wanlong Gao354ebb42012-12-07 10:10:04 +0800212char *parse_opts(int ac, char **av, const option_t * user_optarr,
213 void (*uhf) ())
alaffincc2e5552000-07-27 17:13:18 +0000214{
Wanlong Gao354ebb42012-12-07 10:10:04 +0800215 int found; /* flag to indicate that an option specified was */
216 /* found in the user's list */
217 int k; /* scratch integer for returns and short time usage */
218 float ftmp; /* tmp float for parsing env variables */
219 char *ptr; /* used in getting env variables */
220 int options = 0; /* no options specified */
221 int optstrlen, i;
222 char *optionstr;
223 int opt; /* return of getopt */
alaffincc2e5552000-07-27 17:13:18 +0000224
Wanlong Gao354ebb42012-12-07 10:10:04 +0800225 /*
226 * If not the first time this function is called, release the old STD_opt_arr
227 * vector.
228 */
alaffincc2e5552000-07-27 17:13:18 +0000229
Garrett Cooperd3e6e8f2010-12-13 02:55:35 -0800230#ifdef GARRETT_IS_A_PEDANTIC_BASTARD
Wanlong Gao354ebb42012-12-07 10:10:04 +0800231 spawned_program_pid = getpid();
Garrett Cooperd3e6e8f2010-12-13 02:55:35 -0800232#endif
233
Wanlong Gao354ebb42012-12-07 10:10:04 +0800234 if (STD_opt_arr != NULL) {
235 free(STD_opt_arr);
236 STD_opt_arr = NULL;
nstraz94181082000-08-30 18:43:38 +0000237 }
Wanlong Gao354ebb42012-12-07 10:10:04 +0800238 /* Calculate how much space we need for the option string */
239 optstrlen = 0;
240 for (i = 0; std_options[i].optstr; ++i)
241 optstrlen += strlen(std_options[i].optstr);
242 if (user_optarr)
243 for (i = 0; user_optarr[i].option; ++i) {
244 if (strlen(user_optarr[i].option) > 2)
245 return
246 "parse_opts: ERROR - Only short options are allowed";
247 optstrlen += strlen(user_optarr[i].option);
248 }
249 optstrlen += 1;
alaffincc2e5552000-07-27 17:13:18 +0000250
Wanlong Gao354ebb42012-12-07 10:10:04 +0800251 /* Create the option string for getopt */
252 optionstr = malloc(optstrlen);
253 if (!optionstr)
254 return
255 "parse_opts: ERROR - Could not allocate memory for optionstr";
alaffincc2e5552000-07-27 17:13:18 +0000256
Wanlong Gao354ebb42012-12-07 10:10:04 +0800257 optionstr[0] = '\0';
nstraz829b40a2000-09-06 14:33:29 +0000258
Wanlong Gao354ebb42012-12-07 10:10:04 +0800259 for (i = 0; std_options[i].optstr; ++i)
260 strcat(optionstr, std_options[i].optstr);
261 if (user_optarr)
262 for (i = 0; user_optarr[i].option; ++i)
263 /* only add the option if it wasn't there already */
264 if (strchr(optionstr, user_optarr[i].option[0]) == NULL)
265 strcat(optionstr, user_optarr[i].option);
alaffincc2e5552000-07-27 17:13:18 +0000266
267#if DEBUG > 1
Wanlong Gao354ebb42012-12-07 10:10:04 +0800268 printf("STD_nopts = %d\n", STD_nopts);
alaffincc2e5552000-07-27 17:13:18 +0000269#endif
270
Wanlong Gao354ebb42012-12-07 10:10:04 +0800271 /*
272 * Loop through av parsing options.
273 */
274 while ((opt = getopt(ac, av, optionstr)) > 0) {
alaffincc2e5552000-07-27 17:13:18 +0000275
Wanlong Gao354ebb42012-12-07 10:10:04 +0800276 STD_argind = optind;
alaffincc2e5552000-07-27 17:13:18 +0000277#if DEBUG > 0
Wanlong Gao354ebb42012-12-07 10:10:04 +0800278 printf("parse_opts: getopt returned '%c'\n", opt);
alaffincc2e5552000-07-27 17:13:18 +0000279#endif
alaffincc2e5552000-07-27 17:13:18 +0000280
Wanlong Gao354ebb42012-12-07 10:10:04 +0800281 switch (opt) {
282 case '?': /* Unknown option */
nstraz94181082000-08-30 18:43:38 +0000283 return "Unknown option";
284 break;
Wanlong Gao354ebb42012-12-07 10:10:04 +0800285 case ':': /* Missing Arg */
nstraz94181082000-08-30 18:43:38 +0000286 return "Missing argument";
287 break;
Wanlong Gao354ebb42012-12-07 10:10:04 +0800288 case 'i': /* Iterations */
nstraz94181082000-08-30 18:43:38 +0000289 options |= OPT_iteration;
290 STD_LOOP_COUNT = atoi(optarg);
Wanlong Gao354ebb42012-12-07 10:10:04 +0800291 if (STD_LOOP_COUNT == 0)
292 STD_INFINITE = 1;
nstraz94181082000-08-30 18:43:38 +0000293 break;
Wanlong Gao354ebb42012-12-07 10:10:04 +0800294 case 'P': /* Delay between iterations */
nstraz94181082000-08-30 18:43:38 +0000295 options |= OPT_delay;
296 STD_LOOP_DELAY = atof(optarg);
297 break;
Wanlong Gao354ebb42012-12-07 10:10:04 +0800298 case 'I': /* Time duration */
nstraz94181082000-08-30 18:43:38 +0000299 options |= OPT_duration;
300 STD_LOOP_DURATION = atof(optarg);
Wanlong Gao354ebb42012-12-07 10:10:04 +0800301 if (STD_LOOP_DURATION == 0.0)
302 STD_INFINITE = 1;
nstraz94181082000-08-30 18:43:38 +0000303 break;
Wanlong Gao354ebb42012-12-07 10:10:04 +0800304 case 'c': /* Copies */
Cyril Hrubis2ef059e2012-02-02 15:53:07 +0100305 fprintf(stderr,
Wanlong Gao354ebb42012-12-07 10:10:04 +0800306 "WARNING * WARNING * WARNING * WARNING * "
307 "WARNING * WARNING * WARNING * WARNING\n\n"
308 "The -c option is broken by desing. See:\n\n"
309 "http://www.mail-archive.com/"
310 "ltp-list@lists.sourceforge.net/msg13418.html\n"
311 "\nIn short don't use it in runtest files "
312 "as the option will be removed.\n\n"
Cyril Hrubis2ef059e2012-02-02 15:53:07 +0100313 "WARNING * WARNING * WARNING * WARNING * "
314 "WARNING * WARNING * WARNING * WARNING\n\n");
nstraz94181082000-08-30 18:43:38 +0000315 options |= OPT_copies;
316 STD_COPIES = atoi(optarg);
317 break;
Wanlong Gao354ebb42012-12-07 10:10:04 +0800318 case 'f': /* Functional testing */
nstraz94181082000-08-30 18:43:38 +0000319 STD_FUNCTIONAL_TEST = 0;
320 break;
Wanlong Gao354ebb42012-12-07 10:10:04 +0800321 case 'p': /* Pause for SIGUSR1 */
nstraz94181082000-08-30 18:43:38 +0000322 STD_PAUSE = 1;
323 break;
Wanlong Gao354ebb42012-12-07 10:10:04 +0800324 case 't': /* syscall timing */
nstraz94181082000-08-30 18:43:38 +0000325 STD_TIMING_ON = 1;
326 break;
Wanlong Gao354ebb42012-12-07 10:10:04 +0800327 case 'e': /* errno loggin */
nstraz94181082000-08-30 18:43:38 +0000328 STD_ERRNO_LOG = 1;
329 break;
Wanlong Gao354ebb42012-12-07 10:10:04 +0800330 case 'h': /* Help */
nstraz94181082000-08-30 18:43:38 +0000331 print_help(uhf);
332 exit(0);
333 break;
robbiewd34d5812005-07-11 22:28:09 +0000334#ifdef UCLINUX
Wanlong Gao354ebb42012-12-07 10:10:04 +0800335 case 'C': /* Run child */
robbiewd34d5812005-07-11 22:28:09 +0000336 child_args = optarg;
337 break;
338#endif
nstraz94181082000-08-30 18:43:38 +0000339 default:
vapier45a8ba02009-07-20 10:59:32 +0000340
Wanlong Gao354ebb42012-12-07 10:10:04 +0800341 /* Check all the user specified options */
342 found = 0;
343 for (i = 0; user_optarr[i].option; ++i) {
alaffincc2e5552000-07-27 17:13:18 +0000344
Wanlong Gao354ebb42012-12-07 10:10:04 +0800345 if (opt == user_optarr[i].option[0]) {
346 /* Yup, This is a user option, set the flag and look for argument */
347 if (user_optarr[i].flag) {
348 *user_optarr[i].flag = 1;
349 }
350 found++;
alaffincc2e5552000-07-27 17:13:18 +0000351
Wanlong Gao354ebb42012-12-07 10:10:04 +0800352 /* save the argument at the user's location */
353 if (user_optarr[i].
354 option[strlen(user_optarr[i].option)
355 - 1] == ':') {
356 *user_optarr[i].arg = optarg;
357 }
358 break; /* option found - break out of the for loop */
359 }
360 }
361 /* This condition "should never happen". SO CHECK FOR IT!!!! */
362 if (!found) {
363 sprintf(Mesg2,
364 "parse_opts: ERROR - option:\"%c\" NOT FOUND... INTERNAL "
365 "ERROR", opt);
366 return (Mesg2);
367 }
368 }
369
370 } /* end of while */
371 free(optionstr);
372
373 STD_argind = optind;
374
375 /*
376 * Turn on debug
377 */
Cyril Hrubis8dc262a2013-06-04 19:12:59 +0200378 if (getenv("USC_DEBUG") != NULL) {
Wanlong Gao354ebb42012-12-07 10:10:04 +0800379 Debug = 1;
380 printf("env USC_DEBUG is defined, turning on debug\n");
381 }
Cyril Hrubis8dc262a2013-06-04 19:12:59 +0200382 if (getenv("USC_VERBOSE") != NULL) {
Wanlong Gao354ebb42012-12-07 10:10:04 +0800383 Debug = 1;
384 printf("env USC_VERBOSE is defined, turning on debug\n");
alaffincc2e5552000-07-27 17:13:18 +0000385 }
386
Wanlong Gao354ebb42012-12-07 10:10:04 +0800387 /*
388 * If the USC_ITERATION_ENV environmental variable is set to
389 * a number, use that number as iteration count (same as -c option).
390 * The -c option with arg will be used even if this env var is set.
391 */
392 if (!(options & OPT_iteration)
393 && (ptr = getenv(USC_ITERATION_ENV)) != NULL) {
394 if (sscanf(ptr, "%i", &k) == 1) {
395 if (k == 0) { /* if arg is 0, set infinite loop flag */
396 STD_INFINITE = 1;
397 if (Debug)
398 printf
399 ("Using env %s, set STD_INFINITE to 1\n",
400 USC_ITERATION_ENV);
401 } else { /* else, set the loop count to the arguement */
402 STD_LOOP_COUNT = k;
403 if (Debug)
404 printf
405 ("Using env %s, set STD_LOOP_COUNT to %d\n",
406 USC_ITERATION_ENV, k);
407 }
408 }
409 }
alaffincc2e5552000-07-27 17:13:18 +0000410
Wanlong Gao354ebb42012-12-07 10:10:04 +0800411 /*
412 * If the USC_NO_FUNC_CHECK environmental variable is set, we'll
413 * unset the STD_FUNCTIONAL_TEST variable.
414 */
415 if (!(options & OPT_nofunccheck) &&
Cyril Hrubis8dc262a2013-06-04 19:12:59 +0200416 getenv(USC_NO_FUNC_CHECK) != NULL) {
Wanlong Gao354ebb42012-12-07 10:10:04 +0800417 STD_FUNCTIONAL_TEST = 0; /* Turn off functional testing */
Garrett Cooper903910d2010-11-23 09:27:44 -0800418 if (Debug)
Wanlong Gao354ebb42012-12-07 10:10:04 +0800419 printf("Using env %s, set STD_FUNCTIONAL_TEST to 0\n",
420 USC_NO_FUNC_CHECK);
421 }
422
423 /*
424 * If the USC_LOOP_WALLTIME environmental variable is set,
425 * use that number as duration (same as -I option).
426 * The -I option with arg will be used even if this env var is set.
427 */
428
429 if (!(options & OPT_duration) &&
430 (ptr = getenv(USC_LOOP_WALLTIME)) != NULL) {
431 if (sscanf(ptr, "%f", &ftmp) == 1 && ftmp >= 0.0) {
432 STD_LOOP_DURATION = ftmp;
433 if (Debug)
434 printf
435 ("Using env %s, set STD_LOOP_DURATION to %f\n",
436 USC_LOOP_WALLTIME, ftmp);
437 if (STD_LOOP_DURATION == 0.0) { /* if arg is 0, set infinite loop flag */
438 STD_INFINITE = 1;
439 if (Debug)
440 printf
441 ("Using env %s, set STD_INFINITE to 1\n",
442 USC_LOOP_WALLTIME);
443 }
444 }
445 }
446 if (!(options & OPT_duration) && (ptr = getenv("USC_DURATION")) != NULL) {
447 if (sscanf(ptr, "%f", &ftmp) == 1 && ftmp >= 0.0) {
448 STD_LOOP_DURATION = ftmp;
449 if (Debug)
450 printf
451 ("Using env USC_DURATION, set STD_LOOP_DURATION to %f\n",
452 ftmp);
453 if (STD_LOOP_DURATION == 0.0) { /* if arg is 0, set infinite loop flag */
454 STD_INFINITE = 1;
455 if (Debug)
456 printf
457 ("Using env USC_DURATION, set STD_INFINITE to 1\n");
458 }
459 }
460 }
461 /*
462 * If the USC_LOOP_DELAY environmental variable is set,
463 * use that number as delay in factional seconds (same as -P option).
464 * The -P option with arg will be used even if this env var is set.
465 */
466 if (!(options & OPT_delay) && (ptr = getenv(USC_LOOP_DELAY)) != NULL) {
467 if (sscanf(ptr, "%f", &ftmp) == 1 && ftmp >= 0.0) {
468 STD_LOOP_DELAY = ftmp;
469 if (Debug)
470 printf
471 ("Using env %s, set STD_LOOP_DELAY = %f\n",
472 USC_LOOP_DELAY, ftmp);
473 }
474 }
475
476 /*
477 * If the USC_COPIES environmental variable is set,
478 * use that number as copies (same as -c option).
479 * The -c option with arg will be used even if this env var is set.
480 */
481 if (!(options & OPT_copies) && (ptr = getenv(USC_COPIES)) != NULL) {
482 if (sscanf(ptr, "%d", &STD_COPIES) == 1 && STD_COPIES >= 0) {
483 if (Debug)
484 printf("Using env %s, set STD_COPIES = %d\n",
485 USC_COPIES, STD_COPIES);
486 }
487 }
488
489 /*
490 * The following are special system testing envs to turn on special
491 * hooks in the code.
492 */
493 if ((ptr = getenv("USC_TP_BARRIER")) != NULL) {
494 if (sscanf(ptr, "%i", &k) == 1 && k >= 0)
495 STD_TP_barrier = k;
496 else
497 STD_TP_barrier = 1;
Garrett Cooper903910d2010-11-23 09:27:44 -0800498 if (Debug)
Wanlong Gao354ebb42012-12-07 10:10:04 +0800499 printf
500 ("using env USC_TP_BARRIER, Set STD_TP_barrier to %d\n",
501 STD_TP_barrier);
502 }
alaffincc2e5552000-07-27 17:13:18 +0000503
Wanlong Gao354ebb42012-12-07 10:10:04 +0800504 if ((ptr = getenv("USC_LP_BARRIER")) != NULL) {
505 if (sscanf(ptr, "%i", &k) == 1 && k >= 0)
506 STD_LP_barrier = k;
507 else
508 STD_LP_barrier = 1;
509 if (Debug)
510 printf
511 ("using env USC_LP_BARRIER, Set STD_LP_barrier to %d\n",
512 STD_LP_barrier);
513 }
alaffincc2e5552000-07-27 17:13:18 +0000514
Wanlong Gao354ebb42012-12-07 10:10:04 +0800515 if ((ptr = getenv("USC_TP_SHMEM")) != NULL) {
516 if (sscanf(ptr, "%i", &k) == 1 && k >= 0) {
517 STD_TP_shmem_sz = k;
518 if (Debug)
519 printf
520 ("Using env USC_TP_SHMEM, Set STD_TP_shmem_sz to %d\n",
521 STD_TP_shmem_sz);
522 }
523 }
alaffincc2e5552000-07-27 17:13:18 +0000524
Wanlong Gao354ebb42012-12-07 10:10:04 +0800525 if ((ptr = getenv("USC_LP_SHMEM")) != NULL) {
526 if (sscanf(ptr, "%i", &k) == 1 && k >= 0) {
527 STD_LP_shmem = k;
528 if (Debug)
529 printf
530 ("Using env USC_LP_SHMEM, Set STD_LP_shmem to %d\n",
531 STD_LP_shmem);
532 }
533 }
alaffincc2e5552000-07-27 17:13:18 +0000534
Wanlong Gao354ebb42012-12-07 10:10:04 +0800535 if ((ptr = getenv("USC_LD_SHMEM")) != NULL) {
536 if (sscanf(ptr, "%i", &k) == 1 && k >= 0) {
537 STD_LD_shmem = k;
538 if (Debug)
539 printf
540 ("Using env USC_LD_SHMEM, Set STD_LD_shmem to %d\n",
541 STD_LD_shmem);
542 }
543 }
alaffincc2e5552000-07-27 17:13:18 +0000544
Wanlong Gao354ebb42012-12-07 10:10:04 +0800545 if ((ptr = getenv("USC_TP_SBRK")) != NULL) {
546 if (sscanf(ptr, "%i", &k) == 1 && k >= 0) {
547 STD_TP_sbrk = k;
548 if (Debug)
549 printf
550 ("Using env USC_TP_SBRK, Set STD_TP_sbrk to %d\n",
551 STD_TP_sbrk);
552 }
553 }
robbiewd34d5812005-07-11 22:28:09 +0000554#if !defined(UCLINUX)
Wanlong Gao354ebb42012-12-07 10:10:04 +0800555 if ((ptr = getenv("USC_LP_SBRK")) != NULL) {
556 if (sscanf(ptr, "%i", &k) == 1 && k >= 0) {
557 STD_LP_sbrk = k;
558 if (Debug)
559 printf
560 ("Using env USC_LP_SBRK, Set STD_LP_sbrk to %d\n",
561 STD_LP_sbrk);
562 }
563 }
robbiewd34d5812005-07-11 22:28:09 +0000564#endif /* if !defined(UCLINUX) */
alaffincc2e5552000-07-27 17:13:18 +0000565
Wanlong Gao354ebb42012-12-07 10:10:04 +0800566 if ((ptr = getenv("USC_LP_RECFUN")) != NULL) {
567 if (sscanf(ptr, "%i", &k) == 1 && k >= 0) {
568 STD_LP_recfun = k;
569 if (STD_bigstack != NULL)
570 STD_bigstack =
571 malloc(sizeof(struct usc_bigstack_t));
572 if (Debug)
573 printf
574 ("Using env USC_LP_RECFUN, Set STD_LP_recfun to %d\n",
575 STD_LP_recfun);
576 }
577 }
alaffincc2e5552000-07-27 17:13:18 +0000578
Wanlong Gao354ebb42012-12-07 10:10:04 +0800579 if ((ptr = getenv("USC_LD_RECFUN")) != NULL) {
580 if (sscanf(ptr, "%i", &k) == 1 && k >= 0) {
581 STD_LD_recfun = k;
582 if (STD_bigstack != NULL)
583 STD_bigstack =
584 malloc(sizeof(struct usc_bigstack_t));
585 if (Debug)
586 printf
587 ("Using env USC_LD_RECFUN, Set STD_LD_recfun to %d\n",
588 STD_LD_recfun);
589 }
590 }
alaffincc2e5552000-07-27 17:13:18 +0000591#if UNIT_TEST
Wanlong Gao354ebb42012-12-07 10:10:04 +0800592 printf("The following variables after option and env parsing:\n");
593 printf("STD_FUNCTIONAL_TEST = %d\n", STD_FUNCTIONAL_TEST);
594 printf("STD_LOOP_DURATION = %f\n", STD_LOOP_DURATION);
595 printf("STD_LOOP_DELAY = %f\n", STD_LOOP_DELAY);
596 printf("STD_COPIES = %d\n", STD_COPIES);
597 printf("STD_LOOP_COUNT = %d\n", STD_LOOP_COUNT);
598 printf("STD_INFINITE = %d\n", STD_INFINITE);
599 printf("STD_TIMING_ON = %d\n", STD_TIMING_ON);
600 printf("STD_ERRNO_LOG = %d\n", STD_ERRNO_LOG);
601 printf("STD_PAUSE = %d\n", STD_PAUSE);
alaffincc2e5552000-07-27 17:13:18 +0000602#endif
603
Wanlong Gao354ebb42012-12-07 10:10:04 +0800604 return ((char *)NULL);
alaffincc2e5552000-07-27 17:13:18 +0000605
Wanlong Gao354ebb42012-12-07 10:10:04 +0800606} /* end of parse_opts */
alaffincc2e5552000-07-27 17:13:18 +0000607
alaffincc2e5552000-07-27 17:13:18 +0000608/*********************************************************************
nstraz94181082000-08-30 18:43:38 +0000609 * print_help() - print help message and user help message
alaffincc2e5552000-07-27 17:13:18 +0000610 *********************************************************************/
Wanlong Gao354ebb42012-12-07 10:10:04 +0800611void print_help(void (*user_help) ())
alaffincc2e5552000-07-27 17:13:18 +0000612{
Wanlong Gao354ebb42012-12-07 10:10:04 +0800613 STD_opts_help();
alaffincc2e5552000-07-27 17:13:18 +0000614
Wanlong Gao354ebb42012-12-07 10:10:04 +0800615 if (user_help)
616 user_help();
alaffincc2e5552000-07-27 17:13:18 +0000617}
618
619/*********************************************************************
620 * STD_opts_help() - return a help string for the STD_OPTIONS.
621 *********************************************************************/
Cyril Hrubisee75ce32014-02-05 14:05:06 +0100622void STD_opts_help(void)
alaffincc2e5552000-07-27 17:13:18 +0000623{
Wanlong Gao354ebb42012-12-07 10:10:04 +0800624 int i;
alaffincc2e5552000-07-27 17:13:18 +0000625
Wanlong Gao354ebb42012-12-07 10:10:04 +0800626 for (i = 0; std_options[i].optstr; ++i) {
627 if (std_options[i].help)
628 printf("%s", std_options[i].help);
629 }
alaffincc2e5552000-07-27 17:13:18 +0000630}
631
vapier45a8ba02009-07-20 10:59:32 +0000632/*
alaffincc2e5552000-07-27 17:13:18 +0000633 * routine to goto when we get the SIGUSR1 for STD_PAUSE
634 */
Cyril Hrubisee75ce32014-02-05 14:05:06 +0100635void STD_go()
alaffincc2e5552000-07-27 17:13:18 +0000636{
Wanlong Gao354ebb42012-12-07 10:10:04 +0800637 return;
alaffincc2e5552000-07-27 17:13:18 +0000638}
639
640/***********************************************************************
641 * This function will do desired end of global setup test
642 * hooks.
643 * Currently it will only do a pause waiting for sigusr1 if
644 * STD_PAUSE is set.
645 *
646 ***********************************************************************/
Cyril Hrubisee75ce32014-02-05 14:05:06 +0100647int usc_global_setup_hook(void)
alaffincc2e5552000-07-27 17:13:18 +0000648{
robbiewd34d5812005-07-11 22:28:09 +0000649#ifndef UCLINUX
Wanlong Gao354ebb42012-12-07 10:10:04 +0800650 int cnt;
651 /* temp variable to store old signal action to be restored after pause */
652 int (*_TMP_FUNC) (void);
alaffincc2e5552000-07-27 17:13:18 +0000653
Wanlong Gao354ebb42012-12-07 10:10:04 +0800654 /*
655 * Fork STD_COPIES-1 copies.
656 */
657 for (cnt = 1; cnt < STD_COPIES; cnt++) {
658 switch (fork()) {
659 case -1:
660 fprintf(stderr, "%s: fork failed: %d - %s\n",
661 __FILE__, errno, strerror(errno));
662 break;
663 case 0: /* child */
664 cnt = STD_COPIES; /* to stop the forking */
665 break;
alaffincc2e5552000-07-27 17:13:18 +0000666
Wanlong Gao354ebb42012-12-07 10:10:04 +0800667 default: /* parent */
668 break;
669 }
alaffincc2e5552000-07-27 17:13:18 +0000670 }
vapier45a8ba02009-07-20 10:59:32 +0000671
Wanlong Gao354ebb42012-12-07 10:10:04 +0800672 /*
673 * pause waiting for sigusr1.
674 */
675 if (STD_PAUSE) {
676 _TMP_FUNC = (int (*)())signal(SIGUSR1, STD_go);
677 pause();
678 signal(SIGUSR1, (void (*)())_TMP_FUNC);
679 }
robbiewd34d5812005-07-11 22:28:09 +0000680#if !defined(UCLINUX)
alaffincc2e5552000-07-27 17:13:18 +0000681
Wanlong Gao354ebb42012-12-07 10:10:04 +0800682 if (STD_TP_sbrk || STD_LP_sbrk) {
683 STD_start_break = sbrk(0); /* get original sbreak size */
684 }
alaffincc2e5552000-07-27 17:13:18 +0000685
Wanlong Gao354ebb42012-12-07 10:10:04 +0800686 if (STD_TP_sbrk) {
687 sbrk(STD_TP_sbrk);
688 if (Debug)
689 printf("after sbrk(%d)\n", STD_TP_sbrk);
690 }
robbiewd34d5812005-07-11 22:28:09 +0000691#endif /* if !defined(UCLINUX) */
692#endif
Wanlong Gao354ebb42012-12-07 10:10:04 +0800693 return 0;
alaffincc2e5552000-07-27 17:13:18 +0000694}
695
Wanlong Gao354ebb42012-12-07 10:10:04 +0800696#define USECS_PER_SEC 1000000 /* microseconds per second */
alaffincc2e5552000-07-27 17:13:18 +0000697
698/***********************************************************************
Cyril Hrubis4d964f62012-03-07 18:02:37 +0100699 * Returns current time in microseconds since 1970.
alaffincc2e5552000-07-27 17:13:18 +0000700 ***********************************************************************/
Cyril Hrubis4d964f62012-03-07 18:02:37 +0100701static uint64_t get_current_time(void)
alaffincc2e5552000-07-27 17:13:18 +0000702{
Wanlong Gao354ebb42012-12-07 10:10:04 +0800703 struct timeval curtime;
alaffincc2e5552000-07-27 17:13:18 +0000704
Wanlong Gao354ebb42012-12-07 10:10:04 +0800705 gettimeofday(&curtime, NULL);
alaffincc2e5552000-07-27 17:13:18 +0000706
Wanlong Gao354ebb42012-12-07 10:10:04 +0800707 return (((uint64_t) curtime.tv_sec) * USECS_PER_SEC) + curtime.tv_usec;
alaffincc2e5552000-07-27 17:13:18 +0000708}
709
710/***********************************************************************
711 *
712 * This function will determine if test should continue iterating
713 * If the STD_INFINITE flag is set, return 1.
714 * If the STD_LOOP_COUNT variable is set, compare it against
715 * the counter.
716 * If the STD_LOOP_DURATION variable is set, compare current time against
717 * calculated stop_time.
718 * This function will return 1 until all desired looping methods
vapier45a8ba02009-07-20 10:59:32 +0000719 * have been met.
alaffincc2e5552000-07-27 17:13:18 +0000720 *
721 * counter integer is supplied by the user program.
722 ***********************************************************************/
Garrett Cooper8b02c1c2011-01-26 01:34:49 -0800723int usc_test_looping(int counter)
alaffincc2e5552000-07-27 17:13:18 +0000724{
Wanlong Gao354ebb42012-12-07 10:10:04 +0800725 static int first_time = 1;
726 static uint64_t stop_time = 0;
727 static uint64_t delay;
728 uint64_t ct, end;
729 int keepgoing = 0;
alaffincc2e5552000-07-27 17:13:18 +0000730
731 /*
Wanlong Gao354ebb42012-12-07 10:10:04 +0800732 * If this is the first iteration and we are looping for
733 * duration of STD_LOOP_DURATION seconds (fractional) or
734 * doing loop delays, get the clocks per second.
alaffincc2e5552000-07-27 17:13:18 +0000735 */
Wanlong Gao354ebb42012-12-07 10:10:04 +0800736 if (first_time) {
737 first_time = 0;
738
739 /*
740 * If looping for duration, calculate stop time in
741 * clocks.
742 */
743 if (STD_LOOP_DURATION) {
744 stop_time =
745 (uint64_t) (USECS_PER_SEC * STD_LOOP_DURATION)
746 + get_current_time();
747 }
748
749 /*
750 * If doing delay each iteration, calcuate the number
751 * of clocks for each delay.
752 */
753 if (STD_LOOP_DELAY)
754 delay = USECS_PER_SEC * STD_LOOP_DELAY;
alaffincc2e5552000-07-27 17:13:18 +0000755 }
756
757 /*
Wanlong Gao354ebb42012-12-07 10:10:04 +0800758 * if delay each iteration, loop for delay clocks.
759 * This will not be done on first iteration.
760 * The delay will happen before determining if
761 * there will be another iteration.
alaffincc2e5552000-07-27 17:13:18 +0000762 */
Wanlong Gao354ebb42012-12-07 10:10:04 +0800763 else if (STD_LOOP_DELAY) {
764 ct = get_current_time();
765 end = ct + delay;
766 while (ct < end) {
767 /*
768 * The following are special test hooks in the delay loop.
769 */
770 if (STD_LD_recfun) {
771 if (Debug)
772 printf
773 ("calling usc_recressive_func(0, %d, *STD_bigstack)\n",
774 STD_LD_recfun);
775 usc_recressive_func(0, STD_LD_recfun,
776 *STD_bigstack);
777 }
vapier45a8ba02009-07-20 10:59:32 +0000778
Wanlong Gao354ebb42012-12-07 10:10:04 +0800779 ct = get_current_time();
780 }
781 }
782
783 if (STD_INFINITE)
784 keepgoing++;
785
786 if (STD_LOOP_COUNT && counter < STD_LOOP_COUNT)
787 keepgoing++;
788
789 if (STD_LOOP_DURATION != 0.0 && get_current_time() < stop_time)
790 keepgoing++;
791
792 if (keepgoing == 0)
793 return 0;
794
795 /*
796 * The following code allows special system testing hooks.
797 */
798
799 if (STD_LP_recfun) {
Garrett Cooper903910d2010-11-23 09:27:44 -0800800 if (Debug)
Wanlong Gao354ebb42012-12-07 10:10:04 +0800801 printf
802 ("calling usc_recressive_func(0, %d, *STD_bigstack)\n",
803 STD_LP_recfun);
804 usc_recressive_func(0, STD_LP_recfun, *STD_bigstack);
alaffincc2e5552000-07-27 17:13:18 +0000805 }
robbiewd34d5812005-07-11 22:28:09 +0000806#if !defined(UCLINUX)
Wanlong Gao354ebb42012-12-07 10:10:04 +0800807 if (STD_LP_sbrk) {
808 if (Debug)
809 printf("about to do sbrk(%d)\n", STD_LP_sbrk);
810 sbrk(STD_LP_sbrk);
811 }
robbiewd34d5812005-07-11 22:28:09 +0000812#endif
alaffincc2e5552000-07-27 17:13:18 +0000813
Wanlong Gao354ebb42012-12-07 10:10:04 +0800814 if (keepgoing)
815 return 1;
816 else
817 return 0; /* done - stop iterating */
alaffincc2e5552000-07-27 17:13:18 +0000818}
819
alaffincc2e5552000-07-27 17:13:18 +0000820/*
821 * This function recressively calls itself max times.
vapier45a8ba02009-07-20 10:59:32 +0000822 */
Garrett Cooper8b02c1c2011-01-26 01:34:49 -0800823static void usc_recressive_func(int cnt, int max, struct usc_bigstack_t bstack)
alaffincc2e5552000-07-27 17:13:18 +0000824{
Wanlong Gao354ebb42012-12-07 10:10:04 +0800825 if (cnt < max)
826 usc_recressive_func(cnt + 1, max, bstack);
alaffincc2e5552000-07-27 17:13:18 +0000827
828}
829
830#if UNIT_TEST
831/******************************************************************************
832 * UNIT TEST CODE
833 * UNIT TEST CODE
vapier45a8ba02009-07-20 10:59:32 +0000834 *
alaffincc2e5552000-07-27 17:13:18 +0000835 * this following code is provide so that unit testing can
836 * be done fairly easily.
837 ******************************************************************************/
838
839int Help = 0;
840int Help2 = 0;
841char *ptr;
842
843/*
844 * Code from usctest.h that not part of this file since we are the library.
845 */
846
847struct usc_errno_t TEST_VALID_ENO[USC_MAX_ERRNO];
848
Markos Chandrasfd4ada72012-01-03 11:10:37 +0000849long TEST_RETURN;
alaffincc2e5552000-07-27 17:13:18 +0000850int TEST_ERRNO;
851
alaffincc2e5552000-07-27 17:13:18 +0000852/* for test specific parse_opts options */
853option_t Options[] = {
Wanlong Gao354ebb42012-12-07 10:10:04 +0800854 {"help", &Help2, NULL}, /* -help option */
855 {"h", &Help, NULL}, /* -h option */
alaffincc2e5552000-07-27 17:13:18 +0000856
857#if INVALID_TEST_CASES
Wanlong Gao354ebb42012-12-07 10:10:04 +0800858 {"missingflag", NULL, &ptr}, /* error */
859 {"missingarg:", &Help, NULL}, /* error */
860#endif /* INVALID_TEST_CASES */
alaffincc2e5552000-07-27 17:13:18 +0000861
Wanlong Gao354ebb42012-12-07 10:10:04 +0800862 {NULL, NULL, NULL}
alaffincc2e5552000-07-27 17:13:18 +0000863};
864
Garrett Cooper8b02c1c2011-01-26 01:34:49 -0800865int main(int argc, char **argv)
alaffincc2e5552000-07-27 17:13:18 +0000866{
Wanlong Gao354ebb42012-12-07 10:10:04 +0800867 int lc;
868 char *msg;
869 struct timeval t;
870 int cnt;
alaffincc2e5552000-07-27 17:13:18 +0000871
Wanlong Gao354ebb42012-12-07 10:10:04 +0800872 if ((msg = parse_opts(argc, argv, Options, NULL)) != NULL) {
873 printf("ERROR: %s\n", msg);
874 exit(1);
875 }
alaffincc2e5552000-07-27 17:13:18 +0000876
Wanlong Gao354ebb42012-12-07 10:10:04 +0800877 TEST_PAUSE;
alaffincc2e5552000-07-27 17:13:18 +0000878
Wanlong Gao354ebb42012-12-07 10:10:04 +0800879 for (lc = 0; TEST_LOOPING(lc); lc++) {
vapier45a8ba02009-07-20 10:59:32 +0000880
Wanlong Gao354ebb42012-12-07 10:10:04 +0800881 TEST(gettimeofday(&t, NULL));
882 printf("iter=%d: sec:%d, usec:%6.6d %s", lc + 1, t.tv_sec,
883 t.tv_usec, ctime(&t.tv_sec));
884 }
alaffincc2e5552000-07-27 17:13:18 +0000885
Wanlong Gao354ebb42012-12-07 10:10:04 +0800886 TEST_CLEANUP;
alaffincc2e5552000-07-27 17:13:18 +0000887
Wanlong Gao354ebb42012-12-07 10:10:04 +0800888 exit(0);
alaffincc2e5552000-07-27 17:13:18 +0000889}
890
Garrett Cooper8b02c1c2011-01-26 01:34:49 -0800891#endif /* UNIT_TEST */