-/* Solaris Porting Layer Aggressive Test (SPLAT) userspace interface */
+/*****************************************************************************\
+ * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
+ * Copyright (C) 2007 The Regents of the University of California.
+ * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
+ * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
+ * UCRL-CODE-235197
+ *
+ * This file is part of the SPL, Solaris Porting Layer.
+ * For details, see <http://zfsonlinux.org/>.
+ *
+ * The SPL is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * The SPL is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with the SPL. If not, see <http://www.gnu.org/licenses/>.
+ *****************************************************************************
+ * Solaris Porting LAyer Tests (SPLAT) User Space Interface.
+\*****************************************************************************/
#include <stdlib.h>
#include <stddef.h>
rc = ioctl(splatctl_fd, SPLAT_CFG, cfg);
if (rc) {
- fprintf(stderr, "Ioctl() error %lu / %d: %d\n",
- (unsigned long) SPLAT_CFG, cfg->cfg_cmd, errno);
+ fprintf(stderr, "Ioctl() error 0x%lx / %d: %d\n",
+ (unsigned long)SPLAT_CFG, cfg->cfg_cmd, errno);
free(cfg);
return rc;
}
size = cfg->cfg_rc1;
free(cfg);
- /* Based on the newly aquired number of subsystems allocate enough
+ /* Based on the newly acquired number of subsystems allocate
* memory to get the descriptive information for them all. */
cfg_size = sizeof(*cfg) + size * sizeof(splat_user_t);
cfg = (splat_cfg_t *)malloc(cfg_size);
return 0;
}
-/* XXX - Commented out until we sort the lists */
-#if 0
-static int subsystem_compare(const void *l_arg, const void *r_arg, void *private)
-{
- const subsystem_t *l = l_arg;
- const subsystem_t *r = r_arg;
-
- if (l->sub_desc.id > r->sub_desc.id)
- return 1;
-
- if (l->sub_desc.id < r->sub_desc.id)
- return -1;
-
- return 0;
-}
-#endif
-
static void subsystem_list(List l, int indent)
{
ListIterator i;
/* Based on the newly aquired number of tests allocate enough
* memory to get the descriptive information for them all. */
- cfg = (splat_cfg_t *)malloc(sizeof(*cfg) + size * sizeof(splat_user_t));
+ cfg = (splat_cfg_t *)malloc(sizeof(*cfg) + size*sizeof(splat_user_t));
if (cfg == NULL)
return -ENOMEM;
return 0;
}
-/* XXX - Commented out until we sort the lists */
-#if 0
-static int test_compare(const void *l_arg, const void *r_arg, void *private)
-{
- const test_t *l = l_arg;
- const test_t *r = r_arg;
-
- if (l->test_desc.id > r->test_desc.id)
- return 1;
-
- if (l->test_desc.id < r->test_desc.id)
- return -1;
-
- return 0;
-}
-#endif
-
static test_t *test_copy(test_t *test)
{
return test_init(test->test_sub, &test->test_desc);
i = list_iterator_create(l);
while ((test = list_next(i)))
- fprintf(stdout, "%*s0x%0*x %-*s %-*s\n",
- indent, "",
- 04, test->test_desc.id,
+ fprintf(stdout, "%*s0x%0*x %-*s %s\n",
+ indent, "", 04, test->test_desc.id,
SPLAT_NAME_SIZE, test->test_desc.name,
- SPLAT_DESC_SIZE, test->test_desc.desc);
+ test->test_desc.desc);
list_iterator_destroy(i);
}
ListIterator si, ti;
subsystem_t *sub;
test_t *test;
- int sub_num, test_num;
+ __u32 sub_num, test_num;
- /* No error checking here because it may not be a number, it's
+ /*
+ * No error checking here because it may not be a number, it's
* perfectly OK for it to be a string. Since we're just using
* it for comparison purposes this is all very safe.
*/
- sub_num = strtol(sub_str, NULL, 0);
- test_num = strtol(test_str, NULL, 0);
+ sub_num = strtoul(sub_str, NULL, 0);
+ test_num = strtoul(test_str, NULL, 0);
si = list_iterator_create(subsystems);
while ((test = list_next(ti))) {
if (!strncmp(test->test_desc.name, test_str,
- SPLAT_NAME_SIZE) || test->test_desc.id == test_num) {
+ SPLAT_NAME_SIZE) || test->test_desc.id==test_num) {
list_iterator_destroy(ti);
list_iterator_destroy(si);
return test;
fflush(stdout);
free(cmd);
- if (args->args_verbose) {
- if ((rc = read(splatctl_fd, splat_buffer, splat_buffer_size - 1)) < 0) {
+ if ((args->args_verbose == 1 && rc) ||
+ (args->args_verbose >= 2)) {
+ if ((rc = read(splatctl_fd, splat_buffer,
+ splat_buffer_size - 1)) < 0) {
fprintf(stdout, "Error reading results: %d\n", rc);
} else {
fprintf(stdout, "\n%s\n", splat_buffer);
if (!strncasecmp(sub_str, "all", strlen(sub_str)) || (sub_num == -1))
sub_all = 1;
- if (!strncasecmp(test_str, "all", strlen(test_str)) || (test_num == -1))
+ if (!strncasecmp(test_str,"all",strlen(test_str)) || (test_num == -1))
test_all = 1;
si = list_iterator_create(subsystems);
} else {
/* Add a specific test from all subsystems */
while ((s = list_next(si))) {
- if ((t = test_find(s->sub_desc.name,test_str))) {
+ if ((t=test_find(s->sub_desc.name,test_str))) {
if ((rc = test_add(args, t)))
goto error_run;
fini();
return rc;
}
-