def main(): p = OptionParser( "%prog SERVER:/PATH [options] flags|testcodes\n" " %prog --help\n" " %prog SHOWOPTION", version="%prog " + VERSION, formatter=IndentedHelpFormatter(2, 25)) opt, args = scan_options(p) nfs4lib.SHOW_TRAFFIC = opt.showtraffic # Create test database tests, fdict, cdict = testmod.createtests('servertests') # Deal with any informational options if opt.showflags: printflags(fdict.keys()) sys.exit(0) if opt.showcodes: codes = cdict.keys() codes.sort() for c in codes: print c sys.exit(0) # Grab server info and set defaults if not args: p.error("Need a server") url = args.pop(0) opt.server, opt.port, opt.path = parse_url(url) if not opt.server: p.error("%s not a valid server name" % url) if not opt.port: opt.port = 2049 else: opt.port = int(opt.port) if not opt.path: opt.path = [] else: opt.path = unixpath2comps(opt.path) # Check --use* options are valid for attr in dir(opt): if attr.startswith('use') and attr != "usefh": path = getattr(opt, attr) #print attr, path if path is None: path = opt.path + ['tree', attr[3:]] else: # FIXME - have funct that checks path validity if path[0] != '/': p.error("Need to use absolute path for --%s" % attr) # print path if path[-1] == '/' and attr != 'usedir': p.error("Can't use dir for --%s" % attr) try: path = unixpath2comps(path) except Exception, e: p.error(e) setattr(opt, attr, [comp for comp in path if comp])
def main(): p = OptionParser("%prog SERVER:/PATH [options] flags|testcodes\n" " %prog --help\n" " %prog SHOWOPTION", version="%prog "+VERSION, formatter=IndentedHelpFormatter(2, 25) ) opt, args = scan_options(p) nfs4lib.SHOW_TRAFFIC = opt.showtraffic # Create test database tests, fdict, cdict = testmod.createtests('servertests') # Deal with any informational options if opt.showflags: printflags(fdict.keys()) sys.exit(0) if opt.showcodes: codes = cdict.keys() codes.sort() for c in codes: print c sys.exit(0) # Grab server info and set defaults if not args: p.error("Need a server") url = args.pop(0) opt.server, opt.port, opt.path = parse_url(url) if not opt.server: p.error("%s not a valid server name" % url) if not opt.port: opt.port = 2049 else: opt.port = int(opt.port) if not opt.path: opt.path = [] else: opt.path = unixpath2comps(opt.path) # Check --use* options are valid for attr in dir(opt): if attr.startswith('use') and attr != "usefh": path = getattr(opt, attr) #print attr, path if path is None: path = opt.path + ['tree', attr[3:]] else: # FIXME - have funct that checks path validity if path[0] != '/': p.error("Need to use absolute path for --%s" % attr) # print path if path[-1] == '/' and attr != 'usedir': p.error("Can't use dir for --%s" %attr) try: path = unixpath2comps(path) except Exception, e: p.error(e) setattr(opt, attr, [comp for comp in path if comp])
def main(): p = OptionParser( "%prog SERVER:/PATH [options] flags|testcodes\n" " %prog --help\n" " %prog SHOWOPTION", formatter=IndentedHelpFormatter(2, 25)) opt, args = scan_options(p) # Create test database tests, fdict, cdict = testmod.createtests('client41tests') # Deal with any informational options if opt.showflags: printflags(fdict.keys()) sys.exit(0) if opt.showcodes: codes = cdict.keys() codes.sort() for c in codes: print c sys.exit(0) # Grab server info and set defaults if not args: p.error("Need a server") url = args.pop(0) print "url", url opt.path = nfs4lib.path_components(url) print "Set opt.path", opt.path # Check --use* options are valid for attr in dir(opt): if attr == 'useparams': opt.useparams = parse_useparams(opt.useparams) elif attr.startswith('use') and attr != "usefh": path = getattr(opt, attr) #print attr, path if path is None: path = opt.path + ['tree', attr[3:]] else: # FIXME - have funct that checks path validity if path[0] != '/': p.error("Need to use absolute path for --%s" % attr) # print path if path[-1] == '/' and attr != 'usedir': p.error("Can't use dir for --%s" % attr) try: path = nfs4lib.path_components(path) except Exception, e: p.error(e) setattr(opt, attr, [comp for comp in path if comp])
def main(): p = OptionParser("%prog SERVER:/PATH [options] flags|testcodes\n" " %prog --help\n" " %prog SHOWOPTION", formatter=IndentedHelpFormatter(2, 25) ) opt, args = scan_options(p) # Create test database tests, fdict, cdict = testmod.createtests('client41tests') # Deal with any informational options if opt.showflags: printflags(fdict.keys()) sys.exit(0) if opt.showcodes: codes = cdict.keys() codes.sort() for c in codes: print c sys.exit(0) # Grab server info and set defaults if not args: p.error("Need a server") url = args.pop(0) print "url", url opt.path = nfs4lib.path_components(url) print "Set opt.path", opt.path # Check --use* options are valid for attr in dir(opt): if attr == 'useparams': opt.useparams = parse_useparams(opt.useparams) elif attr.startswith('use') and attr != "usefh": path = getattr(opt, attr) #print attr, path if path is None: path = opt.path + ['tree', attr[3:]] else: # FIXME - have funct that checks path validity if path[0] != '/': p.error("Need to use absolute path for --%s" % attr) # print path if path[-1] == '/' and attr != 'usedir': p.error("Can't use dir for --%s" %attr) try: path = nfs4lib.path_components(path) except Exception, e: p.error(e) setattr(opt, attr, [comp for comp in path if comp])
def main(): p = OptionParser( "%prog SERVER:/PATH [options] flags|testcodes\n" " %prog --help\n" " %prog SHOWOPTION", version="%prog " + VERSION, formatter=IndentedHelpFormatter(2, 25)) opt, args = scan_options(p) environment.nfs4client.SHOW_TRAFFIC = opt.showtraffic # Create test database tests, fdict, cdict = testmod.createtests('server41tests') # Deal with any informational options if opt.showflags: printflags(fdict.keys()) sys.exit(0) if opt.showcodes: codes = cdict.keys() codes.sort() for c in codes: print(c) sys.exit(0) if opt.showcodesflags: codes = cdict.keys() codes.sort() for c in codes: print(c, "FLAGS:", ', '.join(cdict[c].flags_list)) sys.exit(0) # Grab server info and set defaults if not args: p.error("Need a server") url = args.pop(0) server_list, opt.path = nfs4lib.parse_nfs_url(url) if not server_list: p.error("%s not a valid server name" % url) opt.server, opt.port = server_list[0] if not args: p.error("No tests given") # Check --use* options are valid for attr in dir(opt): if attr.startswith('use') and attr != "usefh": path = getattr(opt, attr) #print(attr, path) if path is None: path = opt.path + ['tree', attr[3:]] else: # FIXME - have funct that checks path validity if path[0] != '/': p.error("Need to use absolute path for --%s" % attr) # print(path) if path[-1] == '/' and attr != 'usedir': p.error("Can't use dir for --%s" % attr) try: path = nfs4lib.path_components(path) except Exception as e: p.error(e) setattr(opt, attr, [comp for comp in path if comp]) # Check that --security option is valid # FIXME STUB tempd = { 'none': (rpc.AUTH_NONE, 0), 'sys': (rpc.AUTH_SYS, 0), 'krb5': (rpc.RPCSEC_GSS, 1), 'krb5i': (rpc.RPCSEC_GSS, 2), 'krb5p': (rpc.RPCSEC_GSS, 3), } if opt.security not in tempd: p.error("Unknown security: %s\nValid flavors are %s" % (opt.security, str(tempd.keys()))) # flavor has changed from class to int opt.flavor, opt.service = tempd[opt.security] if opt.flavor not in rpc.security.supported: if opt.flavor == rpc.RPCSEC_GSS: p.error("RPCSEC_GSS not supported," " could not find compile gssapi module") else: p.error("Unsupported security flavor") # Make sure args are valid opt.args = [] for a in args: if a.lower().startswith('no'): include = False a = a[2:] else: include = True if a in fdict: opt.args.append(Argtype(fdict[a], include)) elif a in cdict: opt.args.append(Argtype(cdict[a], include, flag=False)) else: p.error("Unknown code or flag: %s" % a) # DEBUGGING environment.debug_fail = opt.debug_fail # Place tests in desired order tests.sort() # FIXME - add options for random sort # Run the tests and save/print(results) try: env = environment.Environment(opt) env.init() except socket.gaierror as e: if e.args[0] == -2: print("Unknown server '%s'" % opt.server) print(sys.exc_info()[1]) sys.exit(1) except Exception as e: print("Initialization failed, no tests run.") if not opt.maketree: print("Perhaps you need to use the --maketree option") raise print(sys.exc_info()[1]) sys.exit(1) if opt.outfile is not None: fd = open(opt.outfile, 'w') try: clean_finish = False testmod.runtests(tests, opt, env, run_filter) clean_finish = True finally: if opt.outfile is not None: pickle.dump(tests, fd, 0) if not clean_finish: testmod.printresults(tests, opt) try: fail = False env.finish() except Exception as e: fail = True testmod.printresults(tests, opt) if fail: print("\nWARNING: could not clean testdir due to:\n%s\n" % str(e)) if opt.xmlout is not None: testmod.xml_printresults(tests, opt.xmlout)
def main(): nfail = -1 p = OptionParser( "%prog SERVER:/PATH [options] flags|testcodes\n" " %prog --help\n" " %prog SHOWOPTION", version="%prog " + VERSION, formatter=IndentedHelpFormatter(2, 25)) opt, args = scan_options(p) nfs4lib.SHOW_TRAFFIC = opt.showtraffic # Create test database tests, fdict, cdict = testmod.createtests('servertests') # Deal with any informational options if opt.showflags: printflags(fdict.keys()) sys.exit(0) if opt.showcodes: codes = cdict.keys() codes.sort() for c in codes: print(c) sys.exit(0) if opt.showcodesflags: codes = cdict.keys() codes.sort() for c in codes: print(c, "FLAGS:", ', '.join(cdict[c].flags_list)) sys.exit(0) # Grab server info and set defaults if not args: p.error("Need a server") url = args.pop(0) server_list, opt.path = nfs4lib.parse_nfs_url(url) if not server_list: p.error("%s not a valid server name" % url) opt.server, opt.port = server_list[0] if not opt.port: opt.port = 2049 else: opt.port = int(opt.port) if not opt.path: opt.path = [] else: opt.path = unixpath2comps(opt.path) # Check --use* options are valid for attr in dir(opt): if attr.startswith('use') and attr != "usefh": path = getattr(opt, attr) #print(attr, path) if path is None: path = opt.path + ['tree', attr[3:]] else: # FIXME - have funct that checks path validity if path[0] != '/': p.error("Need to use absolute path for --%s" % attr) # print(path) if path[-1] == '/' and attr != 'usedir': p.error("Can't use dir for --%s" % attr) try: path = unixpath2comps(path) except Exception as e: p.error(e) setattr(opt, attr, [comp for comp in path if comp]) opt.path += ['tmp'] # Check that --security option is valid # sets --flavor to a rpc.SecAuth* class, and sets flags for its options valid = rpc.supported.copy() # FIXME - STUB - the only gss mech available is krb5 if 'gss' in valid: valid['krb5'] = valid['krb5i'] = valid['krb5p'] = valid['gss'] del valid['gss'] if opt.security not in valid: p.error("Unknown security: %s\nValid flavors are %s" % (opt.security, str(valid.keys()))) opt.flavor = valid[opt.security] opt.service = {'krb5': 1, 'krb5i': 2, 'krb5p': 3}.get(opt.security, 0) # Make sure args are valid opt.args = [] for a in args: if a.lower().startswith('no'): include = False a = a[2:] else: include = True if a in fdict: opt.args.append(Argtype(fdict[a], include)) elif a in cdict: opt.args.append(Argtype(cdict[a], include, flag=False)) else: p.error("Unknown code or flag: %s" % a) # DEBUGGING environment.debug_fail = opt.debug_fail # Place tests in desired order tests.sort() # FIXME - add options for random sort # Run the tests and save/print(results) try: env = environment.Environment(opt) env.init() except socket.gaierror as e: if e.args[0] == -2: print("Unknown server '%s'" % opt.server) print(sys.exc_info()[1]) sys.exit(1) except Exception as e: print("Initialization failed, no tests run.") if not opt.maketree: print("Perhaps you need to use the --maketree option") raise print(sys.exc_info()[1]) sys.exit(1) if opt.outfile is not None: fd = open(opt.outfile, 'w') try: clean_finish = False testmod.runtests(tests, opt, env, run_filter) clean_finish = True finally: if opt.outfile is not None: pickle.dump(tests, fd, 0) if not clean_finish: nfail = testmod.printresults(tests, opt) try: fail = False env.finish() except Exception as e: fail = True nfail = testmod.printresults(tests, opt) if fail: print("\nWARNING: could not clean testdir due to:\n%s\n" % str(e)) if opt.xmlout is not None: testmod.xml_printresults(tests, opt.xmlout) if nfail < 0: sys.exit(3) if nfail > 0: sys.exit(2)
def main(): p = OptionParser("%prog SERVER:/PATH [options] flags|testcodes\n" " %prog --help\n" " %prog SHOWOPTION", formatter=IndentedHelpFormatter(2, 25) ) opt, args = scan_options(p) # Create test database tests, fdict, cdict = testmod.createtests('client41tests') # Deal with any informational options if opt.showflags: printflags(fdict.keys()) sys.exit(0) if opt.showcodes: codes = cdict.keys() codes.sort() for c in codes: print(c) sys.exit(0) # Grab server info and set defaults if not args: p.error("Need a server") url = args.pop(0) print("url", url) opt.path = nfs4lib.path_components(url) print("Set opt.path", opt.path) # Check --use* options are valid for attr in dir(opt): if attr == 'useparams': opt.useparams = parse_useparams(opt.useparams) elif attr.startswith('use') and attr != "usefh": path = getattr(opt, attr) #print(attr, path) if path is None: path = opt.path + ['tree', attr[3:]] else: # FIXME - have funct that checks path validity if path[0] != '/': p.error("Need to use absolute path for --%s" % attr) # print(path) if path[-1] == '/' and attr != 'usedir': p.error("Can't use dir for --%s" %attr) try: path = nfs4lib.path_components(path) except Exception as e: p.error(e) setattr(opt, attr, [comp for comp in path if comp]) #opt.path += ['tmp'] ## # Check that --security option is valid ## # sets --flavor to a rpc.SecAuth* class, and sets flags for its options ## valid = rpc.supported.copy() ## # FIXME - STUB - the only gss mech available is krb5 ## if 'gss' in valid: ## valid['krb5'] = valid['krb5i'] = valid['krb5p'] = valid['gss'] ## del valid['gss'] ## if opt.security not in valid: ## p.error("Unknown security: %s\nValid flavors are %s" % ## (opt.security, str(valid.keys()))) ## opt.flavor = valid[opt.security] ## opt.service = {'krb5':1, 'krb5i':2, 'krb5p':3}.get(opt.security, 0) # Make sure args are valid opt.args = [] for a in args: if a.lower().startswith('no'): include = False a = a[2:] else: include = True if a in fdict: opt.args.append(Argtype(fdict[a], include)) elif a in cdict: opt.args.append(Argtype(cdict[a], include, flag=False)) else: p.error("Unknown code or flag: %s" % a) # DEBUGGING environment.debug_fail = opt.debug_fail # Place tests in desired order tests.sort() # FIXME - add options for random sort # Run the tests and save/print(results) try: env = environment.Environment(opt) env.init() except socket.gaierror as e: if e.args[0] == -2: print("Unknown server '%s'" % opt.server) sys.exit(1) except Exception as e: print("Initialization failed, no tests run.") if not opt.maketree: print("Perhaps you need to use the --maketree option") raise print(sys.exc_info()[1]) sys.exit(1) if opt.outfile is not None: fd = open(opt.outfile, 'w') try: clean_finish = False testmod.runtests(tests, opt, env, run_filter) clean_finish = True finally: if opt.outfile is not None: pickle.dump(tests, fd, 0) if not clean_finish: testmod.printresults(tests, opt) try: fail = False env.finish() except Exception as e: fail = True testmod.printresults(tests, opt) if fail: print("\nWARNING: could not clean testdir due to:\n%s\n" % str(e))
def main(): p = OptionParser( "%prog SERVER:/PATH [options] flags|testcodes\n" " %prog --help\n" " %prog SHOWOPTION", version="%prog " + VERSION, formatter=IndentedHelpFormatter(2, 25)) opt, args = scan_options(p) failures = 0 # Check that NFS version is valid valid = ["3", "4"] if opt.nfsvers not in valid: p.error("Unknown NFS version: %s\nValid versions are " % opt.nfsvers + str(valid)) # Create test database and select environment-specific options testdirs = list() if opt.nfsvers == '3': testdirs.append('nfs3.servertests') environment3.debug_fail = opt.debug_fail elif opt.nfsvers == '4': testdirs.append('nfs4.servertests') environment.debug_fail = opt.debug_fail else: p.error("Invalid configuration: nfsvers=%s" % opt.nfsvers) tests, fdict, cdict = testmod.createtests(testdirs) # Deal with any informational options if opt.showflags: printflags(fdict.keys()) sys.exit(0) if opt.showcodes: codes = cdict.keys() codes.sort() for c in codes: print c sys.exit(0) # Grab server info and set defaults if not args: p.error("Need a server") url = args.pop(0) if opt.ipv6: opt.server, opt.port, opt.path = parse_ipv6_url(url) else: opt.server, opt.port, opt.path = parse_url(url) if not opt.server: p.error("%s not a valid server name" % url) if not opt.port: opt.port = 2049 else: opt.port = int(opt.port) if not opt.path: opt.path = [] else: opt.path = unixpath2comps(opt.path) # Check --use* options are valid for attr in dir(opt): if attr.startswith('use') and attr != "usefh": path = getattr(opt, attr) #print attr, path if path is None: path = opt.path + ['tree', attr[3:]] else: # FIXME - have funct that checks path validity if path[0] != '/': p.error("Need to use absolute path for --%s" % attr) # print path if path[-1] == '/' and attr != 'usedir': p.error("Can't use dir for --%s" % attr) try: path = unixpath2comps(path) except Exception, e: p.error(e) setattr(opt, attr, [comp for comp in path if comp])
def main(): p = OptionParser("%prog SERVER:/PATH [options] flags|testcodes\n" " %prog --help\n" " %prog SHOWOPTION", version="%prog "+VERSION, formatter=IndentedHelpFormatter(2, 25) ) opt, args = scan_options(p) environment.nfs4client.SHOW_TRAFFIC = opt.showtraffic # Create test database tests, fdict, cdict = testmod.createtests('server41tests') # Deal with any informational options if opt.showflags: printflags(fdict.keys()) sys.exit(0) if opt.showcodes: codes = cdict.keys() codes.sort() for c in codes: print(c) sys.exit(0) if opt.showcodesflags: codes = cdict.keys() codes.sort() for c in codes: print(c, "FLAGS:", ', '.join(cdict[c].flags_list)) sys.exit(0) # Grab server info and set defaults if not args: p.error("Need a server") url = args.pop(0) server_list, opt.path = nfs4lib.parse_nfs_url(url) if not server_list: p.error("%s not a valid server name" % url) opt.server, opt.port = server_list[0] if not args: p.error("No tests given") # Check --use* options are valid for attr in dir(opt): if attr.startswith('use') and attr != "usefh": path = getattr(opt, attr) #print(attr, path) if path is None: path = opt.path + ['tree', attr[3:]] else: # FIXME - have funct that checks path validity if path[0] != '/': p.error("Need to use absolute path for --%s" % attr) # print(path) if path[-1] == '/' and attr != 'usedir': p.error("Can't use dir for --%s" %attr) try: path = nfs4lib.path_components(path) except Exception as e: p.error(e) setattr(opt, attr, [comp for comp in path if comp]) # Check that --security option is valid # FIXME STUB tempd = {'none' : (rpc.AUTH_NONE, 0), 'sys' : (rpc.AUTH_SYS, 0), 'krb5' : (rpc.RPCSEC_GSS, 1), 'krb5i': (rpc.RPCSEC_GSS, 2), 'krb5p': (rpc.RPCSEC_GSS, 3), } if opt.security not in tempd: p.error("Unknown security: %s\nValid flavors are %s" % (opt.security, str(tempd.keys()))) # flavor has changed from class to int opt.flavor, opt.service = tempd[opt.security] if opt.flavor not in rpc.security.supported: if opt.flavor == rpc.RPCSEC_GSS: p.error("RPCSEC_GSS not supported," " could not find compile gssapi module") else: p.error("Unsupported security flavor") # Make sure args are valid opt.args = [] for a in args: if a.lower().startswith('no'): include = False a = a[2:] else: include = True if a in fdict: opt.args.append(Argtype(fdict[a], include)) elif a in cdict: opt.args.append(Argtype(cdict[a], include, flag=False)) else: p.error("Unknown code or flag: %s" % a) # DEBUGGING environment.debug_fail = opt.debug_fail # Place tests in desired order tests.sort() # FIXME - add options for random sort # Run the tests and save/print(results) try: env = environment.Environment(opt) env.init() except socket.gaierror as e: if e.args[0] == -2: print("Unknown server '%s'" % opt.server) print(sys.exc_info()[1]) sys.exit(1) except Exception as e: print("Initialization failed, no tests run.") if not opt.maketree: print("Perhaps you need to use the --maketree option") raise print(sys.exc_info()[1]) sys.exit(1) if opt.outfile is not None: fd = open(opt.outfile, 'w') try: clean_finish = False testmod.runtests(tests, opt, env, run_filter) clean_finish = True finally: if opt.outfile is not None: pickle.dump(tests, fd, 0) if not clean_finish: testmod.printresults(tests, opt) try: fail = False env.finish() except Exception as e: fail = True testmod.printresults(tests, opt) if fail: print("\nWARNING: could not clean testdir due to:\n%s\n" % str(e)) if opt.xmlout is not None: testmod.xml_printresults(tests, opt.xmlout)
def main(): p = OptionParser("%prog SERVER:/PATH [options] flags|testcodes\n" " %prog --help\n" " %prog SHOWOPTION", version="%prog "+VERSION, formatter=IndentedHelpFormatter(2, 25) ) opt, args = scan_options(p) failures = 0 # Check that NFS version is valid valid = ["3", "4"] if opt.nfsvers not in valid: p.error("Unknown NFS version: %s\nValid versions are " % opt.nfsvers + str(valid)) # Create test database and select environment-specific options testdirs = list() if opt.nfsvers == '3': testdirs.append('nfs3.servertests') environment3.debug_fail = opt.debug_fail elif opt.nfsvers == '4': testdirs.append('nfs4.servertests') environment.debug_fail = opt.debug_fail else: p.error("Invalid configuration: nfsvers=%s" % opt.nfsvers) tests, fdict, cdict = testmod.createtests(testdirs) # Deal with any informational options if opt.showflags: printflags(fdict.keys()) sys.exit(0) if opt.showcodes: codes = cdict.keys() codes.sort() for c in codes: print c sys.exit(0) # Grab server info and set defaults if not args: p.error("Need a server") url = args.pop(0) if opt.ipv6: opt.server, opt.port, opt.path = parse_ipv6_url(url) else: opt.server, opt.port, opt.path = parse_url(url) if not opt.server: p.error("%s not a valid server name" % url) if not opt.port: opt.port = 2049 else: opt.port = int(opt.port) if not opt.path: opt.path = [] else: opt.path = unixpath2comps(opt.path) # Check --use* options are valid for attr in dir(opt): if attr.startswith('use') and attr != "usefh": path = getattr(opt, attr) #print attr, path if path is None: path = opt.path + ['tree', attr[3:]] else: # FIXME - have funct that checks path validity if path[0] != '/': p.error("Need to use absolute path for --%s" % attr) # print path if path[-1] == '/' and attr != 'usedir': p.error("Can't use dir for --%s" %attr) try: path = unixpath2comps(path) except Exception, e: p.error(e) setattr(opt, attr, [comp for comp in path if comp])