| OLD | NEW |
| 1 # -*- python -*- | 1 # -*- python -*- |
| 2 # Copyright (c) 2011 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2011 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 sys | 7 import sys |
| 8 Import('env') | 8 Import('env') |
| 9 | 9 |
| 10 # | 10 # |
| 11 # Build the x86 specific library. | 11 # Build the x86 specific library. |
| 12 # | 12 # |
| 13 if not env.Bit('target_x86'): Return() | 13 if not env.Bit('target_x86'): Return() |
| 14 | 14 |
| 15 # Create environment for building the common library for x86 validators. | 15 # Create environment for building the common library for x86 validators. |
| 16 lib_env = env.Clone() | 16 lib_env = env.Clone() |
| 17 lib_env.Append(CPPPATH=['${TARGET_ROOT}']) | 17 lib_env.Append(CPPPATH=['${TARGET_ROOT}']) |
| 18 lib_env.FilterOut(CCFLAGS=['-Wextra', '-Wswitch-enum', '-Wsign-compare']) | 18 lib_env.FilterOut(CCFLAGS=['-Wextra', '-Wswitch-enum', '-Wsign-compare']) |
| 19 | 19 |
| 20 lib_env.ComponentLibrary(lib_env.NaClTargetArchSuffix('ncval_base'), [ | 20 lib_env.ComponentLibrary(lib_env.NaClTargetArchSuffix('ncval_base'), [ |
| 21 'error_reporter.c', | 21 'error_reporter.c', |
| 22 'halt_trim.c', | 22 'halt_trim.c', |
| 23 'nacl_cpuid.c', | |
| 24 'nacl_xgetbv.S', | |
| 25 'ncinstbuffer.c', | 23 'ncinstbuffer.c', |
| 26 'x86_insts.c', | 24 'x86_insts.c', |
| 27 'nc_segment.c', | 25 'nc_segment.c', |
| 28 ]) | 26 ]) |
| 29 | 27 |
| 30 lib_env.ComponentLibrary(lib_env.NaClTargetArchSuffix('ncval_base_verbose'), [ | 28 lib_env.ComponentLibrary(lib_env.NaClTargetArchSuffix('ncval_base_verbose'), [ |
| 31 'error_reporter_verbose.c', | 29 'error_reporter_verbose.c', |
| 32 'x86_insts_verbose.c', | 30 'x86_insts_verbose.c', |
| 33 ]) | 31 ]) |
| 34 | 32 |
| 35 # Create environment for command-line tools and testing, rather than | |
| 36 # part of the TCB. Then define compile-time flag that communicates | |
| 37 # that we are compiling in the test environment (rather than for the TCB). | |
| 38 test_env = lib_env.Clone() | |
| 39 test_env.Append(CCFLAGS=['-DNACL_TRUSTED_BUT_NOT_TCB']) | |
| 40 | |
| 41 nacl_cpuid = test_env.ComponentProgram( | |
| 42 'nacl_cpuid', | |
| 43 ['nacl_cpuid_test.c'], | |
| 44 EXTRA_LIBS=[test_env.NaClTargetArchSuffix('ncval_base')]) | |
| 45 | |
| 46 node = test_env.CommandTest( | |
| 47 'nacl_cpuid_test.out', | |
| 48 [nacl_cpuid]) | |
| 49 test_env.AddNodeToTestSuite(node, ['large_tests'], 'run_nacl_cpuid_test') | |
| 50 | |
| 51 #---------- UNIT TESTS --------------------------------- | 33 #---------- UNIT TESTS --------------------------------- |
| 52 | 34 |
| 53 # Create an environment to run unit tests using Gtest. | 35 # Create an environment to run unit tests using Gtest. |
| 54 gtest_env = env.MakeGTestEnv() | 36 gtest_env = env.MakeGTestEnv() |
| 55 | 37 |
| 56 # List of (unit) test file prefixes to run unit tests on. | 38 # List of (unit) test file prefixes to run unit tests on. |
| 57 gtest_sources = [ | 39 gtest_sources = [ |
| 58 'halt_trim', | 40 'halt_trim', |
| 59 'nc_remaining_memory', | 41 'nc_remaining_memory', |
| 60 'nc_inst_bytes', | 42 'nc_inst_bytes', |
| 61 ] | 43 ] |
| 62 | 44 |
| 63 for source in gtest_sources: | 45 for source in gtest_sources: |
| 64 test_exe = gtest_env.ComponentProgram( | 46 test_exe = gtest_env.ComponentProgram( |
| 65 'x86_validator_tests_' + source, | 47 'x86_validator_tests_' + source, |
| 66 [source+'_tests.cc'], | 48 [source+'_tests.cc'], |
| 67 EXTRA_LIBS=[gtest_env.NaClTargetArchSuffix('ncvalidate')]) | 49 EXTRA_LIBS=[gtest_env.NaClTargetArchSuffix('ncvalidate')]) |
| 68 test_node = gtest_env.CommandTest( | 50 test_node = gtest_env.CommandTest( |
| 69 source+'Tests.out', | 51 source+'Tests.out', |
| 70 command=[test_exe]) | 52 command=[test_exe]) |
| 71 gtest_env.AddNodeToTestSuite(test_node, ['small_tests'], | 53 gtest_env.AddNodeToTestSuite(test_node, ['small_tests'], |
| 72 'run_x86_validator_tests') | 54 'run_x86_validator_tests') |
| OLD | NEW |