comparison Plugins/WSI/Run.py @ 252:01db33301c3d

valgrind
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 02 Aug 2019 16:12:39 +0200
parents 16a5e79accff
children 74c693e093ce
comparison
equal deleted inserted replaced
251:16a5e79accff 252:01db33301c3d
58 default = '/home/jodogne/Subversion/orthanc-wsi/Applications/i/OrthancWSIDicomizer', 58 default = '/home/jodogne/Subversion/orthanc-wsi/Applications/i/OrthancWSIDicomizer',
59 help = 'Password to the REST API') 59 help = 'Password to the REST API')
60 parser.add_argument('--to-tiff', 60 parser.add_argument('--to-tiff',
61 default = '/home/jodogne/Subversion/orthanc-wsi/Applications/i/OrthancWSIDicomToTiff', 61 default = '/home/jodogne/Subversion/orthanc-wsi/Applications/i/OrthancWSIDicomToTiff',
62 help = 'Password to the REST API') 62 help = 'Password to the REST API')
63 parser.add_argument('--valgrind', help = 'Use valgrind while running the DICOM-izer',
64 action = 'store_true')
63 parser.add_argument('--force', help = 'Do not warn the user', 65 parser.add_argument('--force', help = 'Do not warn the user',
64 action = 'store_true') 66 action = 'store_true')
65 parser.add_argument('options', metavar = 'N', nargs = '*', 67 parser.add_argument('options', metavar = 'N', nargs = '*',
66 help='Arguments to Python unittest') 68 help='Arguments to Python unittest')
67 69
88 ORTHANC = DefineOrthanc(server = args.server, 90 ORTHANC = DefineOrthanc(server = args.server,
89 username = args.username, 91 username = args.username,
90 password = args.password, 92 password = args.password,
91 restPort = args.rest) 93 restPort = args.rest)
92 94
93 def CallDicomizer(p): 95 def CallDicomizer(suffix):
94 subprocess.check_output([ args.dicomizer, 96 prefix = []
95 '--username=%s' % args.username, 97 if args.valgrind:
96 '--password=%s' % args.password ] + p, 98 prefix = [ 'valgrind' ]
97 stderr=subprocess.STDOUT) 99
100 log = subprocess.check_output(prefix + [ args.dicomizer,
101 '--username=%s' % args.username,
102 '--password=%s' % args.password ] + suffix,
103 stderr=subprocess.STDOUT)
104
105 # If using valgrind, only print the lines from the log starting
106 # with '==' (they contain the report from valgrind)
107 if args.valgrind:
108 print('\n'.join(filter(lambda x: x.startswith('=='), log.splitlines())))
98 109
99 110
100 class Orthanc(unittest.TestCase): 111 class Orthanc(unittest.TestCase):
101 def setUp(self): 112 def setUp(self):
102 if (sys.version_info >= (3, 0)): 113 if (sys.version_info >= (3, 0)):