[commit: packages/process] master: Add test case for GHC Trac 3649 (fa25980)

git at git.haskell.org git at git.haskell.org
Thu Mar 19 11:37:46 UTC 2015


Repository : ssh://git@git.haskell.org/process

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/fa2598000f61235a319c6f9697e1f21808d6ba31/process

>---------------------------------------------------------------

commit fa2598000f61235a319c6f9697e1f21808d6ba31
Author: Michael Snoyman <michael at snoyman.com>
Date:   Tue Feb 17 16:28:03 2015 +0200

    Add test case for GHC Trac 3649


>---------------------------------------------------------------

fa2598000f61235a319c6f9697e1f21808d6ba31
 .travis.yml   |  3 ++-
 process.cabal |  8 ++++++++
 test/main.hs  | 14 ++++++++++++++
 3 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/.travis.yml b/.travis.yml
index a3096e5..ee93e6f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -27,9 +27,10 @@ install:
 
 script:
  - autoreconf -i
- - cabal configure -v2
+ - cabal configure -v2 --enable-tests
  - cabal build
  - cabal check || [ "$CABALVER" == "1.16" ]
+ - ./dist/build/test/test # Using cabal test was giving trouble with cabal 1.22
  - cabal sdist
 # The following scriptlet checks that the resulting source distribution can be built & installed
  - export SRC_TGZ=$(cabal info . | awk '{print $2 ".tar.gz";exit}') ;
diff --git a/process.cabal b/process.cabal
index cfdd7a4..d33e7bc 100644
--- a/process.cabal
+++ b/process.cabal
@@ -68,3 +68,11 @@ library
         extra-libraries: kernel32
     else
         build-depends: unix >= 2.5 && < 2.8
+
+test-suite test
+  default-language: Haskell2010
+  hs-source-dirs: test
+  main-is: main.hs
+  type: exitcode-stdio-1.0
+  build-depends: base
+               , process
diff --git a/test/main.hs b/test/main.hs
new file mode 100644
index 0000000..2d415ce
--- /dev/null
+++ b/test/main.hs
@@ -0,0 +1,14 @@
+import Control.Exception
+import System.IO.Error
+import System.Process
+
+main :: IO ()
+main = do
+    res <- handle (return . Left . isDoesNotExistError) $ do
+        (_, _, _, ph) <- createProcess (proc "definitelydoesnotexist" [])
+            { close_fds = True
+            }
+        fmap Right $ waitForProcess ph
+    case res of
+        Left True -> return ()
+        _ -> error $ show res



More information about the ghc-commits mailing list