Right, the try-except-finally won't work in 2.4, sorry about that.

diff --git a/client/bin/job.py b/client/bin/job.py
index 3e285c6..ded3987 100644
--- a/client/bin/job.py
+++ b/client/bin/job.py
@@ -599,26 +599,27 @@ class base_client_job(base_job.base_job):
         """
 
         try:
-            self.record('START', subdir, testname)
-            self._state.set('client', 'unexpected_reboot', (subdir, testname))
-            result = function(*args, **dargs)
-            self.record('END GOOD', subdir, testname)
-            return result
-        except error.TestBaseException, e:
-            self.record('END %s' % e.exit_status, subdir, testname)
-            raise
-        except error.JobError, e:
-            self.record('END ABORT', subdir, testname)
-            raise
-        except Exception, e:
-            # This should only ever happen due to a bug in the given
-            # function's code.  The common case of being called by
-            # run_test() will never reach this.  If a control file called
-            # run_group() itself, bugs in its function will be caught
-            # here.
-            err_msg = str(e) + '\n' + traceback.format_exc()
-            self.record('END ERROR', subdir, testname, err_msg)
-            raise
+            try:
+                self.record('START', subdir, testname)
+                self._state.set('client', 'unexpected_reboot', (subdir, 
testname))
+                result = function(*args, **dargs)
+                self.record('END GOOD', subdir, testname)
+                return result
+            except error.TestBaseException, e:
+                self.record('END %s' % e.exit_status, subdir, testname)
+                raise
+            except error.JobError, e:
+                self.record('END ABORT', subdir, testname)
+                raise
+            except Exception, e:
+                # This should only ever happen due to a bug in the given
+                # function's code.  The common case of being called by
+                # run_test() will never reach this.  If a control file called
+                # run_group() itself, bugs in its function will be caught
+                # here.
+                err_msg = str(e) + '\n' + traceback.format_exc()
+                self.record('END ERROR', subdir, testname, err_msg)
+                raise
         finally:
             self._state.discard('client', 'unexpected_reboot')


----- Original Message -----
From: "Amos Kong" <[email protected]>
To: [email protected]
Cc: [email protected]
Sent: Thursday, February 10, 2011 7:17:23 AM
Subject: [Autotest] unsupported syntax by python 2.4


the following commit contains an unsupported syntax (python 2.4)

commit ce81d75569cd72a16beae359e6a8f5d91d1d5f88
Author: lmr <lmr@592f7852-d20e-0410-864c-8624ca9c26a4>
Date:   Sat Jan 29 01:21:40 2011 +0000

    Let harness know about failed test after unexpected reboot

    If test causes unexpected reboot, its state is not logged
    and harness also doesn't get called. Side-effect is
    that group_level/indent_level will be more than expected
    and autotest fails with AssertionError.

    Signed-off-by: Jan Stancek <[email protected]>

[root@t173 kvm]# ../../bin/autotest control --verbose
Traceback (most recent call last):
  File "../../bin/autotest", line 8, in ?
    from autotest_lib.client.bin import job
  File "/home/devel/autotest-upstream/client/bin/job.py", line 622
    finally:
          ^
SyntaxError: invalid syntax
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to