Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
32 changes: 17 additions & 15 deletions plutus-benchmark/common/PlutusBenchmark/Common.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE ImportQualifiedPost #-}
{-# LANGUAGE LambdaCase #-}

{- | Miscellaneous shared code for benchmarking-related things. -}
module PlutusBenchmark.Common
Expand Down Expand Up @@ -245,16 +246,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
2 changes: 1 addition & 1 deletion plutus-benchmark/common/PlutusBenchmark/NaturalSort.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE DerivingStrategies #-}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's enabled globally in plutus-benchmark.cabal, so it shouldn't be needed here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@perturbing Did you have some reason for adding that, like you needed it to use a copy of the code outside our repository? I've removed this and another one that don't seem to be needed.


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
Loading