Whamcloud - gitweb
LU-16279 lnet: improve error reporting in LUTF 87/48987/2
authorCyril Bordage <cbordage@whamcloud.com>
Mon, 31 Oct 2022 11:08:44 +0000 (12:08 +0100)
committerOleg Drokin <green@whamcloud.com>
Sat, 7 Jan 2023 07:55:33 +0000 (07:55 +0000)
When an error occurs without using an RPC, the error reporting lacks
of traceback, listing only the exception itself. This patch adds the
traceback to the error string reported by R().

Test-Parameters: @lnet
Signed-off-by: Cyril Bordage <cbordage@whamcloud.com>
Change-Id: I3fe5f7628a3f96aeb7941ec75db6b6b5e49e9d84
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/48987
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Frank Sehr <fsehr@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/lutf/python/infra/lutf.py

index 1d4b751..bec5e6c 100644 (file)
@@ -325,7 +325,7 @@ class Script:
                                                if type(e) == LUTFError and e.halt:
                                                        raise e
                                                else:
-                                                       rc = {'status': 'FAIL', 'error': str(e)}
+                                                       rc = {'status': 'FAIL', 'error': traceback.format_exc()}
                                                        skip_test = True
                        if skip_test:
                                rc['reason'] = 'Test setup cleanup failed'
@@ -346,7 +346,7 @@ class Script:
                                        if type(e) == LUTFError and e.halt:
                                                raise e
                                        else:
-                                               rc = {'status': 'FAIL', 'error': str(e)}
+                                               rc = {'status': 'FAIL', 'error': traceback.format_exc()}
 
                        logging.debug("Finished test script: %s" % str(self.name))
                        duration = datetime.datetime.now() - start_time