From a9f98769fbd07b93342cd263f6dcf3c6e51e4afd Mon Sep 17 00:00:00 2001 From: Andrey Mokhov Date: Fri, 29 Jan 2016 01:18:51 +0000 Subject: [PATCH] Add validate target. See #187. --- src/Rules/Actions.hs | 16 ++++++++++++---- src/Test.hs | 6 +++++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/Rules/Actions.hs b/src/Rules/Actions.hs index 0e4961f5ea..d85e0dc461 100644 --- a/src/Rules/Actions.hs +++ b/src/Rules/Actions.hs @@ -1,8 +1,8 @@ {-# LANGUAGE RecordWildCards #-} module Rules.Actions ( build, buildWithResources, copyFile, createDirectory, removeDirectory, - moveDirectory, fixFile, runConfigure, runMake, applyPatch, renderLibrary, - renderProgram, runBuilder, makeExecutable + moveDirectory, fixFile, runConfigure, runMake, runMakeVerbose, applyPatch, + renderLibrary, renderProgram, runBuilder, makeExecutable ) where import qualified System.Directory as IO @@ -111,7 +111,13 @@ runConfigure dir opts args = do opts' = opts ++ [AddEnv "CONFIG_SHELL" "/bin/bash"] runMake :: FilePath -> [String] -> Action () -runMake dir args = do +runMake = runMakeWithVerbosity False + +runMakeVerbose :: FilePath -> [String] -> Action () +runMakeVerbose = runMakeWithVerbosity True + +runMakeWithVerbosity :: Bool -> FilePath -> [String] -> Action () +runMakeWithVerbosity verbose dir args = do need [dir -/- "Makefile"] path <- builderPath Make @@ -125,7 +131,9 @@ runMake dir args = do let note = if null args then "" else " (" ++ intercalate ", " args ++ ")" putBuild $ "| Run " ++ fixPath ++ note ++ " in " ++ dir ++ "..." - quietly $ cmd Shell (EchoStdout False) fixPath ["-C", dir] args + if verbose + then cmd Shell fixPath ["-C", dir] args + else quietly $ cmd Shell (EchoStdout False) fixPath ["-C", dir] args applyPatch :: FilePath -> FilePath -> Action () applyPatch dir patch = do diff --git a/src/Test.hs b/src/Test.hs index 547e286e6c..06c82eb762 100644 --- a/src/Test.hs +++ b/src/Test.hs @@ -7,12 +7,16 @@ import GHC (rts, libffi) import Oracles.Config.Flag import Oracles.Config.Setting import Oracles.WindowsRoot -- TODO: rename to Oracles.TopDirectory +import Rules.Actions import Settings.Packages import Settings.User -- TODO: clean up after testing testRules :: Rules () -testRules = +testRules = do + "validate" ~> do + runMakeVerbose "testsuite/tests" ["fast"] + "test" ~> do let quote s = "\"" ++ s ++ "\"" yesNo x = quote $ if x then "YES" else "NO"