Advertisement
ffilz

pynfs return code patch

Jul 29th, 2016
346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.64 KB | None | 0 0
  1. diff --git a/nfs4.0/testserver.py b/nfs4.0/testserver.py
  2. index 6eb8509..fd3e6e7 100755
  3. --- a/nfs4.0/testserver.py
  4. +++ b/nfs4.0/testserver.py
  5. @@ -229,6 +229,7 @@ def printflags(list):
  6.              print s
  7.      
  8.  def main():
  9. +    nfail = -1
  10.      p = OptionParser("%prog SERVER:/PATH [options] flags|testcodes\n"
  11.                       "       %prog --help\n"
  12.                       "       %prog SHOWOPTION",
  13. @@ -362,18 +363,22 @@ def main():
  14.          if opt.outfile is not None:
  15.              pickle.dump(tests, fd, 0)
  16.          if not clean_finish:
  17. -            testmod.printresults(tests, opt)
  18. +            nfail = testmod.printresults(tests, opt)
  19.      try:
  20.          fail = False
  21.          env.finish()
  22.      except Exception, e:
  23.          fail = True
  24. -    testmod.printresults(tests, opt)
  25. +    nfail = testmod.printresults(tests, opt)
  26.      if fail:
  27.          print "\nWARNING: could not clean testdir due to:\n%s\n" % str(e)
  28.  
  29.      if opt.xmlout is not None:
  30.          testmod.xml_printresults(tests, opt.xmlout)
  31. +    if nfail < 0:
  32. +        sys.exit(3)
  33. +    if nfail > 0:
  34. +        sys.exit(2)
  35.  
  36.  if __name__ == "__main__":
  37.      main()
  38. diff --git a/nfs4.1/testmod.py b/nfs4.1/testmod.py
  39. index 6f114ae..ce25974 100644
  40. --- a/nfs4.1/testmod.py
  41. +++ b/nfs4.1/testmod.py
  42. @@ -457,6 +457,7 @@ def printresults(tests, opts, file=None):
  43.                (sum(count[SKIP:]), len(tests))
  44.      print >> file, "Of those: %i Skipped, %i Failed, %i Warned, %i Passed" % \
  45.            (count[SKIP], count[FAIL], count[WARN], count[PASS])
  46. +    return count[FAIL]
  47.  
  48.  def xml_printresults(tests, file_name, suite='all'):
  49.      with open(file_name, 'w') as fd:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement