Merge lp:~pwlars/lava-dispatcher/stop-test-on-timeout into lp:lava-dispatcher

Proposed by Paul Larson
Status: Merged
Merged at revision: 117
Proposed branch: lp:~pwlars/lava-dispatcher/stop-test-on-timeout
Merge into: lp:lava-dispatcher
Diff against target: 20 lines (+9/-1)
1 file modified
lava_dispatcher/actions/lava-test.py (+9/-1)
To merge this branch: bzr merge lp:~pwlars/lava-dispatcher/stop-test-on-timeout
Reviewer Review Type Date Requested Status
Spring Zhang (community) Approve
Michael Hudson-Doyle (community) Approve
Review via email: mp+76261@code.launchpad.net

Description of the change

Tested this locally using pwrmgmt test and a 5 second timeout. Worked
great. Hopefully this will prevent future events like we saw recently
with that test.

To post a comment you must log in.
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Looks OK, I kinda hate bare except:s but as you re-raise at least one of them is probably justifiable :-) We should put some logging statements in when the logging branch lands.

review: Approve
Revision history for this message
Spring Zhang (qzhang) wrote :

In fact, in run_shell_command(), rc expect will capture TIMEOUT itself, in this step it won't raise a exception if TIMEOUT, I don't know if it matters. It may make the try statement no sense, but exception can raise when 'response' not expected.
9 + try:
10 + rc = client.run_cmd_tester(cmd, timeout=timeout)

        id = self.proc.expect([pattern1, pexpect.EOF, pexpect.TIMEOUT],
                timeout=timeout)
        if id == 0:
            rc = int(self.proc.match.groups()[0])
        else:
            rc = None
        return rc

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lava_dispatcher/actions/lava-test.py'
2--- lava_dispatcher/actions/lava-test.py 2011-09-16 02:37:57 +0000
3+++ lava_dispatcher/actions/lava-test.py 2011-09-20 16:43:56 +0000
4@@ -85,7 +85,15 @@
5 bundle_name = test_name + "-" + datetime.now().strftime("%H%M%S")
6 cmd = ('lava-test run %s -o %s/%s.bundle' % (
7 test_name, self.context.lava_result_dir, bundle_name))
8- rc = client.run_cmd_tester(cmd, timeout=timeout)
9+ try:
10+ rc = client.run_cmd_tester(cmd, timeout=timeout)
11+ except:
12+ client.proc.sendcontrol('c')
13+ try:
14+ client.run_cmd_tester('true', timeout=20)
15+ except:
16+ client.boot_linaro_image()
17+ raise
18 if rc is None:
19 raise OperationFailed("test case getting return value failed")
20 elif rc != 0:

Subscribers

People subscribed via source and target branches