Skip to content

Commit

Permalink
Add regression test for haskell#218
Browse files Browse the repository at this point in the history
haskell#218

Error was:

uncaught exception: IOException of type InvalidArgument
semTrywait: invalid argument (Bad file descriptor)
  • Loading branch information
hasufell committed Jul 17, 2022
1 parent 1cb1352 commit 6a59944
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test-wasm32-wasi.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import util from "util";
const my_execFile = util.promisify(child_process.execFile);
let warns_count = 0;
for (const f of await fs.promises.readdir("tests")) {
// odd linker errors
if (f === "Semaphore001.hs") continue;
// Find self-contained test cases (aka doesn't rely on tasty)
if (!f.endsWith(".hs")) continue;
const s = await fs.promises.readFile(`tests/${f}`, "utf-8");
Expand Down
9 changes: 9 additions & 0 deletions tests/Semaphore001.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Main (main) where

import System.Posix

main :: IO ()
main = do
sem <- semOpen "/test" OpenSemFlags {semCreate = True, semExclusive = False} stdFileMode 1
semThreadWait sem
semPost sem
8 changes: 8 additions & 0 deletions unix.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,11 @@ test-suite PutEnv001
default-language: Haskell2010
build-depends: base, unix, tasty, tasty-hunit
ghc-options: -Wall -with-rtsopts=-V0 -O0

test-suite Semaphore001
hs-source-dirs: tests
main-is: Semaphore001.hs
type: exitcode-stdio-1.0
default-language: Haskell2010
build-depends: base, unix
ghc-options: -Wall

0 comments on commit 6a59944

Please sign in to comment.