| OLD | NEW |
| 1 # Copyright 2013 the V8 project authors. All rights reserved. | 1 # Copyright 2013 the V8 project authors. All rights reserved. |
| 2 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
| 3 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
| 4 # met: | 4 # met: |
| 5 # | 5 # |
| 6 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
| 7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
| 8 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
| 9 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
| 10 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 import subprocess | 28 import subprocess |
| 29 import sys | 29 import sys |
| 30 | 30 |
| 31 def wait_processes(processes): |
| 32 for p in processes: |
| 33 if p[1].wait(): |
| 34 print p[0], 'failed' |
| 35 else: |
| 36 print p[0], 'ok' |
| 37 |
| 31 if __name__ == '__main__': | 38 if __name__ == '__main__': |
| 32 if len(sys.argv) < 4: | 39 if len(sys.argv) < 4: |
| 33 error_message = ('Usage:' + sys.argv[0] + | 40 error_message = ('Usage:' + sys.argv[0] + |
| 34 'LEXER_SHELL_PATH FILE_LIST_FILE PARALLEL_PROCESS_COUNT ' + | 41 'LEXER_SHELL_PATH FILE_LIST_FILE PARALLEL_PROCESS_COUNT ' + |
| 35 '[OTHER_ARGS]') | 42 '[OTHER_ARGS]') |
| 36 print >> sys.stderr, error_message | 43 print >> sys.stderr, error_message |
| 37 sys.exit(1) | 44 sys.exit(1) |
| 38 lexer_shell = sys.argv[1] | 45 lexer_shell = sys.argv[1] |
| 39 file_file = sys.argv[2] | 46 file_file = sys.argv[2] |
| 40 process_count = int(sys.argv[3]) | 47 process_count = int(sys.argv[3]) |
| 41 with open(file_file, 'r') as f: | 48 with open(file_file, 'r') as f: |
| 42 test_files = f.read().split('\n') | 49 test_files = f.read().split('\n') |
| 43 | 50 |
| 44 with open('/dev/null', 'w') as dev_null: | 51 with open('/dev/null', 'w') as dev_null: |
| 45 processes = [] | 52 processes = [] |
| 46 for i, f in enumerate(test_files): | 53 for i, f in enumerate(test_files): |
| 47 lexer_shell_args = [lexer_shell, f, '--break-after-illegal'] + sys.argv[4:
] | 54 lexer_shell_args = [lexer_shell, f, '--break-after-illegal'] + sys.argv[4:
] |
| 48 processes.append((f, subprocess.Popen(lexer_shell_args, stdout=dev_null))) | 55 processes.append((f, subprocess.Popen(lexer_shell_args, stdout=dev_null))) |
| 49 if i % process_count == process_count - 1: | 56 if i % process_count == process_count - 1: |
| 50 for p in processes: | 57 wait_processes(processes) |
| 51 if p[1].wait(): | |
| 52 print p[0], 'failed' | |
| 53 else: | |
| 54 print p[0], 'ok' | |
| 55 processes = [] | 58 processes = [] |
| 59 |
| 60 wait_processes(processes) |
| OLD | NEW |