update travis.

This commit is contained in:
philopon 2014-08-26 21:07:57 +09:00
parent a64557ede7
commit 08973f15ba
4 changed files with 45 additions and 0 deletions

7
.travis-script.sh Normal file
View File

@ -0,0 +1,7 @@
#!/bin/bash
memcached &
cabal configure --enable-tests
cabal build
cabal test

View File

@ -2,3 +2,4 @@ language: haskell
ghc:
- 7.8
- 7.6
script: bash -eu .travis-script.sh

View File

@ -28,3 +28,16 @@ library
ghc-options: -Wall -O2
hs-source-dirs: src
default-language: Haskell2010
test-suite test
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: test.hs
ghc-options: -Wall -O2
build-depends: base >=4.6 && <4.8
, memcached-binary
, test-framework >=0.8 && <0.9
, test-framework-hunit >=0.3 && <0.4
, process >=1.2 && <1.3
, network >=2.6 && <2.7
default-language: Haskell2010

24
test/test.hs Normal file
View File

@ -0,0 +1,24 @@
{-# LANGUAGE ScopedTypeVariables #-}
import Control.Exception
import Control.Concurrent
import Control.Monad
import Network
import System.Process
import Database.Memcached.Binary
import Test.Framework
import Test.Framework.Providers.HUnit
startMemcached :: IO ProcessHandle
startMemcached = do
h <- spawnProcess "memcached" []
wait (100 :: Int)
return h
where
wait 0 = fail "cannot start server"
wait i = handle (\(_ ::SomeException) -> threadDelay 100000 >> wait (i-1)) $
void $ connectTo "localhost" $ PortNumber 11211
main :: IO ()
main = bracket startMemcached terminateProcess $ \_ -> defaultMain
[ testCase "version" . void $ withConnection def version
]