Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(452)

Side by Side Diff: SConstruct

Issue 9696046: Add test running support for tests generated as pexes. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: suggestions Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | site_scons/site_tools/naclsdk.py » ('j') | site_scons/site_tools/naclsdk.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #! -*- python -*- 1 #! -*- python -*-
2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import atexit 6 import atexit
7 import glob 7 import glob
8 import os 8 import os
9 import platform 9 import platform
10 import shutil 10 import shutil
(...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 size='medium', 1185 size='medium',
1186 **extra): 1186 **extra):
1187 validator = GetValidator(env, validator) 1187 validator = GetValidator(env, validator)
1188 if validator is None: 1188 if validator is None:
1189 print 'WARNING: no validator found. Skipping test %s' % name 1189 print 'WARNING: no validator found. Skipping test %s' % name
1190 return [] 1190 return []
1191 1191
1192 if validator_flags is None: 1192 if validator_flags is None:
1193 validator_flags = [] 1193 validator_flags = []
1194 1194
1195 if env.Bit('pnacl_stop_with_pexe'):
robertm 2012/03/13 21:53:15 I am not a big fan of the "late kill", it would be
(google.com) Derek Schuff 2012/03/13 21:59:27 Maybe... until someone else tries to add another v
1196 return []
1197
1195 command = [validator] + validator_flags + [image] 1198 command = [validator] + validator_flags + [image]
1196 return CommandTest(env, name, command, size, **extra) 1199 return CommandTest(env, name, command, size, **extra)
1197 1200
1198 pre_base_env.AddMethod(CommandValidatorTestNacl) 1201 pre_base_env.AddMethod(CommandValidatorTestNacl)
1199 1202
1200 1203
1201 def ExtractPublishedFiles(env, target_name): 1204 def ExtractPublishedFiles(env, target_name):
1202 run_files = ['$STAGING_DIR/' + os.path.basename(published_file.path) 1205 run_files = ['$STAGING_DIR/' + os.path.basename(published_file.path)
1203 for published_file in env.GetPublished(target_name, 'run')] 1206 for published_file in env.GetPublished(target_name, 'run')]
1204 nexe = '$STAGING_DIR/%s${PROGSUFFIX}' % target_name 1207 nexe = '$STAGING_DIR/%s${PROGSUFFIX}' % target_name
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
1943 pre_base_env.AddMethod(MakeVerboseExtraOptions) 1946 pre_base_env.AddMethod(MakeVerboseExtraOptions)
1944 1947
1945 def ShouldUseVerboseOptions(extra): 1948 def ShouldUseVerboseOptions(extra):
1946 """ Heuristic for setting up Verbose NACLLOG options. """ 1949 """ Heuristic for setting up Verbose NACLLOG options. """
1947 return ('process_output_single' in extra or 1950 return ('process_output_single' in extra or
1948 'log_golden' in extra) 1951 'log_golden' in extra)
1949 1952
1950 # ---------------------------------------------------------- 1953 # ----------------------------------------------------------
1951 DeclareBit('tests_use_irt', 'Non-browser tests also load the IRT image', False) 1954 DeclareBit('tests_use_irt', 'Non-browser tests also load the IRT image', False)
1952 1955
1956 # Translate the given pexe. Return the name of the translated nexe and
Mark Seaborn 2012/03/13 22:16:55 Sentence not completed.
1957 def GetTranslatedNexe(env, pexe):
1958 pexe_name = pexe.abspath
1959 nexe_name = pexe_name[:pexe_name.index('.pexe')] + '.nexe'
1960 trans_flags = []
Mark Seaborn 2012/03/13 22:16:55 trans_flag is not used.
1961 trans_cmd = ('${TRANSLATE} ${TRANSLATEFLAGS} -Wl,-L${LIB_DIR} %s -o %s' %
1962 (pexe_name, nexe_name))
1963
1964 pexe_node = env.Command(nexe_name, pexe_name, trans_cmd)
1965 return nexe_name, pexe_node
Mark Seaborn 2012/03/13 22:16:55 In the call sites, nexe_name is not used.
1966
1967 pre_base_env.AddMethod(GetTranslatedNexe)
1968
1953 def CommandSelLdrTestNacl(env, name, nexe, 1969 def CommandSelLdrTestNacl(env, name, nexe,
1954 args = None, 1970 args = None,
1955 log_verbosity=2, 1971 log_verbosity=2,
1956 sel_ldr_flags=None, 1972 sel_ldr_flags=None,
1957 loader=None, 1973 loader=None,
1958 size='medium', 1974 size='medium',
1959 # True for *.nexe statically linked with glibc 1975 # True for *.nexe statically linked with glibc
1960 glibc_static=False, 1976 glibc_static=False,
1961 uses_ppapi=False, 1977 uses_ppapi=False,
1962 skip_bootstrap=False, 1978 skip_bootstrap=False,
1963 wrapper_program_prefix=None, 1979 wrapper_program_prefix=None,
1964 # e.g., [ 'python', 'time_check.py', '--' ] 1980 # e.g., [ 'python', 'time_check.py', '--' ]
1965 **extra): 1981 **extra):
1966 # Disable all sel_ldr tests for windows under coverage. 1982 # Disable all sel_ldr tests for windows under coverage.
1967 # Currently several .S files block sel_ldr from being instrumented. 1983 # Currently several .S files block sel_ldr from being instrumented.
1968 # See http://code.google.com/p/nativeclient/issues/detail?id=831 1984 # See http://code.google.com/p/nativeclient/issues/detail?id=831
1969 if ('TRUSTED_ENV' in env and 1985 if ('TRUSTED_ENV' in env and
1970 env['TRUSTED_ENV'].Bit('coverage_enabled') and 1986 env['TRUSTED_ENV'].Bit('coverage_enabled') and
1971 env['TRUSTED_ENV'].Bit('windows')): 1987 env['TRUSTED_ENV'].Bit('windows')):
1972 return [] 1988 return []
1973 1989
1974 command = [nexe] 1990 if (env.Bit('pnacl_stop_with_pexe') and env['NACL_BUILD_FAMILY'] != 'TRUSTED') :
1991 # The nexe is actually a pexe. translate it before we run it
1992 nexe_name, pexe_node = GetTranslatedNexe(env, nexe)
1993 command = [nexe_name]
1994 extra_deps = [pexe_node]
1995 else:
1996 command = [nexe]
1997 extra_deps = []
1998
1975 if args is not None: 1999 if args is not None:
1976 command += args 2000 command += args
1977 2001
1978 if loader is None: 2002 if loader is None:
1979 loader = GetSelLdr(env) 2003 loader = GetSelLdr(env)
1980 if loader is None: 2004 if loader is None:
1981 print 'WARNING: no sel_ldr found. Skipping test %s' % name 2005 print 'WARNING: no sel_ldr found. Skipping test %s' % name
1982 return [] 2006 return []
1983 2007
1984 # Avoid problems with [] as default arguments 2008 # Avoid problems with [] as default arguments
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2018 loader_cmd = [loader] 2042 loader_cmd = [loader]
2019 else: 2043 else:
2020 loader_cmd = [bootstrap, loader, bootstrap_arg] 2044 loader_cmd = [bootstrap, loader, bootstrap_arg]
2021 2045
2022 command = loader_cmd + sel_ldr_flags + ['--'] + command 2046 command = loader_cmd + sel_ldr_flags + ['--'] + command
2023 2047
2024 if ShouldUseVerboseOptions(extra): 2048 if ShouldUseVerboseOptions(extra):
2025 env.MakeVerboseExtraOptions(name, log_verbosity, extra) 2049 env.MakeVerboseExtraOptions(name, log_verbosity, extra)
2026 2050
2027 node = CommandTest(env, name, command, size, posix_path=True, 2051 node = CommandTest(env, name, command, size, posix_path=True,
2028 wrapper_program_prefix=wrapper_program_prefix, **extra) 2052 wrapper_program_prefix=wrapper_program_prefix,
2053 extra_deps=extra_deps, **extra)
2029 if env.Bit('tests_use_irt'): 2054 if env.Bit('tests_use_irt'):
2030 env.Alias('irt_tests', node) 2055 env.Alias('irt_tests', node)
2031 return node 2056 return node
2032 2057
2033 pre_base_env.AddMethod(CommandSelLdrTestNacl) 2058 pre_base_env.AddMethod(CommandSelLdrTestNacl)
2034 2059
2035 # ---------------------------------------------------------- 2060 # ----------------------------------------------------------
2036 TEST_EXTRA_ARGS = ['stdin', 'log_file', 2061 TEST_EXTRA_ARGS = ['stdin', 'log_file',
2037 'stdout_golden', 'stderr_golden', 'log_golden', 2062 'stdout_golden', 'stderr_golden', 'log_golden',
2038 'filter_regex', 'filter_inverse', 'filter_group_only', 2063 'filter_regex', 'filter_inverse', 'filter_group_only',
(...skipping 1812 matching lines...) Expand 10 before | Expand all | Expand 10 after
3851 nacl_env.ValidateSdk() 3876 nacl_env.ValidateSdk()
3852 3877
3853 if BROKEN_TEST_COUNT > 0: 3878 if BROKEN_TEST_COUNT > 0:
3854 msg = "There are %d broken tests." % BROKEN_TEST_COUNT 3879 msg = "There are %d broken tests." % BROKEN_TEST_COUNT
3855 if GetOption('brief_comstr'): 3880 if GetOption('brief_comstr'):
3856 msg += " Add --verbose to the command line for more information." 3881 msg += " Add --verbose to the command line for more information."
3857 print msg 3882 print msg
3858 3883
3859 # separate warnings from actual build output 3884 # separate warnings from actual build output
3860 Banner('B U I L D - O U T P U T:') 3885 Banner('B U I L D - O U T P U T:')
OLDNEW
« no previous file with comments | « no previous file | site_scons/site_tools/naclsdk.py » ('j') | site_scons/site_tools/naclsdk.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698