Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 atexit | 6 import atexit |
| 7 import json | 7 import json |
| 8 import os | 8 import os |
| 9 import platform | 9 import platform |
| 10 import re | 10 import re |
| (...skipping 1606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1617 assert len(node) == 1, node | 1617 assert len(node) == 1, node |
| 1618 return node[0] | 1618 return node[0] |
| 1619 | 1619 |
| 1620 pre_base_env.AddMethod(GetTranslatedNexe) | 1620 pre_base_env.AddMethod(GetTranslatedNexe) |
| 1621 | 1621 |
| 1622 | 1622 |
| 1623 def CommandTestFileDumpCheck(env, | 1623 def CommandTestFileDumpCheck(env, |
| 1624 name, | 1624 name, |
| 1625 target, | 1625 target, |
| 1626 check_file, | 1626 check_file, |
| 1627 objdump_flags): | 1627 objdump_flags, |
| 1628 use_llvm_filecheck=False): | |
| 1628 """Create a test that disassembles a binary (|target|) and checks for | 1629 """Create a test that disassembles a binary (|target|) and checks for |
| 1629 patterns in the |check_file|. Disassembly is done using |objdump_flags|. | 1630 patterns in the |check_file|. Disassembly is done using |objdump_flags|. |
| 1630 """ | 1631 """ |
| 1631 | 1632 |
| 1632 # Do not try to run OBJDUMP if 'built_elsewhere', since that *might* mean | 1633 # Do not try to run OBJDUMP if 'built_elsewhere', since that *might* mean |
| 1633 # that a toolchain is not even present. E.g., the arm hw buildbots do | 1634 # that a toolchain is not even present. E.g., the arm hw buildbots do |
| 1634 # not have the pnacl toolchain. We should be able to look for the host | 1635 # not have the pnacl toolchain. We should be able to look for the host |
| 1635 # ARM objdump though... a TODO(jvoung) for when there is time. | 1636 # ARM objdump though... a TODO(jvoung) for when there is time. |
| 1636 if env.Bit('built_elsewhere'): | 1637 if env.Bit('built_elsewhere'): |
| 1637 return [] | 1638 return [] |
| 1638 target = env.GetTranslatedNexe(target) | 1639 target = env.GetTranslatedNexe(target) |
| 1639 return env.CommandTestFileCheck(name, | 1640 return env.CommandTestFileCheck(name, |
| 1640 ['${OBJDUMP}', objdump_flags, target], | 1641 ['${OBJDUMP}', objdump_flags, target], |
| 1641 check_file) | 1642 check_file, use_llvm_filecheck) |
| 1642 | 1643 |
| 1643 pre_base_env.AddMethod(CommandTestFileDumpCheck) | 1644 pre_base_env.AddMethod(CommandTestFileDumpCheck) |
| 1644 | 1645 |
| 1645 | 1646 def CommandTestFileCheck(env, name, cmd, check_file, use_llvm_filecheck=False): |
| 1646 def CommandTestFileCheck(env, name, cmd, check_file): | |
| 1647 """Create a test that runs a |cmd| (array of strings), | 1647 """Create a test that runs a |cmd| (array of strings), |
| 1648 which is expected to print to stdout. The results | 1648 which is expected to print to stdout. The results |
| 1649 of stdout will then be piped to the file_check.py tool which | 1649 of stdout will then be piped to the file_check.py tool which |
| 1650 will search for the regexes specified in |check_file|. """ | 1650 will search for the regexes specified in |check_file|. """ |
| 1651 | 1651 |
| 1652 return env.CommandTest(name, | 1652 if use_llvm_filecheck: |
| 1653 return env.CommandTest(name, | |
| 1654 [env.File('${SCONSTRUCT_DIR}/tools/llvm_file_check_wrap per.sh'), | |
|
Derek Schuff
2015/03/23 16:25:07
Why use a wrapper here instead of just invoking ${
Mircea Trofin
2015/03/23 17:27:20
Because we want to run FileCheck | <dump command>,
JF
2015/03/23 17:42:10
you should add this as a comment in the wrapper.
| |
| 1655 '${FILECHECK}', | |
| 1656 check_file] + cmd) | |
| 1657 else: | |
| 1658 return env.CommandTest(name, | |
| 1653 ['${PYTHON}', | 1659 ['${PYTHON}', |
| 1654 env.File('${SCONSTRUCT_DIR}/tools/file_check.py'), | 1660 env.File('${SCONSTRUCT_DIR}/tools/file_check.py'), |
| 1655 check_file] + cmd, | 1661 check_file] + cmd, |
| 1656 # don't run ${PYTHON} under the emulator. | 1662 # don't run ${PYTHON} under the emulator. |
| 1657 direct_emulation=False) | 1663 direct_emulation=False) |
| 1658 | 1664 |
| 1659 pre_base_env.AddMethod(CommandTestFileCheck) | 1665 pre_base_env.AddMethod(CommandTestFileCheck) |
| 1660 | 1666 |
| 1661 def CommandSelLdrTestNacl(env, name, nexe, | 1667 def CommandSelLdrTestNacl(env, name, nexe, |
| 1662 args = None, | 1668 args = None, |
| 1663 log_verbosity=2, | 1669 log_verbosity=2, |
| 1664 sel_ldr_flags=None, | 1670 sel_ldr_flags=None, |
| 1665 loader=None, | 1671 loader=None, |
| (...skipping 2344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4010 nacl_env.ValidateSdk() | 4016 nacl_env.ValidateSdk() |
| 4011 | 4017 |
| 4012 if BROKEN_TEST_COUNT > 0: | 4018 if BROKEN_TEST_COUNT > 0: |
| 4013 msg = "There are %d broken tests." % BROKEN_TEST_COUNT | 4019 msg = "There are %d broken tests." % BROKEN_TEST_COUNT |
| 4014 if GetOption('brief_comstr'): | 4020 if GetOption('brief_comstr'): |
| 4015 msg += " Add --verbose to the command line for more information." | 4021 msg += " Add --verbose to the command line for more information." |
| 4016 print msg | 4022 print msg |
| 4017 | 4023 |
| 4018 # separate warnings from actual build output | 4024 # separate warnings from actual build output |
| 4019 Banner('B U I L D - O U T P U T:') | 4025 Banner('B U I L D - O U T P U T:') |
| OLD | NEW |