diff --git a/lisa/exekall_customize.py b/lisa/exekall_customize.py index 9e9b1d6c5dfc1a54551379d4a6da3133dce3e2c1..72b5e8e956b94f49d994bf3fa12b756452a6f09d 100644 --- a/lisa/exekall_customize.py +++ b/lisa/exekall_customize.py @@ -30,11 +30,11 @@ from lisa.trace import FtraceCollector, FtraceConf from lisa.platforms.platinfo import PlatformInfo from lisa.utils import HideExekallID, Loggable, ArtifactPath, get_subclasses, groupby, Serializable from lisa.conf import MultiSrcConf -from lisa.tests.base import TestBundle, ResultBundle +from lisa.tests.base import TestBundle, ResultBundle, Result from lisa.tests.scheduler.load_tracking import InvarianceItem from lisa.regression import compute_regressions -from exekall.utils import get_name, get_method_class, add_argument +from exekall.utils import get_name, get_method_class, add_argument, NoValue, flatten_seq from exekall.engine import ExprData, Consumer, PrebuiltOperator from exekall.customization import AdaptorBase @@ -367,3 +367,25 @@ comparison. Can be repeated.""") tags = {k: v for k, v in tags.items() if v is not None} return tags + + def get_run_exit_code(self, result_map): + expr_val_list = flatten_seq( + expr_val_list + for expr, expr_val_list in result_map.items() + ) + + for expr_val in expr_val_list: + # An exception happened + if expr_val.get_excep(): + return 20 + + val = expr_val.value + if isinstance(val, ResultBundle): + if val.result is Result.FAILED: + return 10 + return 0 + + + + + diff --git a/tools/exekall/exekall/customization.py b/tools/exekall/exekall/customization.py index 343a47f37eaed1acff261573e07fc30c5b692964..b0cf5291dd12b926fe8d6c1e0e02256efa4a28d7 100644 --- a/tools/exekall/exekall/customization.py +++ b/tools/exekall/exekall/customization.py @@ -201,7 +201,7 @@ class AdaptorBase: :param result_map: Dictionary of expressions to the list of their values. :type result_map: dict(exekall.engine.ComputableExpression, - exekall.engine.ExprVal) + list(exekall.engine.ExprVal)) """ hidden_callable_set = { op.callable_ @@ -233,6 +233,17 @@ class AdaptorBase: )) return '\n'.join(summary) + def get_run_exit_code(self, result_map): + """ + Return an integer used as ``exekall run`` exit status. + + :param result_map: Dictionary of expressions to the list of their + values. + :type result_map: dict(exekall.engine.ComputableExpression, + exekall.engine.ExprVal) + """ + return 0 + @classmethod def get_adaptor_cls(cls, name=None): """ diff --git a/tools/exekall/exekall/main.py b/tools/exekall/exekall/main.py index 7ba064b0b31b0db394336608ddd7b5aab038f2a2..92d8af8dc0b1fbf488f1637a4b8a267afe0d719f 100755 --- a/tools/exekall/exekall/main.py +++ b/tools/exekall/exekall/main.py @@ -1142,7 +1142,7 @@ def exec_expr_list(iteration_expr_list, adaptor, artifact_dir, testsession_uuid, with script_path.open('wt', encoding='utf-8') as f: f.write(all_scripts + '\n') - return 0 + return adaptor.get_run_exit_code(result_map) SILENT_EXCEPTIONS = (KeyboardInterrupt, BrokenPipeError) GENERIC_ERROR_CODE = 1