Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 16 additions & 15 deletions plutus-benchmark/common/PlutusBenchmark/Common.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE LambdaCase #-}

{- | Miscellaneous shared code for benchmarking-related things. -}
module PlutusBenchmark.Common
Expand Down Expand Up @@ -245,16 +245,17 @@ checkGoldenFileExists path = do
fullPath <- makeAbsolute path
fileExists <- doesFileExist path
if not fileExists
then errorWithExplanation $ "golden file " ++ fullPath ++ " does not exist."
else do
perms <- getPermissions path
if not (writable perms)
then errorWithExplanation $ "golden file " ++ fullPath ++ " is not writable."
else pure ()
where errorWithExplanation s =
let msg = "\n* ERROR: " ++ s ++ "\n"
++ "* To ensure that the correct path is used, either use `cabal test` "
++ "or run the test in the root directory of the relevant package.\n"
++ "* If this is the first time this test has been run, create an "
++ "initial golden file manually."
in error msg
then errorWithExplanation $ "golden file " ++ fullPath ++ " does not exist."
else do
perms <- getPermissions path
if not (writable perms)
then errorWithExplanation $ "golden file " ++ fullPath ++ " is not writable."
else pure ()
where
errorWithExplanation s =
let msg = "\n* ERROR: " ++ s ++ "\n"
++ "* To ensure that the correct path is used, either use `cabal test` "
++ "or run the test in the root directory of the relevant package.\n"
++ "* If this is the first time this test has been run, create an "
++ "initial golden file manually."
in error msg
1 change: 0 additions & 1 deletion plutus-benchmark/common/PlutusBenchmark/NaturalSort.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{-# LANGUAGE LambdaCase #-}

module PlutusBenchmark.NaturalSort (naturalSort)
where
Expand Down
1 change: 1 addition & 0 deletions plutus-benchmark/plutus-benchmark.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ common lang
---------------- Common code for benchmarking ----------------

library plutus-benchmark-common
visibility: public
import: lang, os-support
hs-source-dirs: common
exposed-modules:
Expand Down