Skip to content

Commit

Permalink
Correct integration test suite invocation
Browse files Browse the repository at this point in the history
  • Loading branch information
recursion-ninja committed Oct 18, 2022
1 parent b38e1e8 commit 104bc41
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 18 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/integration-test-suite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ defaults:

env:
PROJECTFILE: --project-file=cfg/cabal.project.integration
TESTDETAILS: --test-show-details=streaming
TESTOPTIONS: --test-options="--timeout=30s"
THISMAINEXE: PhyGraph:phyg
THISTESTEXE: PHAGE-integration-tests:integration-tests

Expand Down Expand Up @@ -74,11 +76,11 @@ jobs:
- name: 'Cabal - Build'
run: |
cabal build ${PROJECTFILE} ${THISMAINEXE} ${THISTESTEXE} --only-dependencies
cabal build ${THISMAINEXE} ${THISTESTEXE} ${PROJECTFILE} --only-dependencies
- name: 'Cabal - Integration Tests'
run: |
cabal test ${PROJECTFILE} ${THISTESTEXE}
cabal test ${THISTESTEXE} ${PROJECTFILE} ${TESTDETAILS} ${TESTOPTIONS}
- name: Send mail on failure
if: ${{ failure() }}
Expand Down
3 changes: 2 additions & 1 deletion cfg/cabal.project.integration
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ package PHAGE-integration-tests
tests: True
executable-static: False
optimization: 2
flags: -SingleThreaded


package PhyGraph
Expand All @@ -84,7 +85,7 @@ package PhyGraph
tests: False
executable-static: False
optimization: 2
flags: +SingleThreaded
flags: -SingleThreaded


---------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions doc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ The changelog is available [on GitHub][2].
* Major codebase layout rearchitecting
* Added continuous integration via GitHub Actions
* Added integration test-suite
* Added `PHAGE-timing` library for timing IO operations


## 0.1.0
Expand Down
1 change: 1 addition & 0 deletions pkg/PHAGE-timing/CHANGELOG.md
1 change: 1 addition & 0 deletions pkg/PHAGE-timing/LICENSE
47 changes: 47 additions & 0 deletions pkg/PHAGE-timing/PHAGE-timing.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Cabal-Version: 3.0
Name: PHAGE-timing
Version: 0.2.0
Build-Type: Simple
Tested-With:
GHC == 9.2.4

Author: Ward Wheeler <[email protected]>
Copyright: (c) 2015-2022 Ward Wheeler
License: BSD-3-Clause
License-File: LICENSE

Maintainer: Ward Wheeler <[email protected]>
Homepage: https://github.com/wardwheeler/PhyGraph#readme
Bug-Reports: https://github.com/wardwheeler/PhyGraph/issues

Extra-Doc-Files:
CHANGELOG.md
README.md


Library

Build-Depends:
base >= 4.11 && < 5.0,
deepseq >= 1.4 && < 2.0,

Default-Language:
Haskell2010

Exposed-Modules:
System.Timing

Ghc-Options:
-O2
-- Sanity check warnings:
-- 1. Fail on a warning
-- 2. Include all warnings by default
-- 3. Exclude the undesirable warnings
-Werror
-Weverything
-- Exclusions:
-Wno-implicit-prelude
-Wno-missing-kind-signatures

HS-Source-dirs:
src
1 change: 1 addition & 0 deletions pkg/PHAGE-timing/README.md
1 change: 1 addition & 0 deletions pkg/PHAGE-timing/Timing.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE Strict #-}
{-# Language BangPatterns #-}
{-# Language DerivingStrategies #-}
{-# Language Safe #-}
{-# Language Strict #-}

module System.Timing
( CPUTime()
Expand All @@ -16,16 +18,16 @@ module System.Timing
) where


import Control.DeepSeq
import Control.Monad.IO.Class
import Data.Foldable
import Numeric.Natural
import System.CPUTime
import Control.DeepSeq (NFData(rnf), force)
import Control.Monad.IO.Class (MonadIO(liftIO))
import Data.Foldable (fold)
import Numeric.Natural (Natural)
import System.CPUTime (getCPUTime)


-- | CPU time with picosecond resolution
newtype CPUTime = CPUTime Natural
deriving (Eq, Ord)
deriving stock (Eq, Ord)


instance NFData CPUTime where
Expand All @@ -45,6 +47,7 @@ instance Show CPUTime where
| x < day = let (q,r) = x `quotRem` hour in fold [show q, "h", zeroPad 2 (r `div` minute ), "min"]
| otherwise = let (q,r) = x `quotRem` day in fold [show q, "d", zeroPad 2 (r `div` hour ), "hrs"]
where
nSecond :: Natural
nSecond = 1000
μSecond = 1000 * nSecond
mSecond = 1000 * μSecond
Expand All @@ -62,9 +65,9 @@ zeroPad k i = replicate (k - length shown) '0' <> shown

timeOp :: (MonadIO m, NFData a) => m a -> m (CPUTime, a)
timeOp ioa = do
t1 <- liftIO getCPUTime
a <- force <$> ioa
t2 <- liftIO getCPUTime
!t1 <- liftIO getCPUTime
!a <- force <$> ioa
!t2 <- liftIO getCPUTime
let t = CPUTime . fromIntegral $ t2 - t1
pure (t, a)

Expand All @@ -78,15 +81,15 @@ fromPicoseconds = CPUTime


fromMicroseconds :: Natural -> CPUTime
fromMicroseconds = CPUTime . (*1000000)
fromMicroseconds = CPUTime . (* 1000000)


fromMilliseconds :: Natural -> CPUTime
fromMilliseconds = CPUTime . (*1000000000)
fromMilliseconds = CPUTime . (* 1000000000)


fromSeconds :: Natural -> CPUTime
fromSeconds = CPUTime . (*1000000000000)
fromSeconds = CPUTime . (* 1000000000000)


toPicoseconds :: CPUTime -> Natural
Expand Down
2 changes: 1 addition & 1 deletion pkg/PhyGraph/PhyGraph.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ executable phyg
build-depends:
alphabet,
dynamic-character,
PHAGE-timing,
PhyloLib,
tcm,
base >=4.10,
Expand Down Expand Up @@ -219,7 +220,6 @@ executable phyg
Search.SwapMaster
Search.WagnerBuild
Support.Support
System.Timing
Commands.Transform
Types.DistanceTypes
Types.Types
Expand Down

0 comments on commit 104bc41

Please sign in to comment.