summaryrefslogtreecommitdiff
path: root/src/Run.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2026-05-27 20:40:06 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2026-05-31 13:48:13 +0200
commita7c646b2d61b1e23eb44b608b843f2673acaa5bd (patch)
tree8a5294947a1eb78b29ca03d48ba62fec07c2ecad /src/Run.hs
parentbbf1fd0846fa51f74ef01399ab005d4d847becce (diff)
Options to select and exclude tests in config file
Diffstat (limited to 'src/Run.hs')
-rw-r--r--src/Run.hs16
1 files changed, 16 insertions, 0 deletions
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