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

Side by Side Diff: src/trusted/validator_arm/build.scons

Issue 9960043: Finish separation of testing from sel_ldr validation. Also, automate (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: Created 8 years, 8 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
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 os 6 import os
7 Import('env') 7 Import('env')
8 8
9 if not env.Bit('linux'): Return() 9 if not env.Bit('linux'): Return()
10 10
(...skipping 21 matching lines...) Expand all
32 gen_env = env.Clone(); 32 gen_env = env.Clone();
33 33
34 # Defines this source directory. 34 # Defines this source directory.
35 GEN_SRC_DIR = '${MAIN_DIR}/src/trusted/validator_arm/gen' 35 GEN_SRC_DIR = '${MAIN_DIR}/src/trusted/validator_arm/gen'
36 36
37 # Defines the full file name for a generated file. 37 # Defines the full file name for a generated file.
38 def _gen_file(filename): 38 def _gen_file(filename):
39 return '%s/%s' % (GEN_SRC_DIR, filename) 39 return '%s/%s' % (GEN_SRC_DIR, filename)
40 40
41 # Set of generated source files. 41 # Set of generated source files.
42 GEN_LIST = map(_gen_file, ['arm32_decode.cc', 'arm32_decode.h', 42 GEN_LIST = map(_gen_file, ['arm32_decode.cc', 'arm32_decode.h',
robertm 2012/04/11 01:28:43 use list comprehension, e.g. GEM_LIST = [_gen_fil
Karl 2012/04/16 23:18:10 Done.
43 'arm32_decode_named.cc' , 'arm32_decode_named.h']) 43 'arm32_decode_named.cc' , 'arm32_decode_named.h',
44 'arm32_decode_tests.cc'])
44 45
45 generate = False 46 generate = False
46 gen_env = env.Clone(); 47 gen_env = env.Clone();
47 if 'valgen' in COMMAND_LINE_TARGETS: generate = True 48 if 'valgen' in COMMAND_LINE_TARGETS: generate = True
48 if 'valclean' in COMMAND_LINE_TARGETS: generate = True 49 if 'valclean' in COMMAND_LINE_TARGETS: generate = True
49 50
50 if generate: 51 if generate:
51 gen_env.AlwaysBuild(gen_env.Alias('valgen', GEN_LIST)) 52 gen_env.AlwaysBuild(gen_env.Alias('valgen', GEN_LIST))
52 gen_env.AlwaysBuild( 53 gen_env.AlwaysBuild(
53 gen_env.Alias('valclean', action=[Delete(x) for x in GEN_LIST])) 54 gen_env.Alias('valclean', action=[Delete(x) for x in GEN_LIST]))
(...skipping 25 matching lines...) Expand all
79 80
80 ncval = env.ComponentProgram( 81 ncval = env.ComponentProgram(
81 'arm-ncval-core', 82 'arm-ncval-core',
82 ['ncval.cc'], 83 ['ncval.cc'],
83 LIBS=['arm_validator_core', 84 LIBS=['arm_validator_core',
84 env.NaClTargetArchSuffix('ncfileutils'), 85 env.NaClTargetArchSuffix('ncfileutils'),
85 '${OPTIONAL_COVERAGE_LIBS}']) 86 '${OPTIONAL_COVERAGE_LIBS}'])
86 87
87 env.SDKInstallBin('ncval', ncval, target='arm') 88 env.SDKInstallBin('ncval', ncval, target='arm')
88 89
89 env.ComponentProgram('address_set_test_binary', 90 # Build test environment to show that we are compiling in the test
90 ['address_set_test.cc'], 91 # environment (rather than for the TCB).
91 LIBS=['arm_validator_core', 92 gtest_env = env.MakeGTestEnv()
92 '${OPTIONAL_COVERAGE_LIBS}']) 93 gtest_env.Append(CCFLAGS=['-DNACL_TRUSTED_BUT_NOT_TCB'])
93 94
94 address_set_test = env.Command(target='address_set_test.out', 95 gtest_env.ComponentProgram('address_set_test_binary',
95 source=['address_set_test_binary'], 96 ['address_set_test.cc'],
96 action=['${SOURCES[0].abspath}']) 97 LIBS=['arm_validator_core',
98 '${OPTIONAL_COVERAGE_LIBS}'])
99
100 address_set_test = gtest_env.Command(target='address_set_test.out',
101 source=['address_set_test_binary'],
102 action=['${SOURCES[0].abspath}'])
97 103
98 # TODO(cbiffle): get this wrapped in QEMU. 104 # TODO(cbiffle): get this wrapped in QEMU.
99 #env.AddNodeToTestSuite(address_set_test, ['small_tests'], 'address_set_test') 105 #env.AddNodeToTestSuite(address_set_test, ['small_tests'], 'address_set_test')
100 106
101 validator_tests = { 107 validator_tests = {
102 'test_external_jumps': 1, 108 'test_external_jumps': 1,
103 'test_forbidden_instructions': 1, 109 'test_forbidden_instructions': 1,
104 'test_internal_jumps': 1, 110 'test_internal_jumps': 1,
105 'test_sp_updates': 1, 111 'test_sp_updates': 1,
106 'test_stores': 1, 112 'test_stores': 1,
107 'test_vector_stores': 1, 113 'test_vector_stores': 1,
108 'test_loads': 1, 114 'test_loads': 1,
109 'test_vector_loads': 1, 115 'test_vector_loads': 1,
110 } 116 }
111 117
112 for test, exit_status in validator_tests.iteritems(): 118 for test, exit_status in validator_tests.iteritems():
113 node = env.CommandTest( 119 node = gtest_env.CommandTest(
114 test + '_actual.out', 120 test + '_actual.out',
115 [ncval, env.File('testdata/' + test + '.nexe')], 121 [ncval, gtest_env.File('testdata/' + test + '.nexe')],
116 exit_status = str(exit_status), 122 exit_status = str(exit_status),
117 filter_regex = "'^ncval'", 123 filter_regex = "'^ncval'",
118 # NOTE: all stdout_golden are currently empty 124 # NOTE: all stdout_golden are currently empty
119 stdout_golden = env.File('testdata/' + test + '.out'), 125 stdout_golden = gtest_env.File('testdata/' + test + '.out'),
120 stderr_golden = env.File('testdata/' + test + '.err')) 126 stderr_golden = gtest_env.File('testdata/' + test + '.err'))
121 127
122 env.AddNodeToTestSuite(node, ['small_tests', 'validator_tests'], 128 gtest_env.AddNodeToTestSuite(node, ['small_tests', 'validator_tests'],
123 "run_arm_" + test) 129 "run_arm_" + test)
124
125 gtest_env = env.MakeGTestEnv()
126 130
127 gtest_env.ComponentLibrary('decoder_test_tools', 131 gtest_env.ComponentLibrary('decoder_test_tools',
128 ['decoder_tester.cc', 132 ['decoder_tester.cc',
129 'inst_classes_testers.cc', 133 'inst_classes_testers.cc',
130 'gen/arm32_decode_named.cc']); 134 'gen/arm32_decode_named.cc']);
131 135
132 # Do NOT name this program 'validator_tests' because this is the same name as 136 # Do NOT name this program 'validator_tests' because this is the same name as
133 # a test suite, and scons will run that test suite if it ever builds 137 # a test suite, and scons will run that test suite if it ever builds
134 # a program of the same name. 138 # a program of the same name.
135 validator_tests_exe = gtest_env.ComponentProgram('arm_validator_tests', 139 validator_tests_exe = gtest_env.ComponentProgram('arm_validator_tests',
136 ['validator_tests.cc'], 140 ['validator_tests.cc'],
137 EXTRA_LIBS=['arm_validator_core']) 141 EXTRA_LIBS=['arm_validator_core'])
138 142
139 test_node = gtest_env.CommandTest( 143 test_node = gtest_env.CommandTest(
140 'validator_tests.out', 144 'validator_tests.out',
141 command=[validator_tests_exe]) 145 command=[validator_tests_exe])
142 gtest_env.AddNodeToTestSuite(test_node, ['small_tests'], 146 gtest_env.AddNodeToTestSuite(test_node, ['small_tests'],
143 'run_arm_validator_tests') 147 'run_arm_validator_tests')
144 148
145 # Test ARM (32-bit) instruction decoding. 149 # Test ARM (32-bit) instruction decoding.
146 decoder_tests_exe = gtest_env.ComponentProgram( 150 decoder_tests_exe = gtest_env.ComponentProgram(
147 'decoder_tests', 151 'arm32_decode_tests',
148 ['decoder_tests.cc'], 152 ['gen/arm32_decode_tests.cc'],
149 EXTRA_LIBS=['decoder_test_tools', 'arm_validator_core']) 153 EXTRA_LIBS=['decoder_test_tools', 'arm_validator_core'])
150 154
151 decoder_test_node = gtest_env.CommandTest( 155 decoder_test_node = gtest_env.CommandTest(
152 'decoder_tests.out', 156 'arm32_decode_tests.out',
153 command=[decoder_tests_exe], 157 command=[decoder_tests_exe],
154 scale_timeout=10) 158 scale_timeout=10)
155 159
156 gtest_env.AddNodeToTestSuite(decoder_test_node, 160 gtest_env.AddNodeToTestSuite(decoder_test_node,
157 ['huge_tests', 'arm_decoder_tests'], 161 ['huge_tests', 'arm_decoder_tests'],
158 'run_arm_decoder_tests') 162 'run_arm_decoder_tests')
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698