Allow setting of a --simulator parameter when running tests.
authoriposva@chromium.org <iposva@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 9 Sep 2008 05:37:00 +0000 (05:37 +0000)
committeriposva@chromium.org <iposva@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 9 Sep 2008 05:37:00 +0000 (05:37 +0000)
Passing "--simulator=arm" has the same effect as setting
"-S simulator=arm --arch=arm" and closely mirrors the behavior
of the scons build causing less confusion when running tests.
Review URL: http://codereview.chromium.org/1654

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@221 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

tools/test.py

index 46cc3c0bff66e9cca3d89525a3f1866f94c2a395..f4e1e54c7d9c272a880d4ae0af76dc4461f44e6b 100755 (executable)
@@ -949,7 +949,9 @@ def BuildOptions():
   result.add_option("-t", "--timeout", help="Timeout in seconds",
       default=60, type="int")
   result.add_option("--arch", help='The architecture to run tests for',
-      default=ARCH_GUESS)
+      default='none')
+  result.add_option("--simulator", help="Run tests with architecture simulator",
+      default='none')
   result.add_option("--special-command", default=None)
   result.add_option("--cat", help="Print the source of the tests",
       default=False, action="store_true")
@@ -964,6 +966,21 @@ def ProcessOptions(options):
     if not mode in ['debug', 'release']:
       print "Unknown mode %s" % mode
       return False
+  if options.simulator != 'none':
+    # Simulator argument was set. Make sure arch and simulator agree.
+    if options.simulator != options.arch:
+      if options.arch == 'none':
+        options.arch = options.simulator
+      else:
+        print "Architecture %s does not match sim %s" %(options.arch, options.simulator)
+        return False
+    # Ensure that the simulator argument is handed down to scons.
+    options.scons_flags.append("simulator=" + options.simulator)
+  else:
+    # If options.arch is not set by the command line and no simulator setting
+    # was found, set the arch to the guess.
+    if options.arch == 'none':
+      options.arch = ARCH_GUESS
   return True