From bd9fc1bc05ee0b2593af237df3040678cfe132c1 Mon Sep 17 00:00:00 2001 From: ericm Date: Tue, 18 Nov 2003 08:58:34 +0000 Subject: [PATCH] liblustre: fix test_lock_cancel for zeroconf. --- lustre/liblustre/test_lock_cancel.c | 47 +++++++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/lustre/liblustre/test_lock_cancel.c b/lustre/liblustre/test_lock_cancel.c index 0b38a4f..9350e4c 100644 --- a/lustre/liblustre/test_lock_cancel.c +++ b/lustre/liblustre/test_lock_cancel.c @@ -37,6 +37,8 @@ #include #include +#include + #include /******************************************************************************/ @@ -69,17 +71,53 @@ int numTasks = 0, /* MPI variables */ static char *test_file_name = "/mnt/lustre/test_lock_cancel"; -extern int portal_debug; -extern int portal_subsystem_debug; extern void __liblustre_setup_(void); extern void __liblustre_cleanup_(void); +void usage(char *cmd) +{ + printf("Usage: \t%s --target mdsnid:/mdsname/profile\n", cmd); + printf(" \t%s --dumpfile dumpfile\n", cmd); + exit(-1); +} + int main(int argc, char *argv[]) { + int opt_index, c; + static struct option long_opts[] = { + {"target", 1, 0, 0}, + {"dumpfile", 1, 0, 0}, + {0, 0, 0, 0} + }; int fd; long time1, time2; struct stat statbuf; + if (argc < 3) + usage(argv[0]); + + while ((c = getopt_long(argc, argv, "", long_opts, &opt_index)) != -1) { + switch (c) { + case 0: { + if (!optarg[0]) + usage(argv[0]); + + if (!strcmp(long_opts[opt_index].name, "target")) { + setenv(ENV_LUSTRE_MNTTGT, optarg, 1); + } else if (!strcmp(long_opts[opt_index].name, "dumpfile")) { + setenv(ENV_LUSTRE_DUMPFILE, optarg, 1); + } else + usage(argv[0]); + break; + } + default: + usage(argv[0]); + } + } + + if (optind != argc) + usage(argv[0]); + __liblustre_setup_(); MPI_CHECK(MPI_Init(&argc, &argv), "MPI_Init()"); @@ -91,11 +129,6 @@ int main(int argc, char *argv[]) goto cleanup; } -#if 1 - portal_debug = 0; - portal_subsystem_debug = 0; -#endif - if (rank == 0) { unlink(test_file_name); } -- 1.8.3.1