From: Jacob Lifshay Date: Tue, 20 Feb 2024 04:33:16 +0000 (-0800) Subject: test/common: add skip_case_slow that skips unless RUN_SLOW env var is set X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=adfef6ed6a57f5214eeaa55c055b4eb78d2826c2;p=openpower-isa.git test/common: add skip_case_slow that skips unless RUN_SLOW env var is set --- diff --git a/src/openpower/test/common.py b/src/openpower/test/common.py index b3b89876..b11034a5 100644 --- a/src/openpower/test/common.py +++ b/src/openpower/test/common.py @@ -95,6 +95,26 @@ def skip_case_if(condition, reason): return skip_case(reason, __condition=condition) +def __is_run_slow_not_set(ta): + # allow RUN_SLOW being set to the empty string to act like it isn't set + return os.environ.get("RUN_SLOW", "") == "" + + +def skip_case_slow(reason): + """ + Conditionally skip a test case if the RUN_SLOW env var isn't set. + + Use like: + @skip_case_slow("my reason why it's slow") + + For use with TestAccumulatorBase + """ + # pass a function to run the test in TestAccumulatorBase.__init__ rather + # than at module load time. + return skip_case_if(__is_run_slow_not_set, + "RUN_SLOW env var not set; " + reason) + + def skip_case_if_flag(flag_name): """ Skip a test case if `flag_name in TestAccumulatorBase.flags`.