tests: check for gem5 binary before tests
authorCurtis Dunham <Curtis.Dunham@arm.com>
Tue, 14 Feb 2017 21:09:18 +0000 (15:09 -0600)
committerCurtis Dunham <Curtis.Dunham@arm.com>
Tue, 14 Feb 2017 21:09:18 +0000 (15:09 -0600)
Provides a helpful error when tests.py is invoked without the gem5 binary.

Before:
Running 0 tests

After:
gem5 binary 'quick/...' not an executable file

Change-Id: I1566802206c9e21ca89bd03e91db22844168a085
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
tests/tests.py

index 136c879aa41c9173b2cb8b9e3172c3af509622b3..3f6ed0a7a5fbccbbd9351c10e668ff13b8b337e5 100755 (executable)
@@ -174,6 +174,11 @@ def _run_tests_args(subparsers):
     _add_format_args(parser)
 
 def _run_tests(args):
+    if not os.path.isfile(args.gem5) or not os.access(args.gem5, os.X_OK):
+        print >> sys.stderr, \
+            "gem5 binary '%s' not an executable file" % args.gem5
+        sys.exit(2)
+
     formatter = _create_formatter(args)
 
     out_base = os.path.abspath(args.directory)