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

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
« no previous file with comments | « src/trusted/validator_arm/armv7.table ('k') | src/trusted/validator_arm/decoder_tester.h » ('j') | no next file with comments »
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 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 = [_gen_file(x) for x in
43 'arm32_decode_named.cc' , 'arm32_decode_named.h']) 43 ['arm32_decode.cc', 'arm32_decode.h',
44 'arm32_decode_named.cc' ,
45 'arm32_decode_named_classes.h',
46 'arm32_decode_named_decoder.h',
47 'arm32_decode_tests.cc']]
44 48
45 generate = False 49 generate = False
46 gen_env = env.Clone(); 50 gen_env = env.Clone();
47 if 'valgen' in COMMAND_LINE_TARGETS: generate = True 51 if 'valgen' in COMMAND_LINE_TARGETS: generate = True
48 if 'valclean' in COMMAND_LINE_TARGETS: generate = True 52 if 'valclean' in COMMAND_LINE_TARGETS: generate = True
49 53
50 if generate: 54 if generate:
51 gen_env.AlwaysBuild(gen_env.Alias('valgen', GEN_LIST)) 55 gen_env.AlwaysBuild(gen_env.Alias('valgen', GEN_LIST))
52 gen_env.AlwaysBuild( 56 gen_env.AlwaysBuild(
53 gen_env.Alias('valclean', action=[Delete(x) for x in GEN_LIST])) 57 gen_env.Alias('valclean', action=[Delete(x) for x in GEN_LIST]))
54 58
55 def _generate_source(filename): 59 def _generate_source(filename):
56 env.Command(target=filename, 60 env.Command(target=filename,
57 source=['armv7.table', 61 source=['armv7.table',
58 'generate_decoder.py', 62 'generate_decoder.py',
59 'dgen_core.py', 63 'dgen_core.py',
60 'dgen_input.py', 64 'dgen_input.py',
61 'dgen_opt.py', 65 'dgen_opt.py',
62 'dgen_output.py'], 66 'dgen_output.py',
67 'dgen_decoder_output.py',
68 'dgen_test_output.py',
69 ],
63 action=['${SOURCES[1].abspath} ${SOURCES[0].abspath} ' 70 action=['${SOURCES[1].abspath} ${SOURCES[0].abspath} '
64 '${TARGET.abspath} Arm32DecoderState']) 71 '${TARGET.abspath} Arm32DecoderState'])
65 72
66 for f in GEN_LIST: 73 for f in GEN_LIST:
67 _generate_source(f) 74 _generate_source(f)
68 75
69 env.ComponentLibrary('arm_validator_core', 76 env.ComponentLibrary('arm_validator_core',
70 ['address_set.cc', 77 ['address_set.cc',
71 'inst_classes.cc', 78 'inst_classes.cc',
72 'inst_classes_statics.cc', 79 'inst_classes_statics.cc',
73 'validator.cc', 80 'validator.cc',
74 'gen/arm32_decode.cc']) 81 'gen/arm32_decode.cc'])
75 82
76 env.ComponentLibrary('ncvalidate_arm_v2', 83 env.ComponentLibrary('ncvalidate_arm_v2',
77 ['ncvalidate.cc'], 84 ['ncvalidate.cc'],
78 LIBS=['arm_validator_core', 85 LIBS=['arm_validator_core',
79 '${OPTIONAL_COVERAGE_LIBS}']) 86 '${OPTIONAL_COVERAGE_LIBS}'])
80 87
81 ncval = env.ComponentProgram( 88 ncval = env.ComponentProgram(
82 'arm-ncval-core', 89 'arm-ncval-core',
83 ['ncval.cc'], 90 ['ncval.cc'],
84 LIBS=['arm_validator_core', 91 LIBS=['arm_validator_core',
85 env.NaClTargetArchSuffix('ncfileutils'), 92 env.NaClTargetArchSuffix('ncfileutils'),
86 '${OPTIONAL_COVERAGE_LIBS}']) 93 '${OPTIONAL_COVERAGE_LIBS}'])
87 94
88 env.SDKInstallBin('ncval', ncval, target='arm') 95 env.SDKInstallBin('ncval', ncval, target='arm')
89 96
90 env.ComponentProgram('address_set_test_binary', 97 # Build test environment to show that we are compiling in the test
91 ['address_set_test.cc'], 98 # environment (rather than for the TCB).
92 LIBS=['arm_validator_core', 99 gtest_env = env.MakeGTestEnv()
93 '${OPTIONAL_COVERAGE_LIBS}']) 100 gtest_env.Append(CCFLAGS=['-DNACL_TRUSTED_BUT_NOT_TCB'])
94 101
95 address_set_test = env.Command(target='address_set_test.out', 102 gtest_env.ComponentProgram('address_set_test_binary',
96 source=['address_set_test_binary'], 103 ['address_set_test.cc'],
97 action=['${SOURCES[0].abspath}']) 104 LIBS=['arm_validator_core',
105 '${OPTIONAL_COVERAGE_LIBS}'])
106
107 address_set_test = gtest_env.Command(target='address_set_test.out',
108 source=['address_set_test_binary'],
109 action=['${SOURCES[0].abspath}'])
98 110
99 # TODO(cbiffle): get this wrapped in QEMU. 111 # TODO(cbiffle): get this wrapped in QEMU.
100 #env.AddNodeToTestSuite(address_set_test, ['small_tests'], 'address_set_test') 112 #env.AddNodeToTestSuite(address_set_test, ['small_tests'], 'address_set_test')
101 113
102 validator_tests = { 114 validator_tests = {
103 'test_external_jumps': 1, 115 'test_external_jumps': 1,
104 'test_forbidden_instructions': 1, 116 'test_forbidden_instructions': 1,
105 'test_internal_jumps': 1, 117 'test_internal_jumps': 1,
106 'test_sp_updates': 1, 118 'test_sp_updates': 1,
107 'test_stores': 1, 119 'test_stores': 1,
108 'test_vector_stores': 1, 120 'test_vector_stores': 1,
109 'test_loads': 1, 121 'test_loads': 1,
110 'test_vector_loads': 1, 122 'test_vector_loads': 1,
111 } 123 }
112 124
113 for test, exit_status in validator_tests.iteritems(): 125 for test, exit_status in validator_tests.iteritems():
114 node = env.CommandTest( 126 node = gtest_env.CommandTest(
115 test + '_actual.out', 127 test + '_actual.out',
116 [ncval, env.File('testdata/' + test + '.nexe')], 128 [ncval, gtest_env.File('testdata/' + test + '.nexe')],
117 exit_status = str(exit_status), 129 exit_status = str(exit_status),
118 filter_regex = "'^ncval'", 130 filter_regex = "'^ncval'",
119 # NOTE: all stdout_golden are currently empty 131 # NOTE: all stdout_golden are currently empty
120 stdout_golden = env.File('testdata/' + test + '.out'), 132 stdout_golden = gtest_env.File('testdata/' + test + '.out'),
121 stderr_golden = env.File('testdata/' + test + '.err')) 133 stderr_golden = gtest_env.File('testdata/' + test + '.err'))
122 134
123 env.AddNodeToTestSuite(node, ['small_tests', 'validator_tests'], 135 gtest_env.AddNodeToTestSuite(node, ['small_tests', 'validator_tests'],
124 "run_arm_" + test) 136 "run_arm_" + test)
125
126 gtest_env = env.MakeGTestEnv()
127 137
128 gtest_env.ComponentLibrary('decoder_test_tools', 138 gtest_env.ComponentLibrary('decoder_test_tools',
129 ['decoder_tester.cc', 139 ['decoder_tester.cc',
130 'inst_classes_testers.cc', 140 'inst_classes_testers.cc',
131 'gen/arm32_decode_named.cc']); 141 'gen/arm32_decode_named.cc']);
132 142
133 # Do NOT name this program 'validator_tests' because this is the same name as 143 # Do NOT name this program 'validator_tests' because this is the same name as
134 # a test suite, and scons will run that test suite if it ever builds 144 # a test suite, and scons will run that test suite if it ever builds
135 # a program of the same name. 145 # a program of the same name.
136 validator_tests_exe = gtest_env.ComponentProgram('arm_validator_tests', 146 validator_tests_exe = gtest_env.ComponentProgram('arm_validator_tests',
137 ['validator_tests.cc'], 147 ['validator_tests.cc'],
138 EXTRA_LIBS=['arm_validator_core']) 148 EXTRA_LIBS=['arm_validator_core'])
139 149
140 test_node = gtest_env.CommandTest( 150 test_node = gtest_env.CommandTest(
141 'validator_tests.out', 151 'validator_tests.out',
142 command=[validator_tests_exe]) 152 command=[validator_tests_exe])
143 gtest_env.AddNodeToTestSuite(test_node, ['small_tests'], 153 gtest_env.AddNodeToTestSuite(test_node, ['small_tests'],
144 'run_arm_validator_tests') 154 'run_arm_validator_tests')
145 155
146 # Test ARM (32-bit) instruction decoding. 156 # Test ARM (32-bit) instruction decoding.
147 decoder_tests_exe = gtest_env.ComponentProgram( 157 decoder_tests_exe = gtest_env.ComponentProgram(
148 'decoder_tests', 158 'arm32_decode_tests',
149 ['decoder_tests.cc'], 159 ['gen/arm32_decode_tests.cc'],
150 EXTRA_LIBS=['decoder_test_tools', 'arm_validator_core']) 160 EXTRA_LIBS=['decoder_test_tools', 'arm_validator_core'])
151 161
152 decoder_test_node = gtest_env.CommandTest( 162 decoder_test_node = gtest_env.CommandTest(
153 'decoder_tests.out', 163 'arm32_decode_tests.out',
154 command=[decoder_tests_exe], 164 command=[decoder_tests_exe],
155 scale_timeout=10) 165 scale_timeout=100)
156 166
157 gtest_env.AddNodeToTestSuite(decoder_test_node, 167 gtest_env.AddNodeToTestSuite(decoder_test_node,
158 ['huge_tests', 'arm_decoder_tests'], 168 ['huge_tests', 'arm_decoder_tests'],
159 'run_arm_decoder_tests') 169 'run_arm_decoder_tests')
OLDNEW
« no previous file with comments | « src/trusted/validator_arm/armv7.table ('k') | src/trusted/validator_arm/decoder_tester.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698