2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License, Version 1.0 only
2N/A * (the "License"). You may not use this file except in compliance
2N/A * with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright (c) 1996-1998 by Sun Microsystems, Inc.
2N/A * All rights reserved.
2N/A */
2N/A
2N/A#pragma ident "%Z%%M% %I% %E% SMI"
2N/A
2N/A#include <stddef.h>
2N/A#include <stdlib.h>
2N/A#include <sys/param.h>
2N/A#include <config_admin.h>
2N/A#include <memory.h>
2N/A#include "mema_test.h"
2N/A
2N/Aextern mtest_func_t memory_test_normal;
2N/Aextern mtest_func_t memory_test_quick;
2N/Aextern mtest_func_t memory_test_extended;
2N/A
2N/A/*
2N/A * Default test is first entry in the table (MTEST_DEFAULT_TEST).
2N/A */
2N/Astruct mtest_table_ent mtest_table[] = {
2N/A {"normal", memory_test_normal},
2N/A {"quick", memory_test_quick},
2N/A {"extended", memory_test_extended},
2N/A};
2N/A
2N/Astatic char **opt_array;
2N/A
2N/Achar **
2N/Amtest_build_opts(int *maxerr_idx)
2N/A{
2N/A if (opt_array == NULL) {
2N/A int nopts;
2N/A /*
2N/A * Test "type" options here, max_errors should be the
2N/A * last one.
2N/A */
2N/A nopts = sizeof (mtest_table) / sizeof (mtest_table[0]);
2N/A *maxerr_idx = nopts;
2N/A
2N/A /*
2N/A * One extra option for "max_errors"
2N/A */
2N/A opt_array = (char **)malloc((nopts + 2) * sizeof (*opt_array));
2N/A if (opt_array != NULL) {
2N/A int i;
2N/A
2N/A for (i = 0; i < nopts; i++)
2N/A opt_array[i] = (char *)mtest_table[i].test_name;
2N/A
2N/A opt_array[nopts] = "max_errors";
2N/A opt_array[nopts + 1] = NULL;
2N/A }
2N/A }
2N/A *maxerr_idx = sizeof (mtest_table) / sizeof (mtest_table[0]);
2N/A return (opt_array);
2N/A}