OLD | NEW |
(Empty) | |
| 1 # -*- python -*- |
| 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 |
| 4 # found in the LICENSE file. |
| 5 |
| 6 import os |
| 7 Import('env') |
| 8 |
| 9 if env.Bit('linux'): |
| 10 env.Append( |
| 11 CXXFLAGS='-Weffc++ -Woverloaded-virtual -fno-rtti -fomit-frame-pointer', |
| 12 ) |
| 13 |
| 14 # NOTE: we cannot use TARGET_ROOT here because we want to share this file |
| 15 # between different scons invocations |
| 16 gen_dec=('${DESTINATION_ROOT}/gen/native_client/src/trusted/validator_mips/' |
| 17 'decode.cc') |
| 18 |
| 19 env.Command(target=gen_dec, |
| 20 source=['mips-opt.table', |
| 21 'dgen/generate_decoder.py', |
| 22 'dgen/dgen_core.py', |
| 23 'dgen/dgen_input.py', |
| 24 'dgen/dgen_opt.py', |
| 25 'dgen/dgen_output.py'], |
| 26 action=['${SOURCES[1].abspath} ${SOURCES[0].abspath} ' |
| 27 '${TARGET.abspath}']) |
| 28 |
| 29 env.ComponentLibrary('mips_validator_core', |
| 30 ['address_set.cc', |
| 31 'validator.cc', |
| 32 gen_dec]) |
| 33 |
| 34 env.ComponentLibrary('ncvalidate_mips', |
| 35 ['ncvalidate.cc'], |
| 36 LIBS=['mips_validator_core', |
| 37 '${OPTIONAL_COVERAGE_LIBS}']) |
| 38 |
| 39 ncval = env.ComponentProgram( |
| 40 'mips-ncval-core', |
| 41 ['ncval.cc'], |
| 42 LIBS=['mips_validator_core', |
| 43 env.NaClTargetArchSuffix('ncfileutils'), |
| 44 '${OPTIONAL_COVERAGE_LIBS}']) |
| 45 |
| 46 env.SDKInstallBin('ncval', ncval, target='mips32') |
| 47 |
| 48 env.ComponentProgram('mips_address_set_test_binary', |
| 49 ['address_set_test.cc'], |
| 50 LIBS=['mips_validator_core', |
| 51 '${OPTIONAL_COVERAGE_LIBS}']) |
| 52 |
| 53 address_set_test = env.Command(target='mips_address_set_test.out', |
| 54 source=['address_set_test_binary'], |
| 55 action=['${SOURCES[0].abspath}']) |
| 56 |
| 57 #env.AddNodeToTestSuite(address_set_test, ['small_tests'], 'address_set_test') |
| 58 |
| 59 validator_tests = { |
| 60 'test_forbidden_instructions': 1, |
| 61 'test_sp_updates': 1, |
| 62 'test_stores': 1, |
| 63 'test_loads': 1, |
| 64 'test_jmp_reg': 1, |
| 65 'test_jmp_imm': 1, |
| 66 'test_read_only_regs': 1, |
| 67 'test_invalid_dest': 1, |
| 68 } |
| 69 |
| 70 for test, exit_status in validator_tests.iteritems(): |
| 71 node = env.CommandTest( |
| 72 test + '_actual_mips.out', |
| 73 [ncval, env.File('testdata/' + test + '.nexe')], |
| 74 exit_status = str(exit_status), |
| 75 filter_regex = "'^ncval'", |
| 76 stderr_golden = env.File('testdata/' + test + '.err')) |
| 77 |
| 78 env.AddNodeToTestSuite(node, ['small_tests', 'validator_tests'], |
| 79 "run_mips_" + test) |
| 80 |
| 81 gtest_env = env.MakeGTestEnv() |
| 82 |
| 83 # Do NOT name this program 'validator_tests' because this is the same name as |
| 84 # a test suite, and scons will run that test suite if it ever builds |
| 85 # a program of the same name. |
| 86 validator_tests_exe = gtest_env.ComponentProgram('mips_validator_tests', |
| 87 ['validator_tests.cc'], |
| 88 EXTRA_LIBS=['mips_validator_core']) |
| 89 |
| 90 test_node = gtest_env.CommandTest( |
| 91 'mips_validator_tests.out', |
| 92 command=[validator_tests_exe]) |
| 93 gtest_env.AddNodeToTestSuite(test_node, ['small_tests'], |
| 94 'run_mips_validator_tests') |
OLD | NEW |