- Added test status spec to cctests to make arm simulator tests run.
authorchristian.plesner.hansen@gmail.com <christian.plesner.hansen@gmail.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 2 Sep 2008 15:20:38 +0000 (15:20 +0000)
committerchristian.plesner.hansen@gmail.com <christian.plesner.hansen@gmail.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 2 Sep 2008 15:20:38 +0000 (15:20 +0000)
- Added test script option to override platform guess (again, to be
  able to run arm sim tests on intel).

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

SConstruct
test/cctest/cctest.status [new file with mode: 0644]
test/cctest/testcfg.py
tools/test.py
tools/utils.py

index 6bb23ce..34f20d3 100644 (file)
@@ -32,7 +32,7 @@ import os
 from os.path import join, dirname, abspath
 root_dir = dirname(File('SConstruct').rfile().abspath)
 sys.path.append(join(root_dir, 'tools'))
-import js2c
+import js2c, utils
 
 
 LIBRARY_FLAGS = {
@@ -223,16 +223,6 @@ def GuessOS():
     return None
 
 
-def GuessArchitecture():
-  id = platform.machine()
-  if id.startswith('arm'):
-    return 'arm'
-  elif (not id) or (not re.match('(x|i[3-6])86', id) is None):
-    return 'ia32'
-  else:
-    return None
-
-
 def GuessWordsize():
   if '64' in platform.machine():
     return '64'
@@ -252,7 +242,7 @@ def GuessToolchain(os):
 
 OS_GUESS = GuessOS()
 TOOLCHAIN_GUESS = GuessToolchain(OS_GUESS)
-ARCH_GUESS = GuessArchitecture()
+ARCH_GUESS = utils.GuessArchitecture()
 WORDSIZE_GUESS = GuessWordsize()
 
 
diff --git a/test/cctest/cctest.status b/test/cctest/cctest.status
new file mode 100644 (file)
index 0000000..b222196
--- /dev/null
@@ -0,0 +1,34 @@
+# Copyright 2008 Google Inc.  All rights reserved.
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+#       notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+#       copyright notice, this list of conditions and the following
+#       disclaimer in the documentation and/or other materials provided
+#       with the distribution.
+#     * Neither the name of Google Inc. nor the names of its
+#       contributors may be used to endorse or promote products derived
+#       from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+prefix cctest
+
+[ $arch == arm ]
+
+test-debug: SKIP
+test-serialize: SKIP
+test-api: SKIP
index 552fac3..2002c62 100644 (file)
@@ -27,7 +27,7 @@
 
 import test
 import os
-from os.path import join, dirname
+from os.path import join, dirname, exists
 import platform
 
 
@@ -78,6 +78,11 @@ class CcTestConfiguration(test.TestConfiguration):
       if self.Contains(path, full_path):
         result.append(CcTestCase(full_path, executable, mode, raw_test, self.context))
     return result
+  
+  def GetTestStatus(self, sections, defs):
+    status_file = join(self.root, 'cctest.status')
+    if exists(status_file):
+      test.ReadConfigurationInto(status_file, sections, defs)
 
 
 def GetConfiguration(context, root):
index 8aecc48..9ce66c8 100755 (executable)
@@ -921,6 +921,9 @@ def ReadConfigurationInto(path, sections, defs):
 # ---------------
 
 
+ARCH_GUESS = utils.GuessArchitecture()
+
+
 def BuildOptions():
   result = optparse.OptionParser()
   result.add_option("-m", "--mode", help="The test modes in which to run (comma-separated)",
@@ -940,6 +943,8 @@ def BuildOptions():
       default=[], action="append")
   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)
   return result
 
 
@@ -1050,7 +1055,8 @@ def Main():
     for mode in options.mode:
       env = {
         'mode': mode,
-        'system': platform.system().lower()
+        'system': platform.system().lower(),
+        'arch': options.arch
       }
       test_list = root.ListTests([], path, context, mode)
       (cases, unused_rules) = config.ClassifyTests(test_list, env)
index 7583d55..7149b5d 100644 (file)
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+
+import platform
+import re
+
+
 # Reads a .list file into an array of strings
 def ReadLinesFrom(name):
   list = []
@@ -36,3 +41,13 @@ def ReadLinesFrom(name):
       continue
     list.append(line)
   return list
+
+  
+def GuessArchitecture():
+  id = platform.machine()
+  if id.startswith('arm'):
+    return 'arm'
+  elif (not id) or (not re.match('(x|i[3-6])86', id) is None):
+    return 'ia32'
+  else:
+    return None