diff options
author | Jim <jim.crayne@gmail.com> | 2016-04-27 18:56:37 -0400 |
---|---|---|
committer | Jim <jim.crayne@gmail.com> | 2016-04-27 18:56:37 -0400 |
commit | ee5f119e148ccc7584ac36cd081ce2fc9dde2bfd (patch) | |
tree | e71b256be0b740e0a25420f4e209f7cb74f5fe73 /testkiki | |
parent | dd7f4f6e0e8d932979caa9ab70030aacce18b64a (diff) |
Testsuite fixes
Diffstat (limited to 'testkiki')
-rw-r--r-- | testkiki/testkiki.hs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/testkiki/testkiki.hs b/testkiki/testkiki.hs index 64c1a6a..0b0f263 100644 --- a/testkiki/testkiki.hs +++ b/testkiki/testkiki.hs | |||
@@ -278,7 +278,9 @@ doTests tkConfig = hspec $ do | |||
278 | copyFile "/etc/ssh/ssh_config" etcFile | 278 | copyFile "/etc/ssh/ssh_config" etcFile |
279 | -- copy ssh_config to ssh_config.old, preserving timestamps | 279 | -- copy ssh_config to ssh_config.old, preserving timestamps |
280 | (mtime0,etcFile0) <- saveFileInfo etcFile | 280 | (mtime0,etcFile0) <- saveFileInfo etcFile |
281 | let hasSubStr x file = B.isPrefixOf x . snd . B.breakSubstring x <$> B.readFile file | 281 | let hasSubStr x file = |
282 | doesFileExist file >>= | ||
283 | (bool (return False) $ B.isPrefixOf x . snd . B.breakSubstring x <$> B.readFile file) | ||
282 | -- does it already mention /var/cache/kiki/ssh_known_hosts? expect not | 284 | -- does it already mention /var/cache/kiki/ssh_known_hosts? expect not |
283 | subStr0 <- etcFileBS `hasSubStr` "/var/cache/kiki/ssh_known_hosts" | 285 | subStr0 <- etcFileBS `hasSubStr` "/var/cache/kiki/ssh_known_hosts" |
284 | cokiki cfg ["ssh-client"] myStdErr | 286 | cokiki cfg ["ssh-client"] myStdErr |
@@ -333,14 +335,17 @@ doTests tkConfig = hspec $ do | |||
333 | (\(_,h) -> hClose h) $ \(errfile,myStdErr) -> | 335 | (\(_,h) -> hClose h) $ \(errfile,myStdErr) -> |
334 | flip catch (\(e::SomeException) -> (do | 336 | flip catch (\(e::SomeException) -> (do |
335 | b <- hIsOpen myStdErr | 337 | b <- hIsOpen myStdErr |
336 | x <- if b then do | 338 | x <- if b then try $ do |
337 | x' <- hGetContents myStdErr | 339 | x' <- hGetContents myStdErr |
338 | hClose myStdErr | 340 | hClose myStdErr |
339 | return x' | 341 | return x' |
340 | else readFile errfile | 342 | else try $ readFile errfile :: IO (Either SomeException String) |
341 | let e' = show e | 343 | let e' = show e |
342 | if "Pending" `isPrefixOf` e' then throw e | 344 | let showR (Right x) = show x |
343 | else return (x,show e) | 345 | showR _ = "" |
346 | if ("Pending" `isPrefixOf` e' | ||
347 | || "HUnit" `isPrefixOf` e') then throw e | ||
348 | else return (showR x,show e) | ||
344 | ) `shouldReturn` (drop len errfile,"EXCEPTION")) $ action myStdErr | 349 | ) `shouldReturn` (drop len errfile,"EXCEPTION")) $ action myStdErr |
345 | 350 | ||
346 | kiki'Env config args = do | 351 | kiki'Env config args = do |