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

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: 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') and env['NACL_BUILD_FAMILY'] != 'TRUSTED') :
robertm 2012/03/13 20:57:51 I think it would be ok to simple skip the validato
jvoung - send to chromium... 2012/03/13 20:58:31 80 col (barely)
(google.com) Derek Schuff 2012/03/13 21:23:03 hm. since the only place this is used is the whole
1196 # image is a pexe rather than a nexe
1197 image, dep = GetTranslatedNexe(env, image)
1198 extra_deps = [dep]
1199 else:
1200 extra_deps = []
1201
1195 command = [validator] + validator_flags + [image] 1202 command = [validator] + validator_flags + [image]
1196 return CommandTest(env, name, command, size, **extra) 1203 return CommandTest(env, name, command, size, extra_deps=extra_deps, **extra)
1197 1204
1198 pre_base_env.AddMethod(CommandValidatorTestNacl) 1205 pre_base_env.AddMethod(CommandValidatorTestNacl)
1199 1206
1200 1207
1201 def ExtractPublishedFiles(env, target_name): 1208 def ExtractPublishedFiles(env, target_name):
1202 run_files = ['$STAGING_DIR/' + os.path.basename(published_file.path) 1209 run_files = ['$STAGING_DIR/' + os.path.basename(published_file.path)
1203 for published_file in env.GetPublished(target_name, 'run')] 1210 for published_file in env.GetPublished(target_name, 'run')]
1204 nexe = '$STAGING_DIR/%s${PROGSUFFIX}' % target_name 1211 nexe = '$STAGING_DIR/%s${PROGSUFFIX}' % target_name
1205 return [env.File(file) for file in run_files + [nexe]] 1212 return [env.File(file) for file in run_files + [nexe]]
1206 1213
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
1943 pre_base_env.AddMethod(MakeVerboseExtraOptions) 1950 pre_base_env.AddMethod(MakeVerboseExtraOptions)
1944 1951
1945 def ShouldUseVerboseOptions(extra): 1952 def ShouldUseVerboseOptions(extra):
1946 """ Heuristic for setting up Verbose NACLLOG options. """ 1953 """ Heuristic for setting up Verbose NACLLOG options. """
1947 return ('process_output_single' in extra or 1954 return ('process_output_single' in extra or
1948 'log_golden' in extra) 1955 'log_golden' in extra)
1949 1956
1950 # ---------------------------------------------------------- 1957 # ----------------------------------------------------------
1951 DeclareBit('tests_use_irt', 'Non-browser tests also load the IRT image', False) 1958 DeclareBit('tests_use_irt', 'Non-browser tests also load the IRT image', False)
1952 1959
1960 # Translate the given pexe. Return the name of the translated nexe and
1961 def GetTranslatedNexe(env, pexe):
1962 pexe_name = pexe.abspath
1963 nexe_name = pexe_name[:pexe_name.index('.pexe')] + '.nexe'
1964 trans_flags = []
1965 if 'TRANSLATEFLAGS' in env:
1966 trans_flags = env['TRANSLATEFLAGS']
1967 translate_command = ' '.join([env['TRANSLATE']] + trans_flags + [pexe_name,
jvoung - send to chromium... 2012/03/13 20:58:31 Would it work if you let scons do the env interpol
(google.com) Derek Schuff 2012/03/13 21:23:03 yeah, that works. On 2012/03/13 20:58:31, jvoung w
1968 '-o', nexe_name, '-Wl,-L' + '${LIB_DIR}'])
1969
1970 pexe_node = env.Command(nexe_name, pexe_name, translate_command)
1971 return nexe_name, pexe_node
1972
1973 pre_base_env.AddMethod(GetTranslatedNexe)
1974
1953 def CommandSelLdrTestNacl(env, name, nexe, 1975 def CommandSelLdrTestNacl(env, name, nexe,
1954 args = None, 1976 args = None,
1955 log_verbosity=2, 1977 log_verbosity=2,
1956 sel_ldr_flags=None, 1978 sel_ldr_flags=None,
1957 loader=None, 1979 loader=None,
1958 size='medium', 1980 size='medium',
1959 # True for *.nexe statically linked with glibc 1981 # True for *.nexe statically linked with glibc
1960 glibc_static=False, 1982 glibc_static=False,
1961 uses_ppapi=False, 1983 uses_ppapi=False,
1962 skip_bootstrap=False, 1984 skip_bootstrap=False,
1963 wrapper_program_prefix=None, 1985 wrapper_program_prefix=None,
1964 # e.g., [ 'python', 'time_check.py', '--' ] 1986 # e.g., [ 'python', 'time_check.py', '--' ]
1965 **extra): 1987 **extra):
1966 # Disable all sel_ldr tests for windows under coverage. 1988 # Disable all sel_ldr tests for windows under coverage.
1967 # Currently several .S files block sel_ldr from being instrumented. 1989 # Currently several .S files block sel_ldr from being instrumented.
1968 # See http://code.google.com/p/nativeclient/issues/detail?id=831 1990 # See http://code.google.com/p/nativeclient/issues/detail?id=831
1969 if ('TRUSTED_ENV' in env and 1991 if ('TRUSTED_ENV' in env and
1970 env['TRUSTED_ENV'].Bit('coverage_enabled') and 1992 env['TRUSTED_ENV'].Bit('coverage_enabled') and
1971 env['TRUSTED_ENV'].Bit('windows')): 1993 env['TRUSTED_ENV'].Bit('windows')):
1972 return [] 1994 return []
1973 1995
1974 command = [nexe] 1996 if (env.Bit('pnacl_stop_with_pexe') and env['NACL_BUILD_FAMILY'] != 'TRUSTED') :
jvoung - send to chromium... 2012/03/13 20:58:31 80 col (barely)
(google.com) Derek Schuff 2012/03/13 21:23:03 punting this because the name change fixes it :P O
jvoung - send to chromium... 2012/03/13 21:41:23 =) sounds good.
1997 # The nexe is actually a pexe. translate it before we run it
1998 nexe_name, pexe_node = GetTranslatedNexe(env, nexe)
1999 command = [nexe_name]
2000 extra_deps = [pexe_node]
2001 else:
2002 command = [nexe]
2003 extra_deps = []
2004
1975 if args is not None: 2005 if args is not None:
1976 command += args 2006 command += args
1977 2007
1978 if loader is None: 2008 if loader is None:
1979 loader = GetSelLdr(env) 2009 loader = GetSelLdr(env)
1980 if loader is None: 2010 if loader is None:
1981 print 'WARNING: no sel_ldr found. Skipping test %s' % name 2011 print 'WARNING: no sel_ldr found. Skipping test %s' % name
1982 return [] 2012 return []
1983 2013
1984 # Avoid problems with [] as default arguments 2014 # Avoid problems with [] as default arguments
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2018 loader_cmd = [loader] 2048 loader_cmd = [loader]
2019 else: 2049 else:
2020 loader_cmd = [bootstrap, loader, bootstrap_arg] 2050 loader_cmd = [bootstrap, loader, bootstrap_arg]
2021 2051
2022 command = loader_cmd + sel_ldr_flags + ['--'] + command 2052 command = loader_cmd + sel_ldr_flags + ['--'] + command
2023 2053
2024 if ShouldUseVerboseOptions(extra): 2054 if ShouldUseVerboseOptions(extra):
2025 env.MakeVerboseExtraOptions(name, log_verbosity, extra) 2055 env.MakeVerboseExtraOptions(name, log_verbosity, extra)
2026 2056
2027 node = CommandTest(env, name, command, size, posix_path=True, 2057 node = CommandTest(env, name, command, size, posix_path=True,
2028 wrapper_program_prefix=wrapper_program_prefix, **extra) 2058 wrapper_program_prefix=wrapper_program_prefix,
2059 extra_deps=extra_deps, **extra)
2029 if env.Bit('tests_use_irt'): 2060 if env.Bit('tests_use_irt'):
2030 env.Alias('irt_tests', node) 2061 env.Alias('irt_tests', node)
2031 return node 2062 return node
2032 2063
2033 pre_base_env.AddMethod(CommandSelLdrTestNacl) 2064 pre_base_env.AddMethod(CommandSelLdrTestNacl)
2034 2065
2035 # ---------------------------------------------------------- 2066 # ----------------------------------------------------------
2036 TEST_EXTRA_ARGS = ['stdin', 'log_file', 2067 TEST_EXTRA_ARGS = ['stdin', 'log_file',
2037 'stdout_golden', 'stderr_golden', 'log_golden', 2068 'stdout_golden', 'stderr_golden', 'log_golden',
2038 'filter_regex', 'filter_inverse', 'filter_group_only', 2069 'filter_regex', 'filter_inverse', 'filter_group_only',
(...skipping 1812 matching lines...) Expand 10 before | Expand all | Expand 10 after
3851 nacl_env.ValidateSdk() 3882 nacl_env.ValidateSdk()
3852 3883
3853 if BROKEN_TEST_COUNT > 0: 3884 if BROKEN_TEST_COUNT > 0:
3854 msg = "There are %d broken tests." % BROKEN_TEST_COUNT 3885 msg = "There are %d broken tests." % BROKEN_TEST_COUNT
3855 if GetOption('brief_comstr'): 3886 if GetOption('brief_comstr'):
3856 msg += " Add --verbose to the command line for more information." 3887 msg += " Add --verbose to the command line for more information."
3857 print msg 3888 print msg
3858 3889
3859 # separate warnings from actual build output 3890 # separate warnings from actual build output
3860 Banner('B U I L D - O U T P U T:') 3891 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