packages feed

HTF 0.13.2.2 → 0.13.2.4

raw patch · 13 files changed

+192/−42 lines, 13 filesdep ~basePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base

API changes (from Hackage documentation)

- Test.Framework.ThreadPool: threadPoolTestStop :: IO ()
- Test.Framework.Pretty: class Pretty a where prettyList l = char '[' <> vcat (punctuate comma (map pretty l)) <> char ']' showPretty = render . pretty
+ Test.Framework.Pretty: class Pretty a

Files

+ .travis.yml view
@@ -0,0 +1,35 @@+# Use new container infrastructure to enable caching+sudo: false++# Choose a lightweight base image; we provide our own build tools.+language: c++# GHC depends on GMP. You can add other dependencies here as well.+addons:+  apt:+    packages:+    - libgmp-dev++# The different configurations we want to test. You could also do things like+# change flags or use --stack-yaml to point to a different file.+env:+- HTF_TRAVIS_STACK_ARGS="--stack-yaml ${TRAVIS_BUILD_DIR}/stack-ghc-8.4.yaml"+- HTF_TRAVIS_STACK_ARGS="--stack-yaml ${TRAVIS_BUILD_DIR}/stack.yaml"+- HTF_TRAVIS_STACK_ARGS="--stack-yaml ${TRAVIS_BUILD_DIR}/stack-ghc-8.0.yaml"+- HTF_TRAVIS_STACK_ARGS="--stack-yaml ${TRAVIS_BUILD_DIR}/stack-ghc-7.10.yaml"++before_install:+# Download and unpack the stack executable+- mkdir -p ~/.local/bin+- export PATH=$HOME/.local/bin:$PATH+- travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'++# This line does all of the work: installs GHC if necessary, build the library,+# executables, and test suites, and runs the test suites. --no-terminal works+# around some quirks in Travis's terminal implementation.+script: stack $HTF_TRAVIS_STACK_ARGS --no-terminal --install-ghc test --haddock --cabal-verbose++# Caching so the next build will be fast too.+cache:+  directories:+  - $HOME/.stack
ChangeLog view
@@ -1,4 +1,7 @@-* 0.13.2.{0,1,2} (2017-08-6)+* 0.13.2.3 (2018-03-31)+  - fix build for ghc 8.4++* 0.13.2.{0,1,2} (2017-08-06)   - various build and documentation fixes and improvements  * 0.13.1.0 (2015-08-21)
HTF.cabal view
@@ -1,6 +1,6 @@ Name:             HTF-Version:          0.13.2.2-License:          LGPL+Version:          0.13.2.4+License:          LGPL-2.1 License-File:     LICENSE Copyright:        (c) 2005-2015 Stefan Wehr Author:           Stefan Wehr <wehr@factisresearch.com>@@ -36,6 +36,11 @@   README.md   TODO.org   ChangeLog+  .travis.yml+  stack.yaml+  stack-ghc-7.10.yaml+  stack-ghc-8.0.yaml+  stack-ghc-8.4.yaml   tests/bbt/should_fail/BBTArgs   tests/bbt/should_fail/*.err   tests/bbt/should_fail/*.out@@ -72,6 +77,8 @@   sample/bbt-dir/should-pass/x.num   sample/bbt-dir/should-pass/x.out   scripts/local-htfpp+  scripts/dist.sh+  scripts/check.sh   scripts/run-sample  Source-Repository head
Test/Framework/Pretty.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}+{-# LANGUAGE CPP, FlexibleInstances, TypeSynonymInstances #-}  {- | @@ -19,7 +19,12 @@  where +#if MIN_VERSION_base(4,11,0)+-- Text.PrettyPrint exports (<>) conflicting with newer Prelude.+import Text.PrettyPrint hiding ((<>))+#else import Text.PrettyPrint+#endif  -- | A type class for pretty-printable things. -- Minimal complete definition: @pretty@.
Test/Framework/ThreadPool.hs view
@@ -20,7 +20,7 @@ module Test.Framework.ThreadPool (      ThreadPoolEntry, ThreadPool(..), StopFlag(..), sequentialThreadPool, parallelThreadPool-  , threadPoolTest, threadPoolTestStop+  , threadPoolTest  ) where @@ -39,7 +39,9 @@  type ThreadPoolEntry m a b = ( m a        -- pre-action, must not throw exceptions                              , a -> IO b  -- action-                             , Either Ex.SomeException b -> m StopFlag  -- post-action, must not throw exceptions. If the result is DoStop, the thread pool is terminated asap.+                             , Either Ex.SomeException b -> m StopFlag+                               -- post-action, must not throw exceptions. If the result is+                               -- DoStop, the thread pool is terminated asap.                              )  data ThreadPool m a b@@ -225,33 +227,3 @@     mapM (runTestParallel nEntries) [i..j] `Ex.catch`              (\(e::Ex.BlockedIndefinitelyOnMVar) ->                   fail ("main-thread blocked " ++ show e))--threadPoolTestStop =-    do putStrLn ("Running test to see of STOP works")-       boxesAndEntries <- mapM mkEntry [1..100]-       let (boxes, entries) = unzip boxesAndEntries-       runParallel numberOfThreads entries-       debug ("Checking boxes...")-       mapM_ checkBox (zip [1..] boxes)-       putStrLn ("Test for STOP successful")-    where-      mkEntry i =-          do mvar <- newEmptyNamedMVar ("box-" ++ show i)-             let pre = return ()-                 action () =-                     do putNamedMVar mvar ()-                        return ()-                 post _exc  = return (if i >= numberOfThreads then DoStop else DoNotStop)-             return (mvar, (pre, action, post))-      numberOfThreads = 10-      checkBox (i, (name, box)) =-          do isEmpty <- isEmptyMVar box-             if isEmpty-             then if i > 20-                  then return ()-                  else if i <= 10-                       then fail ("Box " ++ name ++ " is still empty")-                       else return ()-             else if i > 20-                  then fail ("Box " ++ name ++ " not empty")-                  else return ()
+ scripts/check.sh view
@@ -0,0 +1,33 @@+#!/bin/bash++if [ "$1" == "--help" ]; then+    echo "Checks that HTF compiles against all resolvers mentioned in .travis.yml"+    exit 1+fi++set -e++TOP=$(cd $(dirname ${BASH_SOURCE[0]})/.. > /dev/null && pwd -P)+TRAVIS="$TOP/.travis.yml"+if [ ! -e "$TRAVIS" ]; then+    echo "$TRAVIS does not exist!"+    exit 1+fi++YAMLS=$(grep '^- HTF_TRAVIS_STACK_ARGS' "$TRAVIS" | sed 's/^.*="--stack-yaml //g; s/"$//g')++if [ -z "$TRAVIS_BUILD_DIR" ]; then+    export TRAVIS_BUILD_DIR="$TOP"+fi++for yaml in $YAMLS; do+    eval yaml="$yaml" # evaluate variables contained in $yaml+    echo >&2 "Checking with $yaml ..."+    export HTF_TRAVIS_STACK_ARGS="--stack-yaml $yaml"+    stack $HTF_TRAVIS_STACK_ARGS test+    ecode=$?+    if [ $ecode -ne 0 ]; then+        echo >&2 "Check for $yaml failed!"+        exit 1+    fi+done
+ scripts/dist.sh view
@@ -0,0 +1,50 @@+#!/bin/bash++if [ "$1" == "--help" ]; then+    echo "USAGE: $0 [--no-check]"+    echo "Creates an dist tarball and checks that it builds."+    exit 1+fi++no_check=no+if [ "$1" == "--no-check" ]; then+    no_check=yes+fi++version=$(gawk -F: '/^Version:/ { print $2 }' HTF.cabal | sed 's/ //g')++echo "Building version $version"++# Somehow, --test-tarball always because of a strange permission error. That's why+# we do the checks here by hand.++stack sdist . --no-test-tarball || exit 1+tarball=$(find $(pwd)/.stack-work/dist -name "*${version}.tar.gz" | xargs ls -t | head -1)++echo "Distribution tarball is $tarball"++tmp=$(mktemp -d)+tar -C "$tmp" -x -z -f "$tarball" || exit 1++if [ "$no_check" == "yes" ]; then+    echo "Skipping tests as requested"+else+    pushd "${tmp}/HTF-${version}" > /dev/null+    echo "Running checks in directory $(pwd)"+    scripts/check.sh || exit 1+    popd > /dev/null+fi++git_tag="release/${version}"+if ! git tag --points-at HEAD | grep -E "^$git_tag$" > /dev/null; then+    git tag "$git_tag" || exit 1+    echo "Tagged HEAD with $git_tag"+fi++echo+echo+echo 'All checks succeeded, now upload to archive using the following command:'+echo '$ stack upload . --no-test-tarball'+echo+echo 'And do not forget to push all tags:'+echo '$ git push --tags'
scripts/local-htfpp view
@@ -1,11 +1,36 @@ #!/bin/bash +DEBUG=no TOP=$(cd $(dirname ${BASH_SOURCE[0]})/.. > /dev/null && pwd -P)-d=$(stack $HTF_TRAVIS_STACK_ARGS path --dist-dir)-bin="$TOP/$d/build/htfpp/htfpp"+dist=$(stack $HTF_TRAVIS_STACK_ARGS path --dist-dir 2> /dev/null)+find=find+if [ "$(uname)" == "Darwin" ]; then+    find=gfind+fi -if [ ! -x "$bin" ]; then-    echo "No executable found at $bin" >&2-    exit 1+function find_bin()+{+    bin=$($find "$TOP/$dist" -name htfpp -type f -executable -printf "%T+\t%p\n" | sort -r | head -1 | gawk '{print $2}')+}++find_bin++if [ "$DEBUG" == "yes" ]; then+    echo "TOP=$TOP" >&2+    echo "dist=$dist" >&2+    echo "bin=$bin" >&2+fi++if [ -z "$bin" ]; then+    echo "No executable named htfpp found in $TOP/$dist, trying to build it" >&2+    stack $HTF_TRAVIS_STACK_ARGS build 2> /dev/null > /dev/null+    find_bin+    if [ -z "$bin" ]; then+        echo "Still no executable named htfpp found in $TOP/$dist (even after trying to build it)" >&2+        echo "TOP=$TOP" >&2+        echo "dist=$dist" >&2+        find "$TOP/$dist" -type f >&2+        exit 1+    fi fi "$bin" "$@"
+ stack-ghc-7.10.yaml view
@@ -0,0 +1,5 @@+resolver: lts-6.35+flags: {}+packages:+- '.'+extra-deps: []
+ stack-ghc-8.0.yaml view
@@ -0,0 +1,5 @@+resolver: lts-9.21+flags: {}+packages:+- '.'+extra-deps: []
+ stack-ghc-8.4.yaml view
@@ -0,0 +1,6 @@+resolver: nightly-2018-03-31+flags: {}+packages:+- '.'+extra-deps:+- haskell-src-1.0.3.0
+ stack.yaml view
@@ -0,0 +1,5 @@+resolver: lts-11.2+flags: {}+packages:+- '.'+extra-deps: []
tests/ThreadPoolTest.hs view
@@ -31,7 +31,6 @@                           [x] -> return (read x, 100)                           [x, y] -> return (read x, read y)                           _ -> usage-       threadPoolTestStop        threadPoolTest (1, i) nEntries        return ()     where