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

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 = [_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 'validator.cc', 79 'validator.cc',
73 'gen/arm32_decode.cc']) 80 'gen/arm32_decode.cc'])
74 81
75 env.ComponentLibrary('ncvalidate_arm_v2', 82 env.ComponentLibrary('ncvalidate_arm_v2',
76 ['ncvalidate.cc'], 83 ['ncvalidate.cc'],
77 LIBS=['arm_validator_core', 84 LIBS=['arm_validator_core',
78 '${OPTIONAL_COVERAGE_LIBS}']) 85 '${OPTIONAL_COVERAGE_LIBS}'])
79 86
80 ncval = env.ComponentProgram( 87 ncval = env.ComponentProgram(
81 'arm-ncval-core', 88 'arm-ncval-core',
82 ['ncval.cc'], 89 ['ncval.cc'],
83 LIBS=['arm_validator_core', 90 LIBS=['arm_validator_core',
84 env.NaClTargetArchSuffix('ncfileutils'), 91 env.NaClTargetArchSuffix('ncfileutils'),
85 '${OPTIONAL_COVERAGE_LIBS}']) 92 '${OPTIONAL_COVERAGE_LIBS}'])
86 93
87 env.SDKInstallBin('ncval', ncval, target='arm') 94 env.SDKInstallBin('ncval', ncval, target='arm')
88 95
89 env.ComponentProgram('address_set_test_binary', 96 # Build test environment to show that we are compiling in the test
90 ['address_set_test.cc'], 97 # environment (rather than for the TCB).
91 LIBS=['arm_validator_core', 98 gtest_env = env.MakeGTestEnv()
92 '${OPTIONAL_COVERAGE_LIBS}']) 99 gtest_env.Append(CCFLAGS=['-DNACL_TRUSTED_BUT_NOT_TCB'])
93 100
94 address_set_test = env.Command(target='address_set_test.out', 101 gtest_env.ComponentProgram('address_set_test_binary',
95 source=['address_set_test_binary'], 102 ['address_set_test.cc'],
96 action=['${SOURCES[0].abspath}']) 103 LIBS=['arm_validator_core',
104 '${OPTIONAL_COVERAGE_LIBS}'])
105
106 address_set_test = gtest_env.Command(target='address_set_test.out',
107 source=['address_set_test_binary'],
108 action=['${SOURCES[0].abspath}'])
97 109
98 # TODO(cbiffle): get this wrapped in QEMU. 110 # TODO(cbiffle): get this wrapped in QEMU.
99 #env.AddNodeToTestSuite(address_set_test, ['small_tests'], 'address_set_test') 111 #env.AddNodeToTestSuite(address_set_test, ['small_tests'], 'address_set_test')
100 112
101 validator_tests = { 113 validator_tests = {
102 'test_external_jumps': 1, 114 'test_external_jumps': 1,
103 'test_forbidden_instructions': 1, 115 'test_forbidden_instructions': 1,
104 'test_internal_jumps': 1, 116 'test_internal_jumps': 1,
105 'test_sp_updates': 1, 117 'test_sp_updates': 1,
106 'test_stores': 1, 118 'test_stores': 1,
107 'test_vector_stores': 1, 119 'test_vector_stores': 1,
108 'test_loads': 1, 120 'test_loads': 1,
109 'test_vector_loads': 1, 121 'test_vector_loads': 1,
110 } 122 }
111 123
112 for test, exit_status in validator_tests.iteritems(): 124 for test, exit_status in validator_tests.iteritems():
113 node = env.CommandTest( 125 node = gtest_env.CommandTest(
114 test + '_actual.out', 126 test + '_actual.out',
115 [ncval, env.File('testdata/' + test + '.nexe')], 127 [ncval, gtest_env.File('testdata/' + test + '.nexe')],
116 exit_status = str(exit_status), 128 exit_status = str(exit_status),
117 filter_regex = "'^ncval'", 129 filter_regex = "'^ncval'",
118 # NOTE: all stdout_golden are currently empty 130 # NOTE: all stdout_golden are currently empty
119 stdout_golden = env.File('testdata/' + test + '.out'), 131 stdout_golden = gtest_env.File('testdata/' + test + '.out'),
120 stderr_golden = env.File('testdata/' + test + '.err')) 132 stderr_golden = gtest_env.File('testdata/' + test + '.err'))
121 133
122 env.AddNodeToTestSuite(node, ['small_tests', 'validator_tests'], 134 gtest_env.AddNodeToTestSuite(node, ['small_tests', 'validator_tests'],
123 "run_arm_" + test) 135 "run_arm_" + test)
124
125 gtest_env = env.MakeGTestEnv()
126 136
127 gtest_env.ComponentLibrary('decoder_test_tools', 137 gtest_env.ComponentLibrary('decoder_test_tools',
128 ['decoder_tester.cc', 138 ['decoder_tester.cc',
129 'inst_classes_testers.cc', 139 'inst_classes_testers.cc',
130 'gen/arm32_decode_named.cc']); 140 'gen/arm32_decode_named.cc']);
131 141
132 # Do NOT name this program 'validator_tests' because this is the same name as 142 # 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 143 # a test suite, and scons will run that test suite if it ever builds
134 # a program of the same name. 144 # a program of the same name.
135 validator_tests_exe = gtest_env.ComponentProgram('arm_validator_tests', 145 validator_tests_exe = gtest_env.ComponentProgram('arm_validator_tests',
136 ['validator_tests.cc'], 146 ['validator_tests.cc'],
137 EXTRA_LIBS=['arm_validator_core']) 147 EXTRA_LIBS=['arm_validator_core'])
138 148
139 test_node = gtest_env.CommandTest( 149 test_node = gtest_env.CommandTest(
140 'validator_tests.out', 150 'validator_tests.out',
141 command=[validator_tests_exe]) 151 command=[validator_tests_exe])
142 gtest_env.AddNodeToTestSuite(test_node, ['small_tests'], 152 gtest_env.AddNodeToTestSuite(test_node, ['small_tests'],
143 'run_arm_validator_tests') 153 'run_arm_validator_tests')
144 154
145 # Test ARM (32-bit) instruction decoding. 155 # Test ARM (32-bit) instruction decoding.
146 decoder_tests_exe = gtest_env.ComponentProgram( 156 decoder_tests_exe = gtest_env.ComponentProgram(
147 'decoder_tests', 157 'arm32_decode_tests',
148 ['decoder_tests.cc'], 158 ['gen/arm32_decode_tests.cc'],
robertm 2012/04/17 17:12:19 is this gen/ dir different from the one above?
Karl 2012/04/17 19:28:31 It is the same as the above. However, this generat
149 EXTRA_LIBS=['decoder_test_tools', 'arm_validator_core']) 159 EXTRA_LIBS=['decoder_test_tools', 'arm_validator_core'])
150 160
151 decoder_test_node = gtest_env.CommandTest( 161 decoder_test_node = gtest_env.CommandTest(
152 'decoder_tests.out', 162 'arm32_decode_tests.out',
153 command=[decoder_tests_exe], 163 command=[decoder_tests_exe],
154 scale_timeout=10) 164 scale_timeout=10)
155 165
156 gtest_env.AddNodeToTestSuite(decoder_test_node, 166 gtest_env.AddNodeToTestSuite(decoder_test_node,
157 ['huge_tests', 'arm_decoder_tests'], 167 ['huge_tests', 'arm_decoder_tests'],
158 'run_arm_decoder_tests') 168 'run_arm_decoder_tests')
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698