From: José Fonseca Date: Sat, 28 May 2011 10:50:22 +0000 (+0100) Subject: Better error message when invoked without parameters. X-Git-Url: https://git.cworth.org/git?p=apitrace-tests;a=commitdiff_plain;h=04cbf83295e1a64253945959db8116f5339f73e7 Better error message when invoked without parameters. --- diff --git a/mesademos.py b/mesademos.py index 2f6ef3d..0ef5bfb 100755 --- a/mesademos.py +++ b/mesademos.py @@ -683,18 +683,22 @@ def main(): '--build', metavar='PATH', type='string', dest='build', default='.', help='path to apitrace build') - optparser.add_option( '--mesa-demos', metavar='PATH', type='string', dest='mesa_demos', default=os.environ.get('MESA_DEMOS'), - help='path to mesa demos') + help='path to Mesa demos') (options, args) = optparser.parse_args(sys.argv[1:]) - if args: - tests = args - for test in tests: - runtest(test) + if not options.mesa_demos: + optparser.error('path to Mesa demos not specified') + + if args: + for test in args: + runtest(test) + else: + for test in tests: + runtest(test) if __name__ == '__main__':