From 786760039e0b41cf9883ca7bfa92a4712cc5c483 Mon Sep 17 00:00:00 2001 From: "christian.plesner.hansen@gmail.com" Date: Tue, 2 Sep 2008 15:20:38 +0000 Subject: [PATCH] - Added test status spec to cctests to make arm simulator tests run. - 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 | 14 ++------------ test/cctest/cctest.status | 34 ++++++++++++++++++++++++++++++++++ test/cctest/testcfg.py | 7 ++++++- tools/test.py | 8 +++++++- tools/utils.py | 15 +++++++++++++++ 5 files changed, 64 insertions(+), 14 deletions(-) create mode 100644 test/cctest/cctest.status diff --git a/SConstruct b/SConstruct index 6bb23ce..34f20d3 100644 --- a/SConstruct +++ b/SConstruct @@ -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 index 0000000..b222196 --- /dev/null +++ b/test/cctest/cctest.status @@ -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 diff --git a/test/cctest/testcfg.py b/test/cctest/testcfg.py index 552fac3..2002c62 100644 --- a/test/cctest/testcfg.py +++ b/test/cctest/testcfg.py @@ -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): diff --git a/tools/test.py b/tools/test.py index 8aecc48..9ce66c8 100755 --- a/tools/test.py +++ b/tools/test.py @@ -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) diff --git a/tools/utils.py b/tools/utils.py index 7583d55..7149b5d 100644 --- a/tools/utils.py +++ b/tools/utils.py @@ -25,6 +25,11 @@ # (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 -- 2.7.4