/*****************************************************************************\ * test33.1.prog.c - standalone program to test route/topology ***************************************************************************** * Copyright (C) 2014 Bull S. A. S. * Bull, Rue Jean Jaures, B.P.68, 78340, Les Clayes-sous-Bois. * * Written by Rod Schultz * * This file is part of Slurm, a resource management program. * For details, see . * Please also read the included file: DISCLAIMER. * * Slurm 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. * * In addition, as a special exception, the copyright holders give permission * to link the code of portions of this program with the OpenSSL library under * certain conditions as described in each individual source file, and * distribute linked combinations including the two. You must obey the GNU * General Public License in all respects for all of the code used other than * OpenSSL. If you modify file(s) with this exception, you may extend this * exception to your version of the file(s), but you are not obligated to do * so. If you do not wish to do so, delete this exception statement from your * version. If you delete this exception statement from all source files in * the program, then also delete it here. * * Slurm 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 Slurm; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. \*****************************************************************************/ #include #include #include #include #include #include #include #include #include #include #include #include #include "slurm/slurm.h" #include "slurm/slurm_errno.h" #include "src/common/hostlist.h" #include "src/common/macros.h" #include "src/common/slurm_route.h" #include "src/common/timers.h" #include "src/common/xmalloc.h" #include "src/common/xstring.h" #define MAX_LINES_IN_TEST 200 #define MAX_LINE 100 typedef struct { char *testcases; char *configdir; int measure; int verbose; } sroutetest_opts_t; static sroutetest_opts_t params; static int _check_params(void); static void _free_options(void); static void _help_msg(void); static void _init_options(void); static int _set_options(const int argc, char **argv); static void _init_opts(void) { memset(¶ms, 0, sizeof(sroutetest_opts_t)); params.measure = 0; params.verbose = 0; } static int _set_options(const int argc, char **argv) { int option_index = 0; int cc; char *next_str = NULL; static struct option long_options[] = { {"configdir", required_argument, 0, 'c'}, {"measure", no_argument, 0, 'm'}, {"testcases", required_argument, 0, 't'}, {"usage", no_argument, 0, 'U'}, {"verbose", no_argument, 0, 'v'}, {0, 0, 0, 0}}; _init_opts(); while ((cc = getopt_long(argc, argv, "cmt:Uv", long_options, &option_index)) != EOF) { switch (cc) { case 'c': params.configdir = xstrdup(optarg); break; case 'm': params.measure++; break; case 't': params.testcases = xstrdup(optarg); break; case 'U': _help_msg(); return -1; break; case 'v': params.verbose++; break; case ':': case '?': /* getopt() has explained it */ return -1; } } return 0; } /* _check_params() */ static int _check_params(void) { char* conf_path; if (params.testcases == NULL) { error("testcases must be specified."); return -1; } if (params.configdir) { setenv("SLURM_CONFIG_DIR",params.configdir,1); conf_path = xstrdup_printf("%s/slurm.conf",params.configdir); setenv("SLURM_CONF",conf_path,1); xfree(conf_path); } return 0; } static void _help_msg(void) { info("\ Usage sroutetest [