From a7c646b2d61b1e23eb44b608b843f2673acaa5bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Wed, 27 May 2026 20:40:06 +0200 Subject: Options to select and exclude tests in config file --- src/Run.hs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/Run.hs') diff --git a/src/Run.hs b/src/Run.hs index e1bab46..f3805ea 100644 --- a/src/Run.hs +++ b/src/Run.hs @@ -7,6 +7,7 @@ module Run ( evalGlobalDefs, TestFilter(..), + testFilterFromConfig, filterTests, ) where @@ -37,6 +38,7 @@ import System.Posix.Process import System.Posix.Signals import System.Process +import Config import GDB import Network import Network.Ip @@ -185,6 +187,20 @@ data TestFilter = TestFilter , tfExclude :: [ Text ] } +instance Semigroup TestFilter where + a <> b + | isJust (tfSelect b) = b + | otherwise = a { tfExclude = tfExclude a <> tfExclude b } + +instance Monoid TestFilter where + mempty = TestFilter Nothing [] + +testFilterFromConfig :: Config -> TestFilter +testFilterFromConfig Config {..} = TestFilter + { tfSelect = configSelect + , tfExclude = configExclude + } + filterTests :: TestFilter -> LoadedModules -> Either CustomTestError [ Test ] filterTests TestFilter {..} LoadedModules {..} = do let allTests = concatMap (\m -> ( moduleName m, ) <$> moduleTests m) lmModules -- cgit v1.2.3