From 132a6ea835dbe1d2e3d6082fa52ce69508d63fde Mon Sep 17 00:00:00 2001 From: ericm Date: Mon, 15 Dec 2003 12:03:35 +0000 Subject: [PATCH] liblustre: layout adjustment, move test programs into liblustre/tests --- lustre/liblustre/genlib.sh | 14 +- lustre/liblustre/tests/Makefile.am | 40 +++ lustre/liblustre/tests/echo_test.c | 348 +++++++++++++++++++++ lustre/liblustre/{ => tests}/recovery_small.c | 0 lustre/liblustre/{ => tests}/replay_single.c | 0 lustre/liblustre/tests/sanity.c | 386 ++++++++++++++++++++++++ lustre/liblustre/{ => tests}/test_common.c | 0 lustre/liblustre/{ => tests}/test_common.h | 0 lustre/liblustre/{ => tests}/test_lock_cancel.c | 0 9 files changed, 784 insertions(+), 4 deletions(-) create mode 100644 lustre/liblustre/tests/Makefile.am create mode 100644 lustre/liblustre/tests/echo_test.c rename lustre/liblustre/{ => tests}/recovery_small.c (100%) rename lustre/liblustre/{ => tests}/replay_single.c (100%) mode change 100755 => 100644 create mode 100644 lustre/liblustre/tests/sanity.c rename lustre/liblustre/{ => tests}/test_common.c (100%) rename lustre/liblustre/{ => tests}/test_common.h (100%) rename lustre/liblustre/{ => tests}/test_lock_cancel.c (100%) diff --git a/lustre/liblustre/genlib.sh b/lustre/liblustre/genlib.sh index b78eefd..13d8b85 100755 --- a/lustre/liblustre/genlib.sh +++ b/lustre/liblustre/genlib.sh @@ -8,6 +8,7 @@ AR=/usr/bin/ar LD=/usr/bin/ld +RANLIB=/usr/bin/ranlib CWD=`pwd` @@ -37,18 +38,23 @@ build_obj_list ../portals/utils libuptlctl.a build_obj_list ../portals/unals libtcpnal.a build_obj_list ../portals/portals libportals.a +# create static lib lsupport +rm -f $CWD/liblsupport.a +$AR -cru $CWD/liblsupport.a $ALL_OBJS +$RANLIB $CWD/liblsupport.a + # libsysio components libs build_obj_list $SYSIO/drivers/native libsysio_native.a build_obj_list $SYSIO/drivers/sockets libsysio_sockets.a build_obj_list $SYSIO/src libsysio.a build_obj_list $SYSIO/dev/stdfd libsysio_stdfd.a - -# create static lib +# create static lib lustre rm -f $CWD/liblustre.a -$AR -r $CWD/liblustre.a $ALL_OBJS +$AR -cru $CWD/liblustre.a $ALL_OBJS +$RANLIB $CWD/liblustre.a -# create shared lib +# create shared lib lustre rm -f $CWD/liblustre.so $LD -shared -o $CWD/liblustre.so -init __liblustre_setup_ -fini __liblustre_cleanup_ \ $ALL_OBJS -lpthread diff --git a/lustre/liblustre/tests/Makefile.am b/lustre/liblustre/tests/Makefile.am new file mode 100644 index 0000000..7803665 --- /dev/null +++ b/lustre/liblustre/tests/Makefile.am @@ -0,0 +1,40 @@ +## Liblustre excecutables & libraries Makefile +DEFS= + +CFLAGS := -g -Wall -I$(top_srcdir)/utils -I$(top_srcdir)/portals/include \ + -I$(top_srcdir)/portals/unals -I$(SYSIO)/include \ + -I/opt/lam/include -L/opt/lam/lib + +KFLAGS:= +CPPFLAGS = $(HAVE_EFENCE) -D_LARGEFILE64_SOURCE=1 +LIBS = $(LIBEFENCE) + + +LLIB_EXEC= ../liblustre.a -lpthread + +noinst_LIBRARIES = libtestcommon.a +libtestcommon_a_SOURCES = test_common.c + +bin_PROGRAMS = echo_test sanity recovery_small replay_single #test_lock_cancel + +echo_test_SOURCES = echo_test.c ../../utils/parser.c ../../utils/obd.c ../../utils/lustre_cfg.c +echo_test_LDADD = ../liblsupport.a $(LIBREADLINE) -lpthread +echo_test_DEPENDENCIES=$(top_srcdir)/lov/liblov.a #$(top_srcdir)/liblustre/liblustre.a + +sanity_SOURCES = sanity.c +sanity_LDADD := ./libtestcommon.a $(LLIB_EXEC) +sanity_DEPENDENCIES = $(top_srcdir)/liblustre/liblustre.a + +recovery_small_SOURCES = recovery_small.c +recovery_small_LDADD := ./libtestcommon.a $(LLIB_EXEC) +recovery_small_DEPENDENCIES = $(top_srcdir)/liblustre/liblustre.a + +replay_single_SOURCES = replay_single.c +replay_single_LDADD := ./libtestcommon.a $(LLIB_EXEC) +replay_single_DEPENDENCIES = $(top_srcdir)/liblustre/liblustre.a + +#test_lock_cancel_SOURCES = test_lock_cancel.c +#test_lock_cancel_LDADD := $(LLIB_EXEC) -lmpi -llam + +include $(top_srcdir)/Rules + diff --git a/lustre/liblustre/tests/echo_test.c b/lustre/liblustre/tests/echo_test.c new file mode 100644 index 0000000..773bc0a --- /dev/null +++ b/lustre/liblustre/tests/echo_test.c @@ -0,0 +1,348 @@ +#include +#include +#include +#include + +#include /* needed for ptpctl.h */ +#include /* needed for parse_dump */ + + +#include +#include +#include +#include + +#define LIBLUSTRE_TEST 1 +#include "../utils/lctl.c" + +struct ldlm_namespace; +struct ldlm_res_id; +struct obd_import; + +void *inter_module_get(char *arg) +{ + if (!strcmp(arg, "tcpnal_ni")) + return &tcpnal_ni; + else if (!strcmp(arg, "ldlm_cli_cancel_unused")) + return ldlm_cli_cancel_unused; + else if (!strcmp(arg, "ldlm_namespace_cleanup")) + return ldlm_namespace_cleanup; + else if (!strcmp(arg, "ldlm_replay_locks")) + return ldlm_replay_locks; + else + return NULL; +} + +/* XXX move to proper place */ +char *portals_nid2str(int nal, ptl_nid_t nid, char *str) +{ + switch(nal){ + case TCPNAL: + /* userspace NAL */ + case SOCKNAL: + sprintf(str, "%u:%d.%d.%d.%d", (__u32)(nid >> 32), + HIPQUAD(nid)); + break; + case QSWNAL: + case GMNAL: + case IBNAL: + case TOENAL: + case SCIMACNAL: + sprintf(str, "%u:%u", (__u32)(nid >> 32), (__u32)nid); + break; + default: + return NULL; + } + return str; +} + +ptl_handle_ni_t tcpnal_ni; + +struct pingcli_args { + ptl_nid_t mynid; + ptl_nid_t nid; + ptl_pid_t port; + int count; + int size; +}; + +struct task_struct *current; + +struct obd_class_user_state ocus; + +/* portals interfaces */ +ptl_handle_ni_t * +kportal_get_ni (int nal) +{ + switch (nal) + { + case SOCKNAL: + return &tcpnal_ni; + default: + return NULL; + } +} + +inline void +kportal_put_ni (int nal) +{ + return; +} + +int +kportal_nal_cmd(struct portals_cfg *pcfg) +{ +#if 0 + __u32 nal = pcfg->pcfg_nal; + int rc = -EINVAL; + + ENTRY; + + down(&nal_cmd_sem); + if (nal > 0 && nal <= NAL_MAX_NR && nal_cmd[nal].nch_handler) { + CDEBUG(D_IOCTL, "calling handler nal: %d, cmd: %d\n", nal, + pcfg->pcfg_command); + rc = nal_cmd[nal].nch_handler(pcfg, nal_cmd[nal].nch_private); + } + up(&nal_cmd_sem); + RETURN(rc); +#else + CERROR("empty function!!!\n"); + return 0; +#endif +} + +int init_current(int argc, char **argv) +{ + current = malloc(sizeof(*current)); + strncpy(current->comm, argv[0], sizeof(current->comm)); + current->pid = getpid(); + return 0; +} + +ptl_nid_t tcpnal_mynid; + +int init_lib_portals() +{ + int rc; + + PtlInit(); + rc = PtlNIInit(procbridge_interface, 0, 0, 0, &tcpnal_ni); + if (rc != 0) { + CERROR("ksocknal: PtlNIInit failed: error %d\n", rc); + PtlFini(); + RETURN (rc); + } + PtlNIDebug(tcpnal_ni, ~0); + return rc; +} + +extern int class_handle_ioctl(struct obd_class_user_state *ocus, unsigned int cmd, unsigned long arg); + +int liblustre_ioctl(int dev_id, int opc, void *ptr) +{ + int rc = -EINVAL; + + switch (dev_id) { + default: + fprintf(stderr, "Unexpected device id %d\n", dev_id); + abort(); + break; + + case OBD_DEV_ID: + rc = class_handle_ioctl(&ocus, opc, (unsigned long)ptr); + break; + } + + return rc; +} + +static void generate_random_uuid(unsigned char uuid_out[16]) +{ + int *arr = (int*)uuid_out; + int i; + + for (i = 0; i < sizeof(uuid_out)/sizeof(int); i++) + arr[i] = rand(); +} + +static char *echo_server_nid = NULL; +static char *echo_server_ostname="obd1"; + +static int connect_echo_client() { + struct lustre_cfg lcfg; + ptl_nid_t nid; + char *peer = "ECHO_PEER_NID"; + char *osc_dev_name = "OSC_DEV_NAME"; + char *echo_dev_name = "ECHO_CLIENT_DEV_NAME"; + class_uuid_t osc_uuid, echo_uuid; + struct obd_uuid osc_uuid_str, echo_uuid_str; + struct obd_ioctl_data ioctl; + int nal, err; + ENTRY; + + generate_random_uuid(osc_uuid); + class_uuid_unparse(osc_uuid, &osc_uuid_str); + generate_random_uuid(echo_uuid); + class_uuid_unparse(echo_uuid, &echo_uuid_str); + + if (ptl_parse_nid(&nid, echo_server_nid)) { + CERROR("Can't parse NID %s\n", echo_server_nid); + RETURN(-EINVAL); + } + nal = ptl_name2nal("tcp"); + if (nal <= 0) { + CERROR("Can't parse NAL tcp\n"); + RETURN(-EINVAL); + } + + /* add uuid */ + LCFG_INIT(lcfg, LCFG_ADD_UUID, NULL); + lcfg.lcfg_nid = nid; + lcfg.lcfg_inllen1 = strlen(peer) + 1; + lcfg.lcfg_inlbuf1 = peer; + lcfg.lcfg_nal = nal; + err = class_process_config(&lcfg); + if (err < 0) { + CERROR("failed add_uuid\n"); + RETURN(-EINVAL); + } + + /* attach osc */ + LCFG_INIT(lcfg, LCFG_ATTACH, osc_dev_name); + lcfg.lcfg_inlbuf1 = "osc"; + lcfg.lcfg_inllen1 = strlen(lcfg.lcfg_inlbuf1) + 1; + lcfg.lcfg_inlbuf2 = osc_uuid_str.uuid; + lcfg.lcfg_inllen2 = strlen(lcfg.lcfg_inlbuf2) + 1; + err = class_process_config(&lcfg); + if (err < 0) { + CERROR("failed attach osc\n"); + RETURN(-EINVAL); + } + + /* setup osc */ + LCFG_INIT(lcfg, LCFG_SETUP, osc_dev_name); + lcfg.lcfg_inlbuf1 = echo_server_ostname; + lcfg.lcfg_inllen1 = strlen(lcfg.lcfg_inlbuf1) + 1; + lcfg.lcfg_inlbuf2 = peer; + lcfg.lcfg_inllen2 = strlen(lcfg.lcfg_inlbuf2) + 1; + err = class_process_config(&lcfg); + if (err < 0) { + CERROR("failed setup osc\n"); + RETURN(-EINVAL); + } + + /* attach echo_client */ + LCFG_INIT(lcfg, LCFG_ATTACH, echo_dev_name); + lcfg.lcfg_inlbuf1 = "echo_client"; + lcfg.lcfg_inllen1 = strlen(lcfg.lcfg_inlbuf1) + 1; + lcfg.lcfg_inlbuf2 = echo_uuid_str.uuid; + lcfg.lcfg_inllen2 = strlen(lcfg.lcfg_inlbuf2) + 1; + err = class_process_config(&lcfg); + if (err < 0) { + CERROR("failed attach echo_client\n"); + RETURN(-EINVAL); + } + + /* setup echo_client */ + LCFG_INIT(lcfg, LCFG_SETUP, echo_dev_name); + lcfg.lcfg_inlbuf1 = osc_dev_name; + lcfg.lcfg_inllen1 = strlen(lcfg.lcfg_inlbuf1) + 1; + lcfg.lcfg_inlbuf2 = NULL; + lcfg.lcfg_inllen2 = 0; + err = class_process_config(&lcfg); + if (err < 0) { + CERROR("failed setup echo_client\n"); + RETURN(-EINVAL); + } + + /* select echo_client as current device */ + ocus.ocus_current_obd = class_name2obd(echo_dev_name); + if (ocus.ocus_current_obd == NULL) { + CERROR("can't find device %s\n", echo_dev_name); + RETURN(-EINVAL); + } + + /* connect echo_client to echo server */ + memset(&ioctl, 0, sizeof(ioctl)); + + ioctl.ioc_version = OBD_IOCTL_VERSION; + ioctl.ioc_len = obd_ioctl_packlen(&ioctl); + ioctl.ioc_cookie = 0x65522767; + ioctl.ioc_dev = OBD_DEV_ID; + ioctl.ioc_command = OBD_IOC_CONNECT; + + if (class_handle_ioctl(&ocus, OBD_IOC_CONNECT, (unsigned long)&ioctl)) { + CERROR("cannot connect to %s: rc = %d\n", + echo_server_ostname, err); + RETURN(-EINVAL); + } + + RETURN(0); +} + +static void usage(const char *s) +{ + printf("Usage: %s -s ost_host_name [-n ost_name]\n", s); + printf(" ost_host_name: the host name of echo server\n"); + printf(" ost_name: ost name, default is \"obd1\"\n"); +} + +extern int time_ptlwait1; +extern int time_ptlwait2; +extern int time_ptlselect; + +int main(int argc, char **argv) +{ + int c; + + while ((c = getopt(argc, argv, "s:n:")) != -1) { + switch (c) { + case 's': + echo_server_nid = optarg; + break; + case 'n': + echo_server_ostname = optarg; + break; + default: + usage(argv[0]); + return 1; + } + } + + if (optind != argc) + usage(argv[0]); + + if (!echo_server_nid) { + usage(argv[0]); + return 1; + } + + srand(time(NULL)); + + INIT_LIST_HEAD(&ocus.ocus_conns); + tcpnal_mynid = rand(); +#if 1 + portal_debug = 0; + portal_subsystem_debug = 0; +#endif + + if (init_current(argc, argv) || + init_obdclass() || init_lib_portals() || + ptlrpc_init() || + ldlm_init() || + mdc_init() || + lov_init() || + osc_init() || + echo_client_init()) { + printf("error\n"); + return 1; + } + + if (connect_echo_client()) + return 1; + + set_ioc_handler(liblustre_ioctl); + + return lctl_main(1, &argv[0]); +} diff --git a/lustre/liblustre/recovery_small.c b/lustre/liblustre/tests/recovery_small.c similarity index 100% rename from lustre/liblustre/recovery_small.c rename to lustre/liblustre/tests/recovery_small.c diff --git a/lustre/liblustre/replay_single.c b/lustre/liblustre/tests/replay_single.c old mode 100755 new mode 100644 similarity index 100% rename from lustre/liblustre/replay_single.c rename to lustre/liblustre/tests/replay_single.c diff --git a/lustre/liblustre/tests/sanity.c b/lustre/liblustre/tests/sanity.c new file mode 100644 index 0000000..62af498 --- /dev/null +++ b/lustre/liblustre/tests/sanity.c @@ -0,0 +1,386 @@ +/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- + * vim:expandtab:shiftwidth=8:tabstop=8: + * + * Lustre Light user test program + * + * Copyright (c) 2002, 2003 Cluster File Systems, Inc. + * + * This file is part of Lustre, http://www.lustre.org. + * + * Lustre is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * Lustre 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 Lustre; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#define _BSD_SOURCE + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "test_common.h" + +#define ENTRY(str) \ + do { \ + char buf[100]; \ + int len; \ + sprintf(buf, "===== START: %s ", (str)); \ + len = strlen(buf); \ + if (len < 79) { \ + memset(buf+len, '=', 100-len); \ + buf[79] = '\n'; \ + buf[80] = 0; \ + } \ + printf("%s", buf); \ + } while (0) + +#define LEAVE() \ + do { \ + printf("----- END TEST successfully ---"); \ + printf("-----------------------------"); \ + printf("-------------------\n"); \ + } while (0) + +void t1() +{ + char *path="/mnt/lustre/test_t1"; + ENTRY("create/delete"); + + t_touch(path); + t_unlink(path); + LEAVE(); +} + +void t2() +{ + char *path="/mnt/lustre/test_t2"; + ENTRY("mkdir/rmdir"); + + t_mkdir(path); + t_rmdir(path); + LEAVE(); +} + +void t3() +{ + char *path="/mnt/lustre/test_t3"; + ENTRY("regular stat"); + + t_touch(path); + t_check_stat(path, NULL); + t_unlink(path); + LEAVE(); +} + +void t4() +{ + char *path="/mnt/lustre/test_t4"; + ENTRY("dir stat"); + + t_mkdir(path); + t_check_stat(path, NULL); + t_rmdir(path); + LEAVE(); +} + +#define PAGE_SIZE (4096) +#define _npages (512) + +static int _buffer[_npages][PAGE_SIZE/sizeof(int)]; + +/* pos: i/o start from + * xfer: npages per transfer + */ +static void pages_io(int xfer, loff_t pos) +{ + char *path="/mnt/lustre/test_t5"; + int check_sum[_npages] = {0,}; + int fd, rc, i, j; + + memset(_buffer, 0, sizeof(_buffer)); + + /* create sample data */ + for (i = 0; i < _npages; i++) { + for (j = 0; j < PAGE_SIZE/sizeof(int); j++) { + _buffer[i][j] = rand(); + } + } + + /* compute checksum */ + for (i = 0; i < _npages; i++) { + for (j = 0; j < PAGE_SIZE/sizeof(int); j++) { + check_sum[i] += _buffer[i][j]; + } + } + + t_touch(path); + + fd = t_open(path); + + /* write */ + lseek(fd, pos, SEEK_SET); + for (i = 0; i < _npages; i += xfer) { + rc = write(fd, _buffer[i], PAGE_SIZE * xfer); + if (rc != PAGE_SIZE * xfer) { + printf("write error %d (i = %d)\n", rc, i); + exit(1); + } + } + printf("succefully write %d pages\n", _npages); + + memset(_buffer, 0, sizeof(_buffer)); + + /* read */ + lseek(fd, pos, SEEK_SET); + for (i = 0; i < _npages; i += xfer) { + rc = read(fd, _buffer[i], PAGE_SIZE * xfer); + if (rc != PAGE_SIZE * xfer) { + printf("read error %d (i = %d)\n", rc, i); + exit(1); + } + } + printf("succefully read %d pages\n", _npages); + + /* compute checksum */ + for (i = 0; i < _npages; i++) { + int sum = 0; + for (j = 0; j < PAGE_SIZE/sizeof(int); j++) { + sum += _buffer[i][j]; + } + if (sum != check_sum[i]) { + printf("chunk %d checksum error: expected 0x%x, get 0x%x\n", + i, check_sum[i], sum); + } + } + printf("checksum verified OK!\n"); + + t_close(fd); + t_unlink(path); +} + +void t5() +{ + char text[256]; + loff_t off_array[] = {1, 4, 17, 255, 258, 4095, 4097, 8191, 1024*1024*1024}; + int np = 1, i; + loff_t offset = 0; + + while (np <= _npages) { + sprintf(text, "pages_io: %d per transfer, offset %lld", + np, offset); + ENTRY(text); + pages_io(np, offset); + LEAVE(); + np += np; + } + + for (i = 0; i < sizeof(off_array)/sizeof(loff_t); i++) { + offset = off_array[i]; + sprintf(text, "pages_io: 16 per transfer, offset %lld", + offset); + ENTRY(text); + pages_io(16, offset); + LEAVE(); + } +} + +void t6() +{ + char *path="/mnt/lustre/test_t6"; + char *path2="/mnt/lustre/test_t6_link"; + ENTRY("symlink"); + + t_touch(path); + t_symlink(path, path2); + t_check_stat(path2, NULL); + t_unlink(path2); + t_unlink(path); + LEAVE(); +} + +void t7() +{ + char *path="/mnt/lustre/test_t7"; + ENTRY("mknod"); + + t_mknod(path, S_IFCHR | 0644, 5, 4); + t_check_stat(path, NULL); + t_unlink(path); + LEAVE(); +} + +void t8() +{ + char *path="/mnt/lustre/test_t8"; + ENTRY("chmod"); + + t_touch(path); + t_chmod_raw(path, 0700); + t_check_stat(path, NULL); + t_unlink(path); + LEAVE(); +} + +void t9() +{ + char *path="/mnt/lustre/test_t9"; + char *path2="/mnt/lustre/test_t9_link"; + ENTRY("hard link"); + + t_touch(path); + t_link(path, path2); + t_check_stat(path, NULL); + t_check_stat(path2, NULL); + t_unlink(path); + t_unlink(path2); + LEAVE(); +} + +void t10() +{ + char *dir1="/mnt/lustre/test_t10_dir1"; + char *dir2="/mnt/lustre/test_t10_dir2"; + char *path1="/mnt/lustre/test_t10_reg1"; + char *path2="/mnt/lustre/test_t10_reg2"; + char *rename1="/mnt/lustre/test_t10_dir1/rename1"; + char *rename2="/mnt/lustre/test_t10_dir2/rename2"; + char *rename3="/mnt/lustre/test_t10_dir2/rename3"; + ENTRY("rename"); + + t_mkdir(dir1); + t_mkdir(dir2); + t_touch(path1); + t_touch(path2); + t_rename(path1, rename1); + t_rename(path2, rename2); + t_rename(rename1, rename2); + t_rename(dir1, rename3); + t_unlink(rename2); + t_rmdir(rename3); + t_rmdir(dir2); + LEAVE(); +} + +void t100() +{ + char *base="/mnt/lustre"; + char path[4096], path2[4096]; + int i, j, level = 5, nreg = 5; + ENTRY("deep tree"); + + strcpy(path, base); + + for (i = 0; i < level; i++) { + for (j = 0; j < nreg; j++) { + sprintf(path2, "%s/file%d", path, j); + t_touch(path2); + } + + strcat(path, "/dir"); + t_mkdir(path); + } + + for (i = level; i > 0; i--) { + strcpy(path, base); + for (j = 1; j < i; j++) + strcat(path, "/dir"); + + for (j = 0; j < nreg; j++) { + sprintf(path2, "%s/file%d", path, j); + t_unlink(path2); + } + + strcat(path, "/dir"); + t_rmdir(path); + } + + LEAVE(); +} + +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 * const argv[]) +{ + int opt_index, c; + static struct option long_opts[] = { + {"target", 1, 0, 0}, + {"dumpfile", 1, 0, 0}, + {0, 0, 0, 0} + }; + + if (argc <= 1) + usage(argv[0]); + + while ((c = getopt_long(argc, argv, "", long_opts, &opt_index)) != -1) { + switch (c) { + case 0: { + printf("optindex %d\n", opt_index); + 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_(); + +#ifndef __CYGWIN__ + t1(); + t2(); + t3(); + t4(); + t5(); + t6(); + t7(); + t8(); + t9(); + t10(); + + t100(); +#endif + + printf("liblustre is about shutdown\n"); + __liblustre_cleanup_(); + + printf("complete successfully\n"); + return 0; +} diff --git a/lustre/liblustre/test_common.c b/lustre/liblustre/tests/test_common.c similarity index 100% rename from lustre/liblustre/test_common.c rename to lustre/liblustre/tests/test_common.c diff --git a/lustre/liblustre/test_common.h b/lustre/liblustre/tests/test_common.h similarity index 100% rename from lustre/liblustre/test_common.h rename to lustre/liblustre/tests/test_common.h diff --git a/lustre/liblustre/test_lock_cancel.c b/lustre/liblustre/tests/test_lock_cancel.c similarity index 100% rename from lustre/liblustre/test_lock_cancel.c rename to lustre/liblustre/tests/test_lock_cancel.c -- 1.8.3.1