Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Unified Diff: client/site_tests/suite_Factory/control

Issue 6614014: autotest/factory: Interrupt tests by factory UI. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: fixing comments Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« client/bin/factory_ui ('K') | « client/bin/factory_ui ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/site_tests/suite_Factory/control
diff --git a/client/site_tests/suite_Factory/control b/client/site_tests/suite_Factory/control
index 2e2d79a5dbd62b959c5c19788ad2a4c0f3fbca15..03ac213a7b3f70a87688a4f31fd62b78489c1eb8 100644
--- a/client/site_tests/suite_Factory/control
+++ b/client/site_tests/suite_Factory/control
@@ -26,6 +26,8 @@ control process). """
import imp
import os
import pprint
+import signal
+import traceback
imp.load_source('common', job.autodir + '/bin/common.py')
@@ -43,14 +45,18 @@ TEST_LIST_PATH = job.autodir + '/site_tests/suite_Factory/test_list'
from autotest_lib.client.bin.parallel import fork_waitfor as orig_fork_waitfor
-def new_fork_waitfor(tmp, pid):
+def factory_fork_waitfor(tmp, pid):
factory.set_shared_data('active_test_data', (tmp, pid))
- try:
- orig_fork_waitfor(tmp, pid)
- except os.error, e:
- raise error.TestError('Test Interrupted (maybe keyboard shortcut)')
+ (pid, status) = os.waitpid(pid, 0)
+ parallel._check_for_subprocess_exception(tmp, pid)
+ if status == signal.SIGTERM:
+ raise error.TestError('Test TERMINATED (return code = %s),\n'
+ 'Maybe caused by hitting keyboard shotcut.' %
+ status)
+ elif status:
+ raise error.TestError("Test FAILED with return code: %d" % (status))
-parallel.fork_waitfor = new_fork_waitfor
+parallel.fork_waitfor = factory_fork_waitfor
# These definitions are expose these classes directly into this
@@ -145,6 +151,11 @@ def step_init(next_subtest_info=None):
ui_notify_fd = ui_process.stdin
ui_notify_obj = FactoryUINotifyObject(ui_notify_fd)
main_loop(next_subtest_info, ui_notify_obj.notify)
+ except:
+ factory.log('suite_Factory failed with exception: ' +
+ traceback.format_exc())
+ # To fix a broken status tree, force a step_init here.
+ job.next_step([step_init])
finally:
stop_process(ui_process, 'ui')
stop_process(state_server_process, 'state server')
« client/bin/factory_ui ('K') | « client/bin/factory_ui ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698