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_x86/build.scons

Issue 6883091: Start unit testing for functions in nc_inst_state.c (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: '' Created 9 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 2011 The Native Client Authors. All rights reserved. 2 # Copyright 2011 The Native Client Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can 3 # Use of this source code is governed by a BSD-style license that can
4 # be found in the LICENSE file. 4 # be found in the LICENSE file.
5 5
6 6
7 import os 7 import os
8 import sys 8 import sys
9 Import('env') 9 Import('env')
10 10
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 ], 146 ],
147 EXTRA_LIBS=['utils', 147 EXTRA_LIBS=['utils',
148 'gio', 148 'gio',
149 'platform', 149 'platform',
150 'ncopcode_utils']) 150 'ncopcode_utils'])
151 151
152 env.Requires(ncdecode_tablegen, crt) 152 env.Requires(ncdecode_tablegen, crt)
153 153
154 # Segment register validator library 154 # Segment register validator library
155 NCVALIDATE_SOURCES = ['nacl_cpuid.c', 155 NCVALIDATE_SOURCES = ['nacl_cpuid.c',
156 'ncdecode.c', 156 'ncdecode.c',
157 'ncinstbuffer.c', 157 'ncinstbuffer.c',
158 'nc_segment.c', 158 'nc_segment.c',
159 'nc_inst_iter.c', 159 'nc_inst_iter.c',
160 'nc_inst_state.c', 160 'nc_inst_state.c',
161 'nc_inst_trans.c', 161 'nc_inst_trans.c',
162 'ncop_exps.c', 162 'ncop_exps.c',
163 'ncvalidate.c', 163 'ncvalidate.c',
164 'nccopycode.c', 164 'nccopycode.c',
165 'nccopycode_stores.S' 165 'nccopycode_stores.S'
166 ] 166 ]
167 if env.Bit('target_x86_64'): 167
168 NCVALIDATE_SOURCES = NCVALIDATE_SOURCES + ncopcode_desc_o 168 NCVALIDATE_SOURCES = NCVALIDATE_SOURCES + ncopcode_desc_o
169 169
170 env.ComponentLibrary('ncvalidate', NCVALIDATE_SOURCES) 170 env.ComponentLibrary('ncvalidate', NCVALIDATE_SOURCES)
171 171
172 # SFI validator library 172 # SFI validator library.
173 # Note: When loading this library, follow it with ncvalidate, since
174 # it contains many routines and constants needed by this library.
173 env.ComponentLibrary('ncvalidate_sfi', 175 env.ComponentLibrary('ncvalidate_sfi',
174 ['ncvalidate_iter.c', 176 ['ncvalidate_iter.c',
175 'ncvalidator_registry.c', 177 'ncvalidator_registry.c',
176 'nc_opcode_histogram.c', 178 'nc_opcode_histogram.c',
177 'nc_cpu_checks.c', 179 'nc_cpu_checks.c',
178 'nc_illegal.c', 180 'nc_illegal.c',
179 'nc_protect_base.c', 181 'nc_protect_base.c',
180 'nc_memory_protect.c', 182 'nc_memory_protect.c',
181 'ncvalidate_utils.c', 183 'ncvalidate_utils.c',
182 'nc_jumps.c']) 184 'nc_jumps.c'])
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 # ====================================================================== 281 # ======================================================================
280 ncdis = test_env.ComponentProgram( 282 ncdis = test_env.ComponentProgram(
281 'ncdis', [ 283 'ncdis', [
282 'ncdis.c', 284 'ncdis.c',
283 force_cpp, 285 force_cpp,
284 ], 286 ],
285 EXTRA_LIBS=[ 287 EXTRA_LIBS=[
286 'ncdis_util', 288 'ncdis_util',
287 'utils', 289 'utils',
288 'ncvalidate', 290 'ncvalidate',
289 'ncopcode_utils',
290 'nchelper', 291 'nchelper',
291 'ncdis_util', 292 'ncdis_util',
292 'platform', 293 'platform',
293 'gio' 294 'gio'
294 ]) 295 ])
295 296
296 env.Requires(ncdis, crt) 297 env.Requires(ncdis, crt)
297 298
298 # ====================================================================== 299 # ======================================================================
299 # Valiator unittests 300 # Valiator unittests
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 # Segment register validator. 387 # Segment register validator.
387 ncval = test_env.ComponentProgram( 388 ncval = test_env.ComponentProgram(
388 'ncval', [ 389 'ncval', [
389 'ncval.c', 390 'ncval.c',
390 force_cpp, 391 force_cpp,
391 ], 392 ],
392 EXTRA_LIBS=[ 393 EXTRA_LIBS=[
393 'ncdis_util', 394 'ncdis_util',
394 'ncvalidate_sfi', 395 'ncvalidate_sfi',
395 'ncvalidate', 396 'ncvalidate',
396 'ncopcode_utils',
397 'nchelper', 397 'nchelper',
398 'platform', 398 'platform',
399 'gio', 399 'gio',
400 'utils' 400 'utils'
401 ]) 401 ])
402 402
403 test_env.Requires(ncval, crt) 403 test_env.Requires(ncval, crt)
404 404
405 # ====================================================================== 405 # ======================================================================
406 # Validator tests against real nacl images 406 # Validator tests against real nacl images
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 stdin = __BaseTestFile(base, 'hex'), 560 stdin = __BaseTestFile(base, 'hex'),
561 stdout_golden = __BaseTestFile(base, ext)) 561 stdout_golden = __BaseTestFile(base, ext))
562 __AddTest(test, test_env, base, ext, node_val, 562 __AddTest(test, test_env, base, ext, node_val,
563 ['small_tests', 'validator_tests']) 563 ['small_tests', 'validator_tests'])
564 564
565 __AddNegMaxErrors() 565 __AddNegMaxErrors()
566 566
567 #---------- UNIT TESTS --------------------------------- 567 #---------- UNIT TESTS ---------------------------------
568 568
569 # Create an environment to run unit tests using Gtest. 569 # Create an environment to run unit tests using Gtest.
570 gtest_env = env.Clone(); 570 gtest_env = test_env.Clone();
571 # gtest does not compile with our stringent settings. 571 # gtest does not compile with our stringent settings.
572 gtest_env.FilterOut( 572 gtest_env.FilterOut(
573 CCFLAGS=['-pedantic'], 573 CCFLAGS=['-pedantic'],
574 CXXFLAGS=['-fno-rtti', '-Weffc++']) 574 CXXFLAGS=['-fno-rtti', '-Weffc++'])
575 gtest_env.Prepend(CPPPATH=['${SOURCE_ROOT}/testing/gtest/include']) 575 gtest_env.Prepend(CPPPATH=['${SOURCE_ROOT}/testing/gtest/include'])
576 576
577 # List of (unit) test file prefixes to run unit tests on. 577 # List of (unit) test file prefixes to run unit tests on.
578 gtest_sources = ['NCRemainingMemory', 578 gtest_sources = ['NCRemainingMemory',
579 'NCInstBytes'] 579 'NCInstBytes',
580 'nc_inst_state_']
580 581
581 for source in gtest_sources: 582 for source in gtest_sources:
582 test_exe = gtest_env.ComponentProgram( 583 test_exe = gtest_env.ComponentProgram(
583 'x86_validator_tests' + source, 584 'x86_validator_tests' + source,
584 [source+'Tests.cc'], 585 [source+'Tests.cc'],
585 EXTRA_LIBS=['gtest', 'ncvalidate']); 586 EXTRA_LIBS=['gtest',
587 'ncvalidate',
588 'platform',
589 'gio',
590 ]);
586 test_node = gtest_env.CommandTest( 591 test_node = gtest_env.CommandTest(
587 source+'Tests.out', 592 source+'Tests.out',
588 command=[test_exe]) 593 command=[test_exe])
589 gtest_env.AddNodeToTestSuite(test_node, ['small_tests'], 594 gtest_env.AddNodeToTestSuite(test_node, ['small_tests'],
590 'run_x86_validator_tests') 595 'run_x86_validator_tests')
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698