| Index: src/trusted/validator_mips/build.scons
|
| diff --git a/src/trusted/validator_mips/build.scons b/src/trusted/validator_mips/build.scons
|
| new file mode 100755
|
| index 0000000000000000000000000000000000000000..b6fdcbe5dd58687695e5e69f52558d612b450c33
|
| --- /dev/null
|
| +++ b/src/trusted/validator_mips/build.scons
|
| @@ -0,0 +1,118 @@
|
| +# -*- python -*-
|
| +# Copyright (c) 2012 The Native Client Authors. All rights reserved.
|
| +# Use of this source code is governed by a BSD-style license that can be
|
| +# found in the LICENSE file.
|
| +
|
| +import os
|
| +Import('env')
|
| +
|
| +if env.Bit('linux'):
|
| +
|
| + # Defines common arch-independent validator directory.
|
| + COMMON_VAL_DIR = '${MAIN_DIR}/src/trusted/validator'
|
| +
|
| + # Defines this source directory.
|
| + GEN_SRC_DIR = '${MAIN_DIR}/src/trusted/validator_mips/gen'
|
| +
|
| + # Defines the full file name for a generated file.
|
| + def _gen_file(filename):
|
| + return '%s/%s' % (GEN_SRC_DIR, filename)
|
| +
|
| + # Defines the full file name for a file inside common validator directory.
|
| + def _val_dir(filename):
|
| + return '%s/%s' % (COMMON_VAL_DIR, filename)
|
| +
|
| + env.Append(
|
| + CXXFLAGS='-Weffc++ -Woverloaded-virtual -fno-rtti -fomit-frame-pointer',
|
| + )
|
| +
|
| + GEN_LIST = [_gen_file('decode.cc')]
|
| +
|
| + generate = False
|
| + gen_env = env.Clone();
|
| + if 'mipsvalgen' in COMMAND_LINE_TARGETS: generate = True
|
| + if 'mipsvalclean' in COMMAND_LINE_TARGETS: generate = True
|
| +
|
| + if generate:
|
| + gen_env.AlwaysBuild(gen_env.Alias('mipsvalgen', GEN_LIST))
|
| + gen_env.AlwaysBuild(
|
| + gen_env.Alias('mipsvalclean', action=[Delete(x) for x in GEN_LIST]))
|
| +
|
| + def _generate_source(filename):
|
| + env.Command(target=filename,
|
| + source=['mips-opt.table',
|
| + 'dgen/generate_decoder.py',
|
| + 'dgen/dgen_core.py',
|
| + 'dgen/dgen_input.py',
|
| + 'dgen/dgen_opt.py',
|
| + 'dgen/dgen_output.py'],
|
| + action=['${SOURCES[1].abspath} ${SOURCES[0].abspath} '
|
| + '${TARGET.abspath}'])
|
| +
|
| + for f in GEN_LIST:
|
| + _generate_source(f)
|
| +
|
| + env.ComponentLibrary('mips_validator_core',
|
| + ['address_set.cc',
|
| + 'validator.cc',
|
| + 'gen/decode.cc'])
|
| +
|
| + ncval = env.ComponentProgram(
|
| + 'mips-ncval-core',
|
| + ['ncval.cc'],
|
| + LIBS=['mips_validator_core',
|
| + env.NaClTargetArchSuffix('ncfileutils'),
|
| + '${OPTIONAL_COVERAGE_LIBS}'])
|
| +
|
| + env.SDKInstallBin('ncval', ncval, target='mips32')
|
| +
|
| + gtest_env = env.MakeGTestEnv()
|
| +
|
| + address_exe = gtest_env.ComponentProgram('mips_address_set_test_binary',
|
| + ['address_set_test.cc'],
|
| + LIBS=['mips_validator_core', 'gtest', 'pthread',
|
| + '${OPTIONAL_COVERAGE_LIBS}'])
|
| +
|
| + address_set_test = gtest_env.CommandTest('mips_address_set_test.out',
|
| + command=[address_exe])
|
| +
|
| + gtest_env.AddNodeToTestSuite(address_set_test,
|
| + ['small_tests'],
|
| + 'mips_address_set_test')
|
| +
|
| + validator_tests = {
|
| + 'test_forbidden_instructions': 1,
|
| + 'test_sp_updates': 1,
|
| + 'test_stores': 1,
|
| + 'test_loads': 1,
|
| + 'test_jmp_reg': 1,
|
| + 'test_jmp_imm': 1,
|
| + 'test_read_only_regs': 1,
|
| + 'test_invalid_dest': 1,
|
| + }
|
| +
|
| + for test, exit_status in validator_tests.iteritems():
|
| + node = env.CommandTest(
|
| + test + '_actual_mips.out',
|
| + [ncval, env.File('testdata/' + test + '.nexe')],
|
| + exit_status = str(exit_status),
|
| + filter_regex = "'^ncval'",
|
| + stderr_golden = env.File('testdata/' + test + '.err'))
|
| +
|
| + # TODO(petarj): validator_tests need to be disabled until tools for MIPS
|
| + # architecture are available in the repository.
|
| + # env.AddNodeToTestSuite(node, ['small_tests', 'validator_tests'],
|
| + # "run_mips_" + test)
|
| +
|
| + # Do NOT name this program 'validator_tests' because this is the same name as
|
| + # a test suite, and scons will run that test suite if it ever builds
|
| + # a program of the same name.
|
| + validator_tests_exe = gtest_env.ComponentProgram('mips_validator_tests',
|
| + ['validator_tests.cc'],
|
| + EXTRA_LIBS=['mips_validator_core'])
|
| +
|
| + test_node = gtest_env.CommandTest(
|
| + 'mips_validator_tests.out',
|
| + command=[validator_tests_exe])
|
| + gtest_env.AddNodeToTestSuite(test_node, ['small_tests'],
|
| + 'run_mips_validator_tests')
|
|
|