Skip to content

Commit

Permalink
Merge #1016 #1017
Browse files Browse the repository at this point in the history
1016: Unit tests passing on both Windows and Wine r=KtorZ a=rvl

Relates to #703. 

# Overview

Fixes/disables some of the last tests that were failing on Windows for Microsoft reasons.


1017: Update stylish-haskell to latest (v0.9.4.4) r=KtorZ a=rvl

Updates stylish-haskell to the latest.

I mistakenly thought that the latest version in a Stackage LTS would be recent and downgraded it before.

To test:

```
nix-shell --run "stylish-haskell --version"
```


Co-authored-by: Rodney Lorrimar <rodney.lorrimar@iohk.io>
  • Loading branch information
iohk-bors[bot] and rvl authored Nov 13, 2019
3 parents 8e92f48 + 8937f69 + 45fa1ba commit ae18800
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ let
weeder.components.exes.weeder
hlint.components.exes.hlint
])
++ [ pkgs.haskell-nix.snapshots."lts-13.26".stylish-haskell.components.exes.stylish-haskell ]
++ [(pkgs.callPackage ./nix/stylish-haskell.nix {})]
++ (with iohkLib; [ openapi-spec-validator ])
++ [ jormungandr jormungandr-cli
pkgs.pkgconfig pkgs.sqlite-interactive ];
Expand Down
5 changes: 3 additions & 2 deletions lib/core/src/Cardano/Wallet/Api/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ ioToListenError hostPreference portOpt e
| isDoesNotExistError e =
Just (ListenErrorHostDoesNotExist hostPreference)
-- Bad hostname (bind: WSAEOPNOTSUPP) -- Windows
| isUserError e && hasDescription "10045" =
| isUserError e && (hasDescription "11001" || hasDescription "10045") =
Just (ListenErrorHostDoesNotExist hostPreference)
-- Address is valid, but can't be used for listening -- Linux
| show (ioeGetErrorType e) == "invalid argument" =
Expand All @@ -389,7 +389,8 @@ ioToListenError hostPreference portOpt e
| show (ioeGetErrorType e) == "unsupported operation" =
Just (ListenErrorInvalidAddress hostPreference)
-- Address is valid, but can't be used for listening -- Windows
| isOtherError e && hasDescription "WSAEINVAL" =
| isOtherError e &&
(hasDescription "WSAEINVAL" || hasDescription "WSAEADDRNOTAVAIL") =
Just (ListenErrorInvalidAddress hostPreference)
-- Listening on an unavailable or privileged port -- Windows
| isOtherError e && hasDescription "WSAEACCESS" =
Expand Down
1 change: 1 addition & 0 deletions lib/core/test/unit/Cardano/Wallet/Api/ServerSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ spec = describe "API Server" $ do
res `shouldBe` Left ListenErrorOperationNotPermitted

it "handles port in use" $ do
skipOnWindows "Windows permits listening on same port multiple times"
withListeningSocket "127.0.0.1" ListenOnRandomPort $ \case
Right (port, _) ->
withListeningSocket "127.0.0.1" (ListenOnPort port) $ \res ->
Expand Down
1 change: 1 addition & 0 deletions lib/core/test/unit/Network/Wai/Middleware/LoggingSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ spec = describe "Logging Middleware"
void $ mapConcurrently (const (get ctx "/get")) (replicate n ())
entries <- readTVarIO (logs ctx)
let index = Map.fromList [ (loName l, l) | l <- entries ]
pendingOnWindows "Disabled on windows due to race with log flushing"
Map.size index `shouldBe` n

it "correct time measures" $ \ctx -> property $ \(nReq, ix) ->
Expand Down
21 changes: 21 additions & 0 deletions nix/stylish-haskell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{ lib, runCommand, fetchFromGitHub, haskell-nix }:

let
src = fetchFromGitHub {
owner = "jaspervdj";
repo = "stylish-haskell";
rev = "9958a5253a9498c29508895450c4ac47542d5f2a";
sha256 = "1lc2q15qdhv7xnawdqbrxcdhmy4m7h9v6z1sg4qpyvhf93b43bix";
};

pkgSet = haskell-nix.mkStackPkgSet {
stack-pkgs = (haskell-nix.importAndFilterProject (haskell-nix.callStackToNix {
inherit src;
})).pkgs;
pkg-def-extras = [];
modules = [];
};

packages = pkgSet.config.hsPkgs;
in
packages.stylish-haskell.components.exes.stylish-haskell

0 comments on commit ae18800

Please sign in to comment.