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 atexit | 6 import atexit |
7 import glob | 7 import glob |
8 import os | 8 import os |
9 import platform | 9 import platform |
10 import shutil | 10 import shutil |
(...skipping 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1539 filter_group_only = params.get('filter_group_only', False) | 1539 filter_group_only = params.get('filter_group_only', False) |
1540 post_actions.append( | 1540 post_actions.append( |
1541 GoldenFileCheckAction( | 1541 GoldenFileCheckAction( |
1542 env, stream_file, golden_file, | 1542 env, stream_file, golden_file, |
1543 filter_regex, filter_inverse, filter_group_only)) | 1543 filter_regex, filter_inverse, filter_group_only)) |
1544 | 1544 |
1545 if ShouldUseVerboseOptions(extra): | 1545 if ShouldUseVerboseOptions(extra): |
1546 env.MakeVerboseExtraOptions(target, log_verbosity, extra) | 1546 env.MakeVerboseExtraOptions(target, log_verbosity, extra) |
1547 # Heuristic for when to capture output... | 1547 # Heuristic for when to capture output... |
1548 capture_output = (extra.pop('capture_output', False) | 1548 capture_output = (extra.pop('capture_output', False) |
1549 or 'process_output' in extra) | 1549 or 'process_output_single' in extra) |
1550 node = env.CommandTest(target, | 1550 node = env.CommandTest(target, |
1551 command, | 1551 command, |
1552 # Set to 'huge' so that the browser tester's timeout | 1552 # Set to 'huge' so that the browser tester's timeout |
1553 # takes precedence over the default of the test_suite. | 1553 # takes precedence over the default of the test_suite. |
1554 size='huge', | 1554 size='huge', |
1555 capture_output=capture_output, | 1555 capture_output=capture_output, |
1556 **extra) | 1556 **extra) |
1557 # We can't check output if the test is not run. | 1557 # We can't check output if the test is not run. |
1558 if not env.Bit('do_not_run_tests'): | 1558 if not env.Bit('do_not_run_tests'): |
1559 for action in post_actions: | 1559 for action in post_actions: |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1811 log_file = env.MakeNaClLogOption(target) | 1811 log_file = env.MakeNaClLogOption(target) |
1812 extra['log_file'] = log_file | 1812 extra['log_file'] = log_file |
1813 extra_env = ['NACLLOG=%s' % log_file, | 1813 extra_env = ['NACLLOG=%s' % log_file, |
1814 'NACLVERBOSITY=%d' % log_verbosity] | 1814 'NACLVERBOSITY=%d' % log_verbosity] |
1815 extra['osenv'] = extra.get('osenv', []) + extra_env | 1815 extra['osenv'] = extra.get('osenv', []) + extra_env |
1816 | 1816 |
1817 pre_base_env.AddMethod(MakeVerboseExtraOptions) | 1817 pre_base_env.AddMethod(MakeVerboseExtraOptions) |
1818 | 1818 |
1819 def ShouldUseVerboseOptions(extra): | 1819 def ShouldUseVerboseOptions(extra): |
1820 """ Heuristic for setting up Verbose NACLLOG options. """ | 1820 """ Heuristic for setting up Verbose NACLLOG options. """ |
1821 return ('process_output' in extra or | 1821 return ('process_output_single' in extra or |
1822 'log_golden' in extra) | 1822 'log_golden' in extra) |
1823 | 1823 |
1824 # ---------------------------------------------------------- | 1824 # ---------------------------------------------------------- |
1825 DeclareBit('tests_use_irt', 'Non-browser tests also load the IRT image', False) | 1825 DeclareBit('tests_use_irt', 'Non-browser tests also load the IRT image', False) |
1826 | 1826 |
1827 def CommandSelLdrTestNacl(env, name, nexe, | 1827 def CommandSelLdrTestNacl(env, name, nexe, |
1828 args = None, | 1828 args = None, |
1829 log_verbosity=2, | 1829 log_verbosity=2, |
1830 sel_ldr_flags=None, | 1830 sel_ldr_flags=None, |
1831 loader=None, | 1831 loader=None, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1891 env.Alias('irt_tests', node) | 1891 env.Alias('irt_tests', node) |
1892 return node | 1892 return node |
1893 | 1893 |
1894 pre_base_env.AddMethod(CommandSelLdrTestNacl) | 1894 pre_base_env.AddMethod(CommandSelLdrTestNacl) |
1895 | 1895 |
1896 # ---------------------------------------------------------- | 1896 # ---------------------------------------------------------- |
1897 TEST_EXTRA_ARGS = ['stdin', 'log_file', | 1897 TEST_EXTRA_ARGS = ['stdin', 'log_file', |
1898 'stdout_golden', 'stderr_golden', 'log_golden', | 1898 'stdout_golden', 'stderr_golden', 'log_golden', |
1899 'filter_regex', 'filter_inverse', 'filter_group_only', | 1899 'filter_regex', 'filter_inverse', 'filter_group_only', |
1900 'osenv', 'arch', 'subarch', 'exit_status', 'track_cmdtime', | 1900 'osenv', 'arch', 'subarch', 'exit_status', 'track_cmdtime', |
1901 'process_output', 'using_nacl_signal_handler'] | 1901 'num_runs', 'process_output_single', |
| 1902 'process_output_combined', 'using_nacl_signal_handler'] |
1902 | 1903 |
1903 TEST_TIME_THRESHOLD = { | 1904 TEST_TIME_THRESHOLD = { |
1904 'small': 2, | 1905 'small': 2, |
1905 'medium': 10, | 1906 'medium': 10, |
1906 'large': 60, | 1907 'large': 60, |
1907 'huge': 1800, | 1908 'huge': 1800, |
1908 } | 1909 } |
1909 | 1910 |
1910 # Valgrind handles SIGSEGV in a way our testing tools do not expect. | 1911 # Valgrind handles SIGSEGV in a way our testing tools do not expect. |
1911 UNSUPPORTED_VALGRIND_EXIT_STATUS = ['sigabrt', | 1912 UNSUPPORTED_VALGRIND_EXIT_STATUS = ['sigabrt', |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2003 assert flag_name in TEST_EXTRA_ARGS, repr(flag_name) | 2004 assert flag_name in TEST_EXTRA_ARGS, repr(flag_name) |
2004 if isinstance(flag_value, list): | 2005 if isinstance(flag_value, list): |
2005 # Options to command_tester.py which are actually lists must not be | 2006 # Options to command_tester.py which are actually lists must not be |
2006 # separated by whitespace. This stringifies the lists with a separator | 2007 # separated by whitespace. This stringifies the lists with a separator |
2007 # char to satisfy command_tester. | 2008 # char to satisfy command_tester. |
2008 flag_value = command_tester.StringifyList(flag_value) | 2009 flag_value = command_tester.StringifyList(flag_value) |
2009 # do not add --flag + |flag_name| |flag_value| if | 2010 # do not add --flag + |flag_name| |flag_value| if |
2010 # |flag_value| is false (empty). | 2011 # |flag_value| is false (empty). |
2011 if flag_value: | 2012 if flag_value: |
2012 script_flags.append('--' + flag_name) | 2013 script_flags.append('--' + flag_name) |
| 2014 # Make sure flag values are strings (or SCons objects) when building |
| 2015 # up the command. Right now, this only means convert ints to strings. |
| 2016 if isinstance(flag_value, int): |
| 2017 flag_value = str(flag_value) |
2013 script_flags.append(flag_value) | 2018 script_flags.append(flag_value) |
2014 | 2019 |
2015 # Other extra flags | 2020 # Other extra flags |
2016 if not capture_output: | 2021 if not capture_output: |
2017 script_flags.extend(['--capture_output', '0']) | 2022 script_flags.extend(['--capture_output', '0']) |
2018 | 2023 |
2019 test_script = env.File('${SCONSTRUCT_DIR}/tools/command_tester.py') | 2024 test_script = env.File('${SCONSTRUCT_DIR}/tools/command_tester.py') |
2020 command = ['${PYTHON}', test_script] + script_flags + command | 2025 command = ['${PYTHON}', test_script] + script_flags + command |
2021 return AutoDepsCommand(env, name, command, | 2026 return AutoDepsCommand(env, name, command, |
2022 extra_deps=extra_deps, posix_path=posix_path, | 2027 extra_deps=extra_deps, posix_path=posix_path, |
(...skipping 1626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3649 nacl_env.ValidateSdk() | 3654 nacl_env.ValidateSdk() |
3650 | 3655 |
3651 if BROKEN_TEST_COUNT > 0: | 3656 if BROKEN_TEST_COUNT > 0: |
3652 msg = "There are %d broken tests." % BROKEN_TEST_COUNT | 3657 msg = "There are %d broken tests." % BROKEN_TEST_COUNT |
3653 if GetOption('brief_comstr'): | 3658 if GetOption('brief_comstr'): |
3654 msg += " Add --verbose to the command line for more information." | 3659 msg += " Add --verbose to the command line for more information." |
3655 print msg | 3660 print msg |
3656 | 3661 |
3657 # separate warnings from actual build output | 3662 # separate warnings from actual build output |
3658 Banner('B U I L D - O U T P U T:') | 3663 Banner('B U I L D - O U T P U T:') |
OLD | NEW |