Permalink
Browse files

Integrate target tests into a test suite for Stack

Fix #163
  • Loading branch information...
dahlia committed Aug 17, 2017
1 parent fe905b8 commit 089901dc989c04096a159b06aef7d99d206f6cf3
Showing with 47 additions and 18 deletions.
  1. +1 −2 .travis.yml
  2. +9 −4 CONTRIBUTING.md
  3. +0 −1 README.md
  4. +30 −0 app/test-targets.hs
  5. +1 −2 appveyor.yml
  6. +6 −2 package.yaml
  7. +0 −7 test.sh
View
@@ -48,9 +48,8 @@ install:
- travis_long stack --no-terminal setup
- travis_long stack --no-terminal install scan -j4
script:
- stack --no-terminal test -j4 --coverage
- 'TOX="$(which tox)" stack --no-terminal test -j4 --coverage'
- ./lint.sh
- ./test.sh
after_script:
- stack install --install-ghc --no-terminal codecov-haskell
- codecov-haskell Main
View
@@ -48,11 +48,16 @@ we should test:
The former is unit testing and the latter one is integration testing. We have
two commands/scripts to run corresponding testing:
1. `stack test`
2. `./test.sh`
1. `stack test :spec`
2. `stack test :targets`
If you've changed things related to a target backend you should run both
commands. If you've changed pure internals of the compiler probably it's okay
If you've changed things related to a target backend you should test everything:
~~~~~~~~ bash
stack test
~~~~~~~~
If you've changed pure internals of the compiler probably it's okay
to run only the former command. Anyway both testings are run by CI so that
changes breaking either testing cannot be merged.
View
@@ -84,7 +84,6 @@ in the same way to build other Haskell softwares:
You can run the test suite of Nirum:
$ stack test # unit test for compiler
$ ./test.sh # integration test for targets
$ ./lint.sh # style lint
[5]: https://www.haskellstack.org/
View
@@ -0,0 +1,30 @@
{-# LANGUAGE OverloadedStrings, QuasiQuotes #-}
import Control.Monad (when)
import System.Environment (lookupEnv)
import System.IO.Error (catchIOError, isDoesNotExistError)
import qualified Data.Text as T
import Text.InterpolatedString.Perl6 (qq)
import Turtle
proc' :: T.Text -> [T.Text] -> IO ()
proc' prog args =
catchIOError (procs prog args empty) $ \ex ->
if isDoesNotExistError ex
then do err ""
err [qq|Couldn't find executable: "$prog"|]
exit $ ExitFailure 1
else ioError ex
main :: IO ()
main = do
ciEnv <- lookupEnv "CI"
let ci = maybe False (/= "") ciEnv
-- Python target
toxEnv <- lookupEnv "TOX"
let tox = maybe "tox" T.pack toxEnv
when ci $
proc' tox ["-e", "devruntime"]
proc' tox ["--skip-missing-interpreters"]
View
@@ -4,6 +4,7 @@ platform:
- x64
environment:
STACK_ROOT: C:\sr
TOX: C:\Python36\Scripts\tox.exe
cache:
- '%STACK_ROOT% -> appveyor.yml'
- '%LOCALAPPDATA%\Programs\stack -> appveyor.yml'
@@ -40,8 +41,6 @@ after_build:
- ps: upx.exe -9 nirum-win-${env:PLATFORM}.exe
test_script:
- stack --no-terminal test --jobs 1
- C:\Python36\Scripts\tox -e devruntime
- C:\Python36\Scripts\tox
artifacts:
- path: nirum-win-x86.exe
- path: nirum-win-x64.exe
View
@@ -41,6 +41,7 @@ dependencies:
- parsec # only for dealing with htoml's ParserError
- pretty >=1.1.3 && <2
- semver >=0.3.0 && <1.0
- text >=0.9.1.0 && <1.3
- unordered-containers # only for dealing with htoml's data structures
library:
source-dirs: src
@@ -57,7 +58,6 @@ library:
- shakespeare >=2.0.12 && <2.1
- stm >=2.4.4.1
- template-haskell >=2.11 && <3
- text >=0.9.1.0 && <1.3
- uri >=0.1 && <1.0
executables:
nirum:
@@ -101,5 +101,9 @@ tests:
- semigroups
- string-qq >=0.0.2 && <0.1.0
- temporary >=1.2 && <1.3
- text
targets:
main: test-targets.hs
source-dirs: app
dependencies:
- turtle
stability: alpha
View

This file was deleted.

Oops, something went wrong.

0 comments on commit 089901d

Please sign in to comment.