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