Skip to content

Commit fe84c66

Browse files
committed
feat: provide time indication for integration tests
1 parent fd4f73e commit fe84c66

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tests/integration/IntegrationSpec.hs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import RIO.Process
3131
)
3232
import qualified RIO.Set as Set
3333
import qualified RIO.Text as T
34+
import RIO.Time ( getCurrentTime, diffUTCTime, formatTime, defaultTimeLocale )
3435
import System.Environment ( getExecutablePath, lookupEnv )
3536
import System.Info ( os )
3637
import System.PosixCompat.Files ( createSymbolicLink )
@@ -43,6 +44,7 @@ main = runSimpleApp $ do
4344
logInfo "Initiating Stack integration test running"
4445

4546
options <- getRecord "Stack integration tests"
47+
startTime <- getCurrentTime
4648
results <- runApp options $ do
4749
logInfo "Running with the following environment"
4850
proc "env" [] runProcess_
@@ -60,12 +62,14 @@ main = runSimpleApp $ do
6062
<> fromString (takeFileName next)
6163
res <- test next
6264
loop (idx + 1) rest' (res <> accum)
63-
65+
6466
loop (1 :: Int) (Set.toList tests) mempty
65-
67+
finalTime <- getCurrentTime
6668
let (successes, failures) = partition ((== ExitSuccess) . snd)
6769
$ Map.toList results
68-
70+
let timeDiff = diffUTCTime finalTime startTime
71+
let timeDiffStr = formatTime defaultTimeLocale "%h:%m:%s" timeDiff
72+
logInfo (fromString ("Integration tests ran in : " ++ timeDiffStr))
6973
unless (null successes) $ do
7074
logInfo "Successful tests:"
7175
for_ successes $ \(x, _) -> logInfo $ "- " <> display x
@@ -77,6 +81,7 @@ main = runSimpleApp $ do
7781
logInfo "Failed tests:"
7882
for_ failures $ \(x, ec) -> logInfo $ "- " <> display x <> " - " <> displayShow ec
7983
exitFailure
84+
8085

8186
data Options = Options
8287
{ optSpeed :: Maybe Speed

0 commit comments

Comments
 (0)