| OLD | NEW |
| 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 # DESCRIPTION : | 6 # DESCRIPTION : |
| 7 # | 7 # |
| 8 # This is an example factory test that does not really do anything -- | 8 # This is an example factory test that does not really do anything -- |
| 9 # it displays a message in the center of the testing area, as | 9 # it displays a message in the center of the testing area, as |
| 10 # communicated by arguments to run_once(). This test makes use of the | 10 # communicated by arguments to run_once(). This test makes use of the |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 status_map = factory.StatusMap(test_list, status_file_path) | 49 status_map = factory.StatusMap(test_list, status_file_path) |
| 50 untested = status_map.filter(ful.UNTESTED) | 50 untested = status_map.filter(ful.UNTESTED) |
| 51 passed = status_map.filter(ful.PASSED) | 51 passed = status_map.filter(ful.PASSED) |
| 52 failed = status_map.filter(ful.FAILED) | 52 failed = status_map.filter(ful.FAILED) |
| 53 | 53 |
| 54 top_label = ful.make_label('UNTESTED=%d\t' % len(untested) + | 54 top_label = ful.make_label('UNTESTED=%d\t' % len(untested) + |
| 55 'PASSED=%d\t' % len(passed) + | 55 'PASSED=%d\t' % len(passed) + |
| 56 'FAILED=%d' % len(failed)) | 56 'FAILED=%d' % len(failed)) |
| 57 | 57 |
| 58 failed_msgs_map = [(t, status_map.lookup_error_msg(t)) for t in failed] | 58 # decompose automated sequence tests |
| 59 failure_report_list = ['%s : %s' % (t.label_en, e) | 59 failure_report_list =[] |
| 60 for t, e in failed_msgs_map] | 60 for t in failed: |
| 61 t_name = t.label_en |
| 62 if not isinstance(t, factory.AutomatedSequence): |
| 63 # Simple Test |
| 64 err_msg = status_map.lookup_error_msg(t) |
| 65 failure_report_list.append('%s: %s' % (t_name, err_msg)) |
| 66 continue |
| 67 # Complex Test |
| 68 for subtest in t.subtest_list: |
| 69 if status_map.lookup_status(subtest) != ful.FAILED: |
| 70 continue |
| 71 err_msg = status_map.lookup_error_msg(subtest) |
| 72 failure_report_list.append( |
| 73 '%s: (%s) %s' % (t_name, subtest.label_en, err_msg)) |
| 61 failure_report = ful.make_label('\n'.join(failure_report_list)) | 74 failure_report = ful.make_label('\n'.join(failure_report_list)) |
| 62 | 75 |
| 63 vbox = gtk.VBox() | 76 vbox = gtk.VBox() |
| 64 vbox.set_spacing(20) | 77 vbox.set_spacing(20) |
| 65 vbox.pack_start(top_label, False, False) | 78 vbox.pack_start(top_label, False, False) |
| 66 vbox.pack_start(failure_report, False, False) | 79 vbox.pack_start(failure_report, False, False) |
| 67 | 80 |
| 68 test_widget = gtk.EventBox() | 81 test_widget = gtk.EventBox() |
| 69 test_widget.modify_bg(gtk.STATE_NORMAL, ful.BLACK) | 82 test_widget.modify_bg(gtk.STATE_NORMAL, ful.BLACK) |
| 70 test_widget.add(vbox) | 83 test_widget.add(vbox) |
| 71 | 84 |
| 72 self._ft_state.run_test_widget( | 85 self._ft_state.run_test_widget( |
| 73 test_widget=test_widget, | 86 test_widget=test_widget, |
| 74 test_widget_size=test_widget_size, | 87 test_widget_size=test_widget_size, |
| 75 window_registration_callback=self.register_callbacks) | 88 window_registration_callback=self.register_callbacks) |
| 76 | 89 |
| 77 factory.log('%s run_once finished' % self.__class__) | 90 factory.log('%s run_once finished' % self.__class__) |
| OLD | NEW |