Skip to content

Commit

Permalink
Comment some unused test stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasjm committed Oct 25, 2024
1 parent eaf88d4 commit d3c71e6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions test/FSNotify/Test/EventTests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import UnliftIO.Directory


eventTests :: (
MonadUnliftIO m, MonadThrow m, HasParallelSemaphore' context
MonadUnliftIO m, MonadThrow m
) => ThreadingMode -> SpecFree context m ()
eventTests threadingMode = describe "Tests" $ parallel $ do
let pollOptions = if isBSD then [True] else [False, True]
Expand All @@ -37,7 +37,7 @@ eventTests threadingMode = describe "Tests" $ parallel $ do
eventTests' timeInterval threadingMode poll recursive nested

eventTests' :: (
MonadUnliftIO m, MonadThrow m, HasParallelSemaphore' context
MonadUnliftIO m, MonadThrow m
) => Int -> ThreadingMode -> Bool -> Bool -> Bool -> SpecFree context m ()
eventTests' timeInterval threadingMode poll recursive nested = do -- withParallelSemaphore $
let itWithFolder name action = introduceTestFolder timeInterval threadingMode poll recursive nested $ it name action
Expand Down
22 changes: 12 additions & 10 deletions test/FSNotify/Test/Util.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import Control.Retry
import Data.String.Interpolate
import System.FSNotify
import System.FilePath
import System.PosixCompat.Files (touchFile)
import System.Random as R
import Test.Sandwich
import UnliftIO hiding (poll, Handler)
Expand All @@ -31,12 +30,15 @@ import Data.Monoid
#ifdef mingw32_HOST_OS
import Data.Bits
import System.Win32.File (getFileAttributes, setFileAttributes, fILE_ATTRIBUTE_TEMPORARY)

-- Perturb the file's attributes, to check that a modification event is emitted
changeFileAttributes :: FilePath -> IO ()
changeFileAttributes file = do
attrs <- getFileAttributes file
setFileAttributes file (attrs `xor` fILE_ATTRIBUTE_TEMPORARY)
#else
import System.PosixCompat.Files (touchFile)

changeFileAttributes :: FilePath -> IO ()
changeFileAttributes = touchFile
#endif
Expand Down Expand Up @@ -150,14 +152,14 @@ withRandomTempDirectory action = do
randomID <- liftIO $ replicateM 10 $ R.randomRIO ('a', 'z')
withSystemTempDirectory ("test." <> randomID) action

withParallelSemaphore :: forall context m. (
MonadUnliftIO m, HasLabel context "parallelSemaphore" QSem
) => SpecFree context m () -> SpecFree context m ()
withParallelSemaphore = around' (defaultNodeOptions { nodeOptionsRecordTime = False, nodeOptionsVisibilityThreshold = 125 }) "claim semaphore" $ \action -> do
s <- getContext parallelSemaphore'
bracket_ (liftIO $ waitQSem s) (liftIO $ signalQSem s) (void action)
-- withParallelSemaphore :: forall context m. (
-- MonadUnliftIO m, HasLabel context "parallelSemaphore" QSem
-- ) => SpecFree context m () -> SpecFree context m ()
-- withParallelSemaphore = around' (defaultNodeOptions { nodeOptionsRecordTime = False, nodeOptionsVisibilityThreshold = 125 }) "claim semaphore" $ \action -> do
-- s <- getContext parallelSemaphore'
-- bracket_ (liftIO $ waitQSem s) (liftIO $ signalQSem s) (void action)

parallelSemaphore' :: Label "parallelSemaphore" QSem
parallelSemaphore' = Label
-- parallelSemaphore' :: Label "parallelSemaphore" QSem
-- parallelSemaphore' = Label

type HasParallelSemaphore' context = HasLabel context "parallelSemaphore" QSem
-- type HasParallelSemaphore' context = HasLabel context "parallelSemaphore" QSem

0 comments on commit d3c71e6

Please sign in to comment.