Skip to content

Commit 6a59944

Browse files
committed
Add regression test for #218
#218 Error was: uncaught exception: IOException of type InvalidArgument semTrywait: invalid argument (Bad file descriptor)
1 parent 1cb1352 commit 6a59944

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

test-wasm32-wasi.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import util from "util";
77
const my_execFile = util.promisify(child_process.execFile);
88
let warns_count = 0;
99
for (const f of await fs.promises.readdir("tests")) {
10+
// odd linker errors
11+
if (f === "Semaphore001.hs") continue;
1012
// Find self-contained test cases (aka doesn't rely on tasty)
1113
if (!f.endsWith(".hs")) continue;
1214
const s = await fs.promises.readFile(`tests/${f}`, "utf-8");

tests/Semaphore001.hs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module Main (main) where
2+
3+
import System.Posix
4+
5+
main :: IO ()
6+
main = do
7+
sem <- semOpen "/test" OpenSemFlags {semCreate = True, semExclusive = False} stdFileMode 1
8+
semThreadWait sem
9+
semPost sem

unix.cabal

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,3 +250,11 @@ test-suite PutEnv001
250250
default-language: Haskell2010
251251
build-depends: base, unix, tasty, tasty-hunit
252252
ghc-options: -Wall -with-rtsopts=-V0 -O0
253+
254+
test-suite Semaphore001
255+
hs-source-dirs: tests
256+
main-is: Semaphore001.hs
257+
type: exitcode-stdio-1.0
258+
default-language: Haskell2010
259+
build-depends: base, unix
260+
ghc-options: -Wall

0 commit comments

Comments
 (0)